summaryrefslogtreecommitdiff
path: root/Chipset/SB/CSM/LegacyInterrupt
diff options
context:
space:
mode:
Diffstat (limited to 'Chipset/SB/CSM/LegacyInterrupt')
-rw-r--r--Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.c310
-rw-r--r--Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.cif11
-rw-r--r--Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.dxs65
-rw-r--r--Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.mak90
-rw-r--r--Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.sdl25
5 files changed, 501 insertions, 0 deletions
diff --git a/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.c b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.c
new file mode 100644
index 0000000..6177f8a
--- /dev/null
+++ b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.c
@@ -0,0 +1,310 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.c 14 7/28/10 2:46p Olegi $
+//
+// $Revision: 14 $
+//
+// $Date: 7/28/10 2:46p $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.c $
+//
+// 14 7/28/10 2:46p Olegi
+//
+// 13 1/12/10 11:51a Olegi
+// Copyright message updated.
+//
+// 12 10/14/09 12:26p Krishnakumarg
+// CloseEvent funtion used instead of a static variable in callback
+// routines - EIP 27065
+//
+// 11 4/27/07 5:43p Olegi
+//
+// 10 4/27/07 5:39p Olegi
+//
+// 9 4/27/07 5:21p Olegi
+// CSM.CHM preparations.
+//
+// 8 10/13/06 12:32a Felixp
+// UEFI2.0 compliance: use CreateReadyToBootEvent instead of
+// CreateEvent(READY_TO_BOOT)
+//
+// 7 5/27/05 4:24p Markw
+// Added Boot Script.
+//
+// 6 4/04/05 4:19p Sivagarn
+// Updated to latest template format
+//
+// 2 2/22/05 10:00a Sivagarn
+// - Updated to latest labeled CSM & Core
+//
+// 5 1/18/05 3:22p Felixp
+// PrintDebugMessage renamed to Trace
+//
+// 4 12/09/04 10:59a Olegi
+//
+// 3 12/06/04 9:37a Olegi
+// Added interrupt router registers' buffering.
+//
+// 2 12/03/04 9:55a Olegi
+//
+// 1 10/26/04 9:48a Olegi
+//
+// 3 8/31/04 5:46p Markw
+// Fixed bug. Using wrong value to index PirqReg.
+//
+// 2 8/25/04 4:58p Markw
+// Added comments.
+//
+// 1 8/25/04 3:01p Markw
+//
+// 1 8/13/04 2:39p Markw
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: 8259InterruptController.c
+//
+// Description: Initialize and provide a protocol to set PIRQ values
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#include <AmiDxeLib.h>
+#include <Protocol\PciRootBridgeIo.h>
+#include <Protocol\LegacyInterrupt.h>
+#include <Protocol\BootScriptSave.h>
+
+extern UINT8 bMaxPIRQ;
+extern UINT8 bRouterBus;
+extern UINT8 bRouterDevice;
+extern UINT8 bRouterFunction;
+
+EFI_GUID gEfiLegacyInterruptProtocolGuid = EFI_LEGACY_INTERRUPT_PROTOCOL_GUID;
+EFI_GUID gEfiPciRootBridgeIoProtocolGuid = EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID;
+EFI_GUID gEfiBootScriptSaveGuid = EFI_BOOT_SCRIPT_SAVE_GUID;
+
+EFI_EVENT gEvtBootScript;
+
+extern
+EFI_STATUS
+SBGen_InitializeRouterRegisters (
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *gPciRootBridgeIo);
+
+extern
+EFI_STATUS
+SBGen_ReadPirq (
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ OUT UINT8 *PirqData);
+
+EFI_STATUS
+SBGen_WritePirq(
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ IN UINT8 PirqNumber,
+ IN UINT8 PirqData);
+
+EFI_STATUS SBGen_WriteBootScript(
+ IN EFI_BOOT_SCRIPT_SAVE_PROTOCOL *BootScriptSave
+);
+
+//**********************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: GetNumberPirqs
+//
+// Description: Return number of supported Pirqs.
+//
+// Input:
+// IN EFI_LEGACY_INTERRUPT_PROTOCOL *This
+// OUT UINT8 *NumberPirqs
+//
+// Output:
+// Status of the operation
+//
+// Notes:
+// Here is the control flow of this function:
+// 1. Set NumberPirqs to number of supported Pirqs.
+// 2. Return EFI_SUCCESS;
+//
+//<AMI_PHDR_END>
+//**********************************************************************
+EFI_STATUS GetNumberPirqs(
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *NumberPirqs
+ )
+{
+ *NumberPirqs = bMaxPIRQ;
+ return EFI_SUCCESS;
+}
+
+//**********************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: GetLocation
+//
+// Description: Return location of device controlling the Pirqs.
+//
+// Input:
+// IN EFI_LEGACY_INTERRUPT_PROTOCOL *This
+// OUT UINT8 *Bus
+// OUT UINT8 *Device
+// OUT UINT8 *Function
+//
+// Output:
+// Status of the operation
+//
+// Notes:
+// Here is the control flow of this function:
+// 1. Set Bus, Device, and Function.
+// 2. Return EFI_SUCCESS.
+//
+//<AMI_PHDR_END>
+//**********************************************************************
+EFI_STATUS GetLocation(
+ IN EFI_LEGACY_INTERRUPT_PROTOCOL *This,
+ OUT UINT8 *Bus,
+ OUT UINT8 *Device,
+ OUT UINT8 *Function
+ )
+{
+ *Bus = bRouterBus;
+ *Device = bRouterDevice;
+ *Function = bRouterFunction;
+ return EFI_SUCCESS;
+}
+
+
+
+EFI_LEGACY_INTERRUPT_PROTOCOL gEfiLegacyInterruptProtocol =
+{
+ GetNumberPirqs, GetLocation,
+ SBGen_ReadPirq, SBGen_WritePirq
+};
+
+//**********************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: CallbackBootScript
+//
+// Description: Saves the PIRQ registers to Boot Script
+//
+// Input:
+// IN EFI_EVENT Event
+// IN VOID *Context
+// Output:
+// None
+//
+//<AMI_PHDR_END>
+//**********************************************************************
+VOID CallbackBootScript(IN EFI_EVENT Event, IN VOID *Context)
+{
+ EFI_BOOT_SCRIPT_SAVE_PROTOCOL *BootScriptSave;
+ EFI_STATUS Status;
+
+
+ Status = pBS->LocateProtocol(
+ &gEfiBootScriptSaveGuid,
+ NULL,
+ &BootScriptSave
+ );
+ if (EFI_ERROR(Status)) return;
+
+ SBGen_WriteBootScript(BootScriptSave);
+
+ //
+ //Kill the Event
+ //
+ pBS->CloseEvent(Event);
+
+}
+
+
+//**********************************************************************
+//<AMI_PHDR_START>
+//
+// Procedure: InitializeLegacyInterrupt
+//
+// Description: Install Legacy Interrupt Protocol.
+//
+// Input:
+// IN EFI_HANDLE ImageHandle
+// IN EFI_SYSTEM_TABLE *SystemTable
+//
+// Output:
+// EFI_STATUS
+//
+// Notes:
+// Here is the control flow of this function:
+// 1. Intialize Library.
+// 2. Locate PciRootBridgeIo. If error, return error.
+// 3. Install Legacy Interrupt protocol.
+// 4. Return its Status.
+//<AMI_PHDR_END>
+//**********************************************************************
+EFI_STATUS InitializeLegacyInterrupt(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *gPciRootBridgeIo;
+
+ InitAmiLib(ImageHandle, SystemTable);
+
+ Status = pBS->LocateProtocol(
+ &gEfiPciRootBridgeIoProtocolGuid,
+ NULL,
+ &gPciRootBridgeIo
+ );
+ if (EFI_ERROR(Status)) return Status;
+
+ //Create event for boot script
+ Status = CreateReadyToBootEvent(
+ TPL_NOTIFY,
+ CallbackBootScript,
+ NULL,
+ &gEvtBootScript
+ );
+ ASSERT_EFI_ERROR(Status);
+
+ //
+ // Initialize router registers buffer
+ //
+ Status = SBGen_InitializeRouterRegisters (gPciRootBridgeIo);
+ if (EFI_ERROR(Status)) return Status;
+
+ return pBS->InstallMultipleProtocolInterfaces(
+ &ImageHandle,
+ &gEfiLegacyInterruptProtocolGuid, &gEfiLegacyInterruptProtocol,
+ NULL
+ );
+}
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.cif b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.cif
new file mode 100644
index 0000000..381450d
--- /dev/null
+++ b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.cif
@@ -0,0 +1,11 @@
+<component>
+ name = "LegacyInterrupt"
+ category = ModulePart
+ LocalRoot = "Chipset\SB\CSM\LegacyInterrupt\"
+ RefName = "LegacyInterrupt"
+[files]
+"\LegacyInterrupt.sdl"
+"\LegacyInterrupt.mak"
+"\LegacyInterrupt.c"
+"\LegacyInterrupt.dxs"
+<endComponent>
diff --git a/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.dxs b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.dxs
new file mode 100644
index 0000000..7aca534
--- /dev/null
+++ b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.dxs
@@ -0,0 +1,65 @@
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
+
+//**********************************************************************
+// $Header: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.dxs 5 1/12/10 11:51a Olegi $
+//
+// $Revision: 5 $
+//
+// $Date: 1/12/10 11:51a $
+//**********************************************************************
+// Revision History
+// ----------------
+// $Log: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.dxs $
+//
+// 5 1/12/10 11:51a Olegi
+// Copyright message updated.
+//
+// 4 4/27/07 5:21p Olegi
+// CSM.CHM preparations.
+//
+// 3 8/23/05 11:51a Girim
+// Updated Copyright Year
+//
+//**********************************************************************
+//<AMI_FHDR_START>
+//
+// Name: LegacyInterrupt.dxs
+//
+// Description: Legacy Interrupt dependency file
+//
+//<AMI_FHDR_END>
+//**********************************************************************
+
+#include <Protocol\PciRootBridgeIo.h>
+#include <Protocol\BootScriptSave.h>
+
+DEPENDENCY_START
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_GUID AND
+ EFI_BOOT_SCRIPT_SAVE_GUID
+DEPENDENCY_END
+
+//**********************************************************************
+//**********************************************************************
+//** **
+//** (C)Copyright 1985-2010, American Megatrends, Inc. **
+//** **
+//** All Rights Reserved. **
+//** **
+//** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+//** **
+//** Phone: (770)-246-8600 **
+//** **
+//**********************************************************************
+//**********************************************************************
diff --git a/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.mak b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.mak
new file mode 100644
index 0000000..6d23259
--- /dev/null
+++ b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.mak
@@ -0,0 +1,90 @@
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
+
+#**********************************************************************
+# $Header: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.mak 8 1/12/10 11:51a Olegi $
+#
+# $Revision: 8 $
+#
+# $Date: 1/12/10 11:51a $
+#**********************************************************************
+# Revision History
+# ----------------
+# $Log: /Alaska/SOURCE/Modules/CSM/Generic/Chipset/SouthBridge/LegacyInterrupt.mak $
+#
+# 8 1/12/10 11:51a Olegi
+# Copyright message updated.
+#
+# 7 4/27/07 5:21p Olegi
+# CSM.CHM preparations.
+#
+# 6 12/02/05 11:44a Felixp
+#
+# 5 4/04/05 4:19p Sivagarn
+# Included CSP Library into the build process
+#
+# 2 2/22/05 10:00a Sivagarn
+# - Updated to latest labeled CSM & Core
+#
+# 4 1/18/05 3:22p Felixp
+# PrintDebugMessage renamed to Trace
+#
+# 3 12/24/04 3:42p Felixp
+#
+# 2 11/30/04 4:22p Felixp
+# Updated in accordance with the latest build process
+#
+# 1 10/26/04 9:48a Olegi
+#
+# 1 8/25/04 3:01p Markw
+#
+# 1 8/13/04 2:39p Markw
+#
+#**********************************************************************
+#<AMI_FHDR_START>
+#
+# Name: LegacyInterrupt
+#
+# Description: Legacy Interrupt make file
+#
+#<AMI_FHDR_END>
+#**********************************************************************
+all : LegacyInterrupt
+
+LegacyInterrupt : $(BUILD_DIR)\LegacyInterrupt.mak LegacyInterruptBin
+
+$(BUILD_DIR)\LegacyInterrupt.mak : $(LEGACY_INTERRUPT_DIR)\$(@B).cif $(LEGACY_INTERRUPT_DIR)\$(@B).mak $(BUILD_RULES)
+ $(CIF2MAK) $(LEGACY_INTERRUPT_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS)
+
+LegacyInterruptBin : $(AMIDXELIB) $(AMICSPLib)
+ $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\
+ /f $(BUILD_DIR)\LegacyInterrupt.mak all\
+ GUID=71ED12D1-250B-42fb-8C17-10DCFA771701\
+ ENTRY_POINT=InitializeLegacyInterrupt\
+ TYPE=BS_DRIVER\
+ COMPRESS=1
+
+#**********************************************************************
+#**********************************************************************
+#** **
+#** (C)Copyright 1985-2010, American Megatrends, Inc. **
+#** **
+#** All Rights Reserved. **
+#** **
+#** 5555 Oakbrook Pkwy, Suite 200, Norcross, GA 30093 **
+#** **
+#** Phone: (770)-246-8600 **
+#** **
+#**********************************************************************
+#**********************************************************************
diff --git a/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.sdl b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.sdl
new file mode 100644
index 0000000..d6a7457
--- /dev/null
+++ b/Chipset/SB/CSM/LegacyInterrupt/LegacyInterrupt.sdl
@@ -0,0 +1,25 @@
+TOKEN
+ Name = "LegacyInterrupt_SUPPORT"
+ Value = "1"
+ Help = "Main switch to enable LegacyInterrupt support in Project"
+ TokenType = Boolean
+ TargetEQU = Yes
+ TargetMAK = Yes
+ Master = Yes
+End
+
+PATH
+ Name = "LEGACY_INTERRUPT_DIR"
+End
+
+MODULE
+ Help = "Includes LegacyInterrupt.mak to Project"
+ File = "LegacyInterrupt.mak"
+End
+
+ELINK
+ Name = "$(BUILD_DIR)\LegacyInterrupt.ffs"
+ Parent = "FV_MAIN"
+ InvokeOrder = AfterParent
+End
+