diff options
Diffstat (limited to 'ReferenceCode/Chipset/LynxPoint/LegacyInterrupt')
6 files changed, 566 insertions, 0 deletions
diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif new file mode 100644 index 0000000..b6fd327 --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.cif @@ -0,0 +1,12 @@ +<component> + name = "IntelLegacyInterrupt" + category = ModulePart + LocalRoot = "ReferenceCode\Chipset\LynxPoint\LegacyInterrupt\Dxe" + RefName = "IntelLegacyInterrupt" +[files] +"IntelLegacyInterrupt.sdl" +"IntelLegacyInterrupt.mak" +"LegacyInterrupt.c" +"LegacyInterrupt.h" +"LegacyInterrupt.inf" +<endComponent> diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak new file mode 100644 index 0000000..c304a3b --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.mak @@ -0,0 +1,91 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* + +#************************************************************************* +# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.mak 2 2/24/12 2:11a Victortu $ +# +# $Revision: 2 $ +# +# $Date: 2/24/12 2:11a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.mak $ +# +# 2 2/24/12 2:11a Victortu +# Updated to support 4.6.5.3_IntelEDK_1117_Patch7_00. +# +# 1 2/08/12 8:45a Yurenlai +# Intel Lynx Point/SB eChipset initially releases. +# +#************************************************************************* + +#--------------------------------------------------------------------------- +# Create IntelLegacyInterrupt Driver +#--------------------------------------------------------------------------- +EDK : IntelLegacyInterrupt +IntelLegacyInterrupt : $(BUILD_DIR)\IntelLegacyInterrupt.mak IntelLegacyInterruptBin + + +$(BUILD_DIR)\IntelLegacyInterrupt.mak : $(IntelLegacyInterrupt_DIR)\$(@B).cif $(IntelLegacyInterrupt_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(IntelLegacyInterrupt_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +IntelLegacyInterrupt_INCLUDES=\ + $(INTEL_PCH_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + +IntelLegacyInterrupt_DEFINES = $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=LegacyInterruptInstall"\ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \ + /D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \ + +IntelLegacyInterrupt_LIB_LINKS =\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EDKPROTOCOLLIB)\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + +IntelLegacyInterruptBin: $(IntelLegacyInterrupt_LIB_LINKS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\IntelLegacyInterrupt.mak all \ + "MY_INCLUDES=$(IntelLegacyInterrupt_INCLUDES)"\ + "MY_DEFINES=$(IntelLegacyInterrupt_DEFINES)"\ + GUID=C1C418F9-591D-461c-82A2-B9CD96DFEA86\ + ENTRY_POINT=_ModuleEntryPoint \ + TYPE=BS_DRIVER\ + EDKIIModule=DXEDRIVER\ + COMPRESS=1 +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl new file mode 100644 index 0000000..194a4cc --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/IntelLegacyInterrupt.sdl @@ -0,0 +1,67 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* + +#************************************************************************* +# $Header: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.sdl 1 2/08/12 8:45a Yurenlai $ +# +# $Revision: 1 $ +# +# $Date: 2/08/12 8:45a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Refcode/IntelLegacyInterrupt/IntelLegacyInterrupt.sdl $ +# +# 1 2/08/12 8:45a Yurenlai +# Intel Lynx Point/SB eChipset initially releases. +# +#************************************************************************* +TOKEN + Name = "IntelLegacyInterrupt_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable IntelLegacyInterrupt support in Project" +End + +PATH + Name = "IntelLegacyInterrupt_DIR" + Help = "IntelLegacyInterrupt file source directory" +End + +MODULE + File = "IntelLegacyInterrupt.mak" + Help = "Includes IntelLegacyInterrupt.mak to Project" +End + +ELINK + Name = "$(BUILD_DIR)\IntelLegacyInterrupt.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c new file mode 100644 index 0000000..213f91b --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.c @@ -0,0 +1,204 @@ +/** @file + This code supports a the private implementation + of the Legacy Interrupt protocol + +@copyright + Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Reference Module" and is + licensed for Intel CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement +**/ +#include "LegacyInterrupt.h" + +/// +/// Handle for the Legacy Interrupt Protocol instance produced by this driver +/// +EFI_HANDLE mLegacyInterruptHandle = NULL; + +/// +/// The Legacy Interrupt Protocol instance produced by this driver +/// +EFI_LEGACY_INTERRUPT_PROTOCOL mLegacyInterrupt = { + GetNumberPirqs, + GetLocation, + ReadPirq, + WritePirq +}; + +/// +/// Module Global: +/// Since this driver will only ever produce one instance of the Private Data +/// protocol you are not required to dynamically allocate the PrivateData. +/// +UINT8 PirqReg[MAX_PIRQ_NUMBER] = { PIRQA, PIRQB, PIRQC, PIRQD, PIRQE, PIRQF, PIRQG, PIRQH }; + +/** + Return the number of PIRQs supported by this chipset. + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[out] NumberPirqs The pointer which point to the max IRQ number supported by this PCH. + + @retval EFI_SUCCESS Legacy BIOS protocol installed +**/ +EFI_STATUS +EFIAPI +GetNumberPirqs ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + OUT UINT8 *NumberPirqs + ) +{ + *NumberPirqs = MAX_PIRQ_NUMBER; + + return EFI_SUCCESS; +} + +/** + Return PCI location of this device. $PIR table requires this info. + + @param[in] This Protocol instance pointer. + @param[out] Bus PCI Bus + @param[out] Device PCI Device + @param[out] Function PCI Function + + @retval EFI_SUCCESS Bus/Device/Function returned +**/ +EFI_STATUS +EFIAPI +GetLocation ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + OUT UINT8 *Bus, + OUT UINT8 *Device, + OUT UINT8 *Function + ) +{ + *Bus = DEFAULT_PCI_BUS_NUMBER_PCH; + *Device = PCI_DEVICE_NUMBER_PCH_LPC; + *Function = PCI_FUNCTION_NUMBER_PCH_LPC; + + return EFI_SUCCESS; +} + +/** + Builds the PCIE configuration address for the register specified by PirqNumber + + @param[in] PirqNumber The PIRQ number to build the PCIE configuration address for + + @retval UINTN The PCIE Configuration address for interrupt controller in PCH +**/ +UINTN +GetAddress ( + UINT8 PirqNumber + ) +{ + return MmPciAddress ( + 0, + DEFAULT_PCI_BUS_NUMBER_PCH, + PCI_DEVICE_NUMBER_PCH_LPC, + PCI_FUNCTION_NUMBER_PCH_LPC, + PirqReg[PirqNumber] + ); +} + +/** + Read the given PIRQ register + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc + @param[out] PirqData Value read + + @retval EFI_SUCCESS Decoding change affected. + @retval EFI_INVALID_PARAMETER Invalid PIRQ number +**/ +EFI_STATUS +EFIAPI +ReadPirq ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + IN UINT8 PirqNumber, + OUT UINT8 *PirqData + ) +{ + if (PirqNumber >= MAX_PIRQ_NUMBER) { + return EFI_INVALID_PARAMETER; + } + + *PirqData = MmioRead8 (GetAddress (PirqNumber)); + *PirqData = (UINT8) (*PirqData & 0x7f); + + return EFI_SUCCESS; +} + +/** + Read the given PIRQ register + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc + @param[in] PirqData Value read + + @retval EFI_SUCCESS Decoding change affected. + @retval EFI_INVALID_PARAMETER Invalid PIRQ number +**/ +EFI_STATUS +EFIAPI +WritePirq ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + IN UINT8 PirqNumber, + IN UINT8 PirqData + ) +{ + if (PirqNumber >= MAX_PIRQ_NUMBER) { + return EFI_INVALID_PARAMETER; + } + + MmioWrite8 (GetAddress (PirqNumber), PirqData); + return EFI_SUCCESS; +} + +/** + Install Driver to produce Legacy Interrupt protocol. + + @param[in] ImageHandle Handle for this drivers loaded image protocol. + @param[in] SystemTable EFI system table. + + @retval EFI_SUCCESS Legacy Interrupt protocol installed + @retval Other No protocol installed, unload driver. +**/ +EFI_STATUS +LegacyInterruptInstall ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + DEBUG ((EFI_D_INFO, "LegacyInterruptInstall() Start\n")); + + /// + /// Make sure the Legacy Interrupt Protocol is not already installed in the system + /// + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiLegacyInterruptProtocolGuid); + + /// + /// Make a new handle and install the protocol + /// + Status = gBS->InstallMultipleProtocolInterfaces ( + &mLegacyInterruptHandle, + &gEfiLegacyInterruptProtocolGuid, + &mLegacyInterrupt, + NULL + ); + ASSERT_EFI_ERROR (Status); + + DEBUG ((EFI_D_INFO, "LegacyInterruptInstall() End\n")); + return Status; +} diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h new file mode 100644 index 0000000..0c9440f --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.h @@ -0,0 +1,119 @@ +/** @file + This code supports a the private implementation + of the Legacy Interrupt protocol + +@copyright + Copyright (c) 1999 - 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Reference Module" and is + licensed for Intel CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement +**/ +#ifndef LEGACY_INTERRUPT_H_ +#define LEGACY_INTERRUPT_H_ + +// +// External include files do NOT need to be explicitly specified in real EDKII +// environment +// +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) + +#include "EdkIIGlueDxe.h" + +#include EFI_PROTOCOL_PRODUCER (LegacyInterrupt) +#include "PchAccess.h" +#endif + +#define PIRQN 0x00 ///< PIRQ Null +#define PIRQA 0x60 +#define PIRQB 0x61 +#define PIRQC 0x62 +#define PIRQD 0x63 +#define PIRQE 0x68 +#define PIRQF 0x69 +#define PIRQG 0x6A +#define PIRQH 0x6B + +#define MAX_PIRQ_NUMBER 8 + +/** + Return the number of PIRQs supported by this chipset. + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[out] NumberPirqs The pointer which point to the max IRQ number supported by this PCH. + + @retval EFI_SUCCESS Legacy BIOS protocol installed +**/ +EFI_STATUS +EFIAPI +GetNumberPirqs ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + OUT UINT8 *NumberPirqs + ); + +/** + Return PCI location of this device. $PIR table requires this info. + + @param[in] This Protocol instance pointer. + @param[out] Bus PCI Bus + @param[out] Device PCI Device + @param[out] Function PCI Function + + @retval EFI_SUCCESS Bus/Device/Function returned +**/ +EFI_STATUS +EFIAPI +GetLocation ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + OUT UINT8 *Bus, + OUT UINT8 *Device, + OUT UINT8 *Function + ); + +/** + Read the given PIRQ register + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc + @param[out] PirqData Value read + + @retval EFI_SUCCESS Decoding change affected. + @retval EFI_INVALID_PARAMETER Invalid PIRQ number +**/ +EFI_STATUS +EFIAPI +ReadPirq ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + IN UINT8 PirqNumber, + OUT UINT8 *PirqData + ); + +/** + Read the given PIRQ register + + @param[in] This Pointer to LegacyInterrupt Protocol + @param[in] PirqNumber The Pirq register 0 = A, 1 = B etc + @param[in] PirqData Value read + + @retval EFI_SUCCESS Decoding change affected. + @retval EFI_INVALID_PARAMETER Invalid PIRQ number +**/ +EFI_STATUS +EFIAPI +WritePirq ( + IN EFI_LEGACY_INTERRUPT_PROTOCOL *This, + IN UINT8 PirqNumber, + IN UINT8 PirqData + ); + +#endif diff --git a/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf new file mode 100644 index 0000000..29c9cbc --- /dev/null +++ b/ReferenceCode/Chipset/LynxPoint/LegacyInterrupt/Dxe/LegacyInterrupt.inf @@ -0,0 +1,73 @@ +## @file +# Component description file for LegacyBios module. +# +#@copyright +# Copyright (c) 1999 - 2013 Intel Corporation. All rights reserved +# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance +# with the terms of the license. Except as permitted by such +# license, no part of this software or documentation may be +# reproduced, stored in a retrieval system, or transmitted in any +# form or by any means without the express written consent of +# Intel Corporation. +# +# This file contains a 'Sample Driver' and is licensed as such +# under the terms of your license agreement with Intel or your +# vendor. This file may be modified by the user, subject to +# the additional terms of the license agreement +# +## + +[defines] +BASE_NAME = LegacyInterrupt +FILE_GUID = C1C418F9-591D-461c-82A2-B9CD96DFEA86 +COMPONENT_TYPE = BS_DRIVER + +[sources.common] + LegacyInterrupt.c + LegacyInterrupt.h +# +# Edk II Glue Driver Entry Point +# + EdkIIGlueDxeDriverEntryPoint.c + +[includes.common] + $(EDK_SOURCE)/Foundation/Efi + . + $(EDK_SOURCE)/Foundation/Include + $(EDK_SOURCE)/Foundation/Efi/Include + $(EDK_SOURCE)/Foundation/Framework/Include + $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include + $(EFI_SOURCE)/$(PROJECT_PCH_ROOT) +# +# EDK II Glue Library utilizes some standard headers from EDK +# + $(EFI_SOURCE) + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Include/Pei + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include + +[libraries.common] + EdkIIGlueDxeReportStatusCodeLib + EdkIIGlueDxeDebugLibReportStatusCode + EdkIIGlueUefiBootServicesTableLib + EdkIIGlueUefiRuntimeServicesTableLib + EdkProtocolLib + EdkFrameworkProtocolLib + EdkIIGlueBasePciLibPciExpress + +[nmake.common] + IMAGE_ENTRY_POINT=_ModuleEntryPoint + +# +# Module Entry Point +# + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=LegacyInterruptInstall + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__ \ + -D __EDKII_GLUE_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \ + -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__
\ No newline at end of file |