--- /dev/null
+/**@file\r
+ Common header file shared by all source files.\r
+\r
+ This file includes package header files, library classes and protocol, PPI & GUID definitions.\r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation.\r
+ All rights reserved.\r
+ This software and associated documentation (if any) is furnished\r
+ under a license and may only be used or copied in accordance\r
+ with the terms of the license. Except as permitted by such\r
+ license, no part of this software or documentation may be\r
+ reproduced, stored in a retrieval system, or transmitted in any\r
+ form or by any means without the express written consent of\r
+ Intel Corporation.\r
+**/\r
+\r
+#ifndef __COMMON_HEADER_H_\r
+#define __COMMON_HEADER_H_\r
+\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+#include <FrameworkDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+#include <Protocol/PciIo.h>\r
+#include <Protocol/ComponentName.h>\r
+#include <Protocol/IsaIo.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/IsaAcpi.h>\r
+#include <Protocol/DriverBinding.h>\r
+#include <Protocol/GenericMemoryTest.h>\r
+#include <Guid/StatusCodeDataTypeId.h>\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+#include <Library/BootScriptLib.h>\r
+#include <Library/PcdLib.h>\r
+//\r
+// Driver Binding Externs\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL gIsaBusControllerDriver;\r
+extern EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName;\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation. All rights reserved. <BR> \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+\r
+Module Name:\r
+\r
+ ComponentName.c\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+#include "ComponentName.h"\r
+\r
+//\r
+// EFI Component Name Protocol\r
+//\r
+EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName = {\r
+ IsaBusComponentNameGetDriverName,\r
+ IsaBusComponentNameGetControllerName,\r
+ "eng"\r
+};\r
+\r
+STATIC EFI_UNICODE_STRING_TABLE mIsaBusDriverNameTable[] = {\r
+ {\r
+ "eng",\r
+ L"ISA Bus Driver"\r
+ },\r
+ {\r
+ NULL,\r
+ NULL\r
+ }\r
+};\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusComponentNameGetDriverName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **DriverName\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Retrieves a Unicode string that is the user readable name of the EFI Driver.\r
+\r
+ Arguments:\r
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+ Language - A pointer to a three character ISO 639-2 language identifier.\r
+ This is the language of the driver name that that the caller \r
+ is requesting, and it must match one of the languages specified\r
+ in SupportedLanguages. The number of languages supported by a \r
+ driver is up to the driver writer.\r
+ DriverName - A pointer to the Unicode string to return. This Unicode string\r
+ is the name of the driver specified by This in the language \r
+ specified by Language.\r
+\r
+ Returns:\r
+ EFI_SUCCESS - The Unicode string for the Driver specified by This\r
+ and the language specified by Language was returned \r
+ in DriverName.\r
+ EFI_INVALID_PARAMETER - Language is NULL.\r
+ EFI_INVALID_PARAMETER - DriverName is NULL.\r
+ EFI_UNSUPPORTED - The driver specified by This does not support the \r
+ language specified by Language.\r
+\r
+--*/\r
+{\r
+ return LookupUnicodeString (\r
+ Language,\r
+ gIsaBusComponentName.SupportedLanguages,\r
+ mIsaBusDriverNameTable,\r
+ DriverName\r
+ );\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusComponentNameGetControllerName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **ControllerName\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Retrieves a Unicode string that is the user readable name of the controller\r
+ that is being managed by an EFI Driver.\r
+\r
+ Arguments:\r
+ This - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.\r
+ ControllerHandle - The handle of a controller that the driver specified by \r
+ This is managing. This handle specifies the controller \r
+ whose name is to be returned.\r
+ ChildHandle - The handle of the child controller to retrieve the name \r
+ of. This is an optional parameter that may be NULL. It \r
+ will be NULL for device drivers. It will also be NULL \r
+ for a bus drivers that wish to retrieve the name of the \r
+ bus controller. It will not be NULL for a bus driver \r
+ that wishes to retrieve the name of a child controller.\r
+ Language - A pointer to a three character ISO 639-2 language \r
+ identifier. This is the language of the controller name \r
+ that that the caller is requesting, and it must match one\r
+ of the languages specified in SupportedLanguages. The \r
+ number of languages supported by a driver is up to the \r
+ driver writer.\r
+ ControllerName - A pointer to the Unicode string to return. This Unicode\r
+ string is the name of the controller specified by \r
+ ControllerHandle and ChildHandle in the language \r
+ specified by Language from the point of view of the \r
+ driver specified by This. \r
+\r
+ Returns:\r
+ EFI_SUCCESS - The Unicode string for the user readable name in the \r
+ language specified by Language for the driver \r
+ specified by This was returned in DriverName.\r
+ EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.\r
+ EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid \r
+ EFI_HANDLE.\r
+ EFI_INVALID_PARAMETER - Language is NULL.\r
+ EFI_INVALID_PARAMETER - ControllerName is NULL.\r
+ EFI_UNSUPPORTED - The driver specified by This is not currently \r
+ managing the controller specified by \r
+ ControllerHandle and ChildHandle.\r
+ EFI_UNSUPPORTED - The driver specified by This does not support the \r
+ language specified by Language.\r
+\r
+--*/\r
+{\r
+ return EFI_UNSUPPORTED;\r
+}\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation. All rights reserved.\r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+\r
+ ComponentName.h\r
+\r
+Abstract:\r
+\r
+\r
+Revision History:\r
+\r
+--*/\r
+\r
+#ifndef _EFI_ISA_BUS_COMPONENT_NAME_H\r
+#define _EFI_ISA_BUS_COMPONENT_NAME_H\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+extern EFI_COMPONENT_NAME_PROTOCOL gIsaBusComponentName;\r
+\r
+//\r
+// EFI Component Name Functions\r
+//\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusComponentNameGetDriverName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **DriverName\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ This - GC_TODO: add argument description\r
+ Language - GC_TODO: add argument description\r
+ DriverName - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ GC_TODO: add return values\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusComponentNameGetControllerName (\r
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
+ IN EFI_HANDLE ControllerHandle,\r
+ IN EFI_HANDLE ChildHandle OPTIONAL,\r
+ IN CHAR8 *Language,\r
+ OUT CHAR16 **ControllerName\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ This - GC_TODO: add argument description\r
+ ControllerHandle - GC_TODO: add argument description\r
+ ChildHandle - GC_TODO: add argument description\r
+ Language - GC_TODO: add argument description\r
+ ControllerName - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ GC_TODO: add return values\r
+\r
+--*/\r
+;\r
+\r
+#endif\r
--- /dev/null
+/**@file\r
+ Entry Point Source file.\r
+\r
+ This file contains the user entry point \r
+\r
+ Copyright (c) 2006 - 2007, Intel Corporation.\r
+ All rights reserved.\r
+ This software and associated documentation (if any) is furnished\r
+ under a license and may only be used or copied in accordance\r
+ with the terms of the license. Except as permitted by such\r
+ license, no part of this software or documentation may be\r
+ reproduced, stored in a retrieval system, or transmitted in any\r
+ form or by any means without the express written consent of\r
+ Intel Corporation.\r
+**/\r
+\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "InternalIsaBus.h"\r
+\r
+/**\r
+ The user Entry Point for module IsaBus. The user code starts with this function.\r
+\r
+ @param[in] ImageHandle The firmware allocated handle for the EFI image. \r
+ @param[in] SystemTable A pointer to the EFI System Table.\r
+ \r
+ @retval EFI_SUCCESS The entry point is executed successfully.\r
+ @retval other Some error occurs when executing this entry point.\r
+\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeIsaBus(\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Install driver model protocol(s).\r
+ //\r
+ Status = EfiLibInstallAllDriverProtocols (\r
+ ImageHandle,\r
+ SystemTable,\r
+ &gIsaBusControllerDriver,\r
+ ImageHandle,\r
+ &gIsaBusComponentName,\r
+ NULL,\r
+ NULL\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+\r
+\r
+ return Status;\r
+}\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+\r
+ IsaBus.h\r
+ \r
+Abstract:\r
+ \r
+ The header file for ISA bus driver\r
+ \r
+Revision History:\r
+\r
+--*/\r
+\r
+#ifndef _EFI_ISA_BUS_H\r
+#define _EFI_ISA_BUS_H\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "ComponentName.h"\r
+\r
+extern EFI_ISA_IO_PROTOCOL IsaIoInterface;\r
+\r
+typedef enum {\r
+ IsaAccessTypeUnknown,\r
+ IsaAccessTypeIo,\r
+ IsaAccessTypeMem,\r
+ IsaAccessTypeMaxType\r
+} ISA_ACCESS_TYPE;\r
+\r
+//\r
+// 16 MB Memory Range\r
+//\r
+#define ISA_MAX_MEMORY_ADDRESS 0x1000000\r
+//\r
+// 64K I/O Range\r
+//\r
+#define ISA_MAX_IO_ADDRESS 0x10000\r
+\r
+typedef struct {\r
+ UINT8 Address;\r
+ UINT8 Page;\r
+ UINT8 Count;\r
+} EFI_ISA_DMA_REGISTERS;\r
+\r
+//\r
+// ISA I/O Device Structure\r
+//\r
+#define ISA_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('i', 's', 'a', 'i')\r
+\r
+typedef struct {\r
+ UINT32 Signature;\r
+ EFI_HANDLE Handle;\r
+ EFI_ISA_IO_PROTOCOL IsaIo;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+} ISA_IO_DEVICE;\r
+\r
+#define ISA_IO_DEVICE_FROM_ISA_IO_THIS(a) CR (a, ISA_IO_DEVICE, IsaIo, ISA_IO_DEVICE_SIGNATURE)\r
+\r
+//\r
+// Global Variables\r
+//\r
+extern EFI_DRIVER_BINDING_PROTOCOL gIsaBusControllerDriver;\r
+\r
+//\r
+// Mapping structure for performing ISA DMA to a buffer above 16 MB\r
+//\r
+typedef struct {\r
+ EFI_ISA_IO_PROTOCOL_OPERATION Operation;\r
+ UINTN NumberOfBytes;\r
+ UINTN NumberOfPages;\r
+ EFI_PHYSICAL_ADDRESS HostAddress;\r
+ EFI_PHYSICAL_ADDRESS MappedHostAddress;\r
+} ISA_MAP_INFO;\r
+\r
+//\r
+// EFI Driver Binding Protocol Interface Functions\r
+//\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function checks to see if a controller can be managed by the ISA Bus \r
+ Driver. This is done by checking to see if the controller supports the \r
+ EFI_PCI_IO_PROTOCOL protocol, and then looking at the PCI Configuration \r
+ Header to see if the device is a PCI to ISA bridge. The class code of \r
+ PCI to ISA bridge: Base class 06h, Sub class 01h Interface 00h \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - The handle of the device to check.\r
+ RemainingDevicePath - A pointer to the remaining portion of a device path.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device is supported by this driver.\r
+ EFI_UNSUPPORTED - The device is not supported by this driver.\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function tells the ISA Bus Driver to start managing a PCI to ISA \r
+ Bridge controller. \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - A handle to the device being started. \r
+ RemainingDevicePath - A pointer to the remaining portion of a device path.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device was started.\r
+ EFI_UNSUPPORTED - The device is not supported.\r
+ EFI_DEVICE_ERROR - The device could not be started due to a device error.\r
+ EFI_ALREADY_STARTED - The device has already been started.\r
+ EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+ \r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE * ChildHandleBuffer OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function tells the ISA Bus Driver to stop managing a PCI to ISA \r
+ Bridge controller. \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - A handle to the device being stopped.\r
+ NumberOfChindren - The number of child device handles in ChildHandleBuffer.\r
+ ChildHandleBuffer - An array of child handles to be freed.\r
+\r
+ \r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device was stopped.\r
+ EFI_DEVICE_ERROR - The device could not be stopped due to a device error.\r
+ EFI_NOT_STARTED - The device has not been started.\r
+ EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+\r
+--*/\r
+;\r
+\r
+//\r
+// Function Prototypes\r
+//\r
+\r
+EFI_STATUS\r
+IsaCreateDevice (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_PCI_IO_PROTOCOL *PciIo,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
+ IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDeviceResourceList,\r
+ OUT EFI_DEVICE_PATH_PROTOCOL **ChildDevicePath\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ Create ISA device found by IsaPnpProtocol \r
+\r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - The handle of ISA bus controller(PCI to ISA bridge)\r
+ PciIo - The Pointer to the PCI protocol \r
+ ParentDevicePath - Device path of the ISA bus controller\r
+ IsaDeviceResourceList - The resource list of the ISA device\r
+ ChildDevicePath - The pointer to the child device.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - Create the child device.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+ EFI_DEVICE_ERROR - Can not create child device.\r
+ \r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+InitializeIsaIoInstance (\r
+ IN ISA_IO_DEVICE *IsaIoDevice,\r
+ IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDevice\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Initializes an ISA I/O Instance\r
+\r
+Arguments:\r
+\r
+ IsaIoDevice - The iso device to be initialized.\r
+ IsaDevice - The resource list.\r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Initial success.\r
+ \r
+--*/\r
+;\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+\r
+ IsaIo.h\r
+ \r
+Abstract:\r
+ \r
+ The header file for EFI_ISA_IO protocol implementation.\r
+ \r
+--*/\r
+\r
+#ifndef _EFI_ISA_IO_LOCAL_H\r
+#define _EFI_ISA_IO_LOCAL_H\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "CommonHeader.h"\r
+\r
+#include "InternalIsaBus.h"\r
+\r
+//\r
+// ISA I/O Support Function Prototypes\r
+//\r
+\r
+EFI_STATUS\r
+IsaIoVerifyAccess (\r
+ IN ISA_IO_DEVICE *IsaIoDevice,\r
+ IN ISA_ACCESS_TYPE Type,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINTN Count,\r
+ IN OUT UINT32 *Offset\r
+ );\r
+ \r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoIoRead (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoIoWrite (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMap (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
+ IN UINT8 ChannelNumber OPTIONAL,\r
+ IN UINT32 ChannelAttributes,\r
+ IN VOID *HostAddress,\r
+ IN OUT UINTN *NumberOfBytes,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoUnmap (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN VOID *Mapping\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoFlush (\r
+ IN EFI_ISA_IO_PROTOCOL *This\r
+ );\r
+\r
+EFI_STATUS\r
+ReportErrorStatusCode (\r
+ EFI_STATUS_CODE_VALUE code\r
+ );\r
+\r
+EFI_STATUS\r
+WriteDmaPort (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINT32 AddrOffset,\r
+ IN UINT32 PageOffset,\r
+ IN UINT32 CountOffset,\r
+ IN UINT32 BaseAddress,\r
+ IN UINT16 Count\r
+ );\r
+\r
+EFI_STATUS\r
+WritePort (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINT32 Offset,\r
+ IN UINT8 Value\r
+ ); \r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMemRead (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMemWrite (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoCopyMem (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 DestOffset,\r
+ IN UINT32 SrcOffset,\r
+ IN UINTN Count\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoAllocateBuffer (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ OUT VOID **HostAddress,\r
+ IN UINT64 Attributes\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoFreeBuffer (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINTN Pages,\r
+ IN VOID *HostAddress\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR> \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+\r
+ IsaBus.c\r
+ \r
+Abstract:\r
+\r
+ Discovers all the ISA Controllers and their resources by using the ISA PnP \r
+ Protocol, produces an instance of the ISA I/O Protocol for every ISA \r
+ Controller found, loads and initializes all ISA Device Drivers, matches ISA\r
+ Device Drivers with their respective ISA Controllers in a deterministic \r
+ manner, and informs a ISA Device Driver when it is to start managing an ISA\r
+ Controller. \r
+\r
+Revision History:\r
+\r
+--*/\r
+\r
+#include "InternalIsaBus.h"\r
+\r
+//\r
+// ISA Bus Driver Global Variables\r
+//\r
+EFI_DRIVER_BINDING_PROTOCOL gIsaBusControllerDriver = {\r
+ IsaBusControllerDriverSupported,\r
+ IsaBusControllerDriverStart,\r
+ IsaBusControllerDriverStop,\r
+ 0xa,\r
+ NULL,\r
+ NULL\r
+};\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverSupported (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function checks to see if a controller can be managed by the ISA Bus \r
+ Driver. This is done by checking to see if the controller supports the \r
+ EFI_PCI_IO_PROTOCOL protocol, and then looking at the PCI Configuration \r
+ Header to see if the device is a PCI to ISA bridge. The class code of \r
+ PCI to ISA bridge: Base class 06h, Sub class 01h Interface 00h \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - The handle of the device to check.\r
+ RemainingDevicePath - A pointer to the remaining portion of a device path.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device is supported by this driver.\r
+ EFI_UNSUPPORTED - The device is not supported by this driver.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_ISA_ACPI_PROTOCOL *IsaAcpi;\r
+\r
+ //\r
+ // If RemainingDevicePath is not NULL, it should verify that the first device\r
+ // path node in RemainingDevicePath is an ACPI Device path node\r
+ //\r
+ if (RemainingDevicePath != NULL) {\r
+ if (RemainingDevicePath->Type != ACPI_DEVICE_PATH) {\r
+ return EFI_UNSUPPORTED;\r
+ } else if (RemainingDevicePath->SubType == ACPI_DP) {\r
+ if (DevicePathNodeLength (RemainingDevicePath) != sizeof (ACPI_HID_DEVICE_PATH)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ } else if (RemainingDevicePath->SubType == ACPI_EXTENDED_DP) {\r
+ if (DevicePathNodeLength (RemainingDevicePath) != sizeof (ACPI_EXTENDED_HID_DEVICE_PATH)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ } else {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ }\r
+ //\r
+ // Test the existence of DEVICE_PATH protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ NULL,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Get the Isa Acpi protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiIsaAcpiProtocolGuid,\r
+ (VOID **) &IsaAcpi,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (Status == EFI_ALREADY_STARTED) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiIsaAcpiProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverStart (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function tells the ISA Bus Driver to start managing a PCI to ISA \r
+ Bridge controller. \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - A handle to the device being started. \r
+ RemainingDevicePath - A pointer to the remaining portion of a device path.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device was started.\r
+ EFI_UNSUPPORTED - The device is not supported.\r
+ EFI_DEVICE_ERROR - The device could not be started due to a device error.\r
+ EFI_ALREADY_STARTED - The device has already been started.\r
+ EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+ \r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PCI_IO_PROTOCOL *PciIo;\r
+ EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
+ EFI_ISA_ACPI_PROTOCOL *IsaAcpi;\r
+ EFI_ISA_ACPI_DEVICE_ID *IsaDevice;\r
+ EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;\r
+ EFI_GENERIC_MEMORY_TEST_PROTOCOL *GenMemoryTest;\r
+\r
+ //\r
+ // Local variables declaration for StatusCode reporting\r
+ //\r
+ EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA AllocFailExtendedData;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePathData;\r
+\r
+ BootScriptSaveInformationAsciiString (\r
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,\r
+ "IsaBusBindingStartBegin"\r
+ );\r
+\r
+ //\r
+ // Initialize status code structure\r
+ //\r
+ AllocFailExtendedData.DataHeader.HeaderSize = sizeof (EFI_STATUS_CODE_DATA);\r
+ AllocFailExtendedData.DataHeader.Size = sizeof (EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA) - sizeof (EFI_STATUS_CODE_DATA);\r
+ CopyMem (\r
+ &AllocFailExtendedData.DataHeader.Type,\r
+ &gEfiStatusCodeSpecificDataGuid,\r
+ sizeof (EFI_GUID)\r
+ );\r
+\r
+ //\r
+ // Open Device Path Protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &ParentDevicePath,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Open Pci IO Protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **) &PciIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ //\r
+ // Close opened protocol\r
+ //\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ return Status;\r
+ }\r
+ //\r
+ // Open ISA Acpi Protocol\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiIsaAcpiProtocolGuid,\r
+ (VOID **) &IsaAcpi,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_BY_DRIVER\r
+ );\r
+ if (EFI_ERROR (Status) && Status != EFI_ALREADY_STARTED) {\r
+ //\r
+ // Close opened protocol\r
+ //\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ return Status;\r
+ }\r
+ //\r
+ // The IsaBus driver will use memory below 16M, which is not tested yet,\r
+ // so call CompatibleRangeTest to test them. Since memory below 1M should\r
+ // be reserved to CSM, and 15M~16M might be reserved for Isa hole, test 1M\r
+ // ~15M here\r
+ //\r
+ Status = gBS->LocateProtocol (\r
+ &gEfiGenericMemTestProtocolGuid,\r
+ NULL,\r
+ (VOID **) &GenMemoryTest\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = GenMemoryTest->CompatibleRangeTest (\r
+ GenMemoryTest,\r
+ 0x100000,\r
+ 0xE00000\r
+ );\r
+ }\r
+ //\r
+ // Report Status Code here since we will initialize the host controller\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ (EFI_IO_BUS_LPC | EFI_IOB_PC_INIT),\r
+ ParentDevicePath\r
+ );\r
+\r
+ //\r
+ // first init ISA interface\r
+ //\r
+ IsaAcpi->InterfaceInit (IsaAcpi);\r
+\r
+ //\r
+ // Report Status Code here since we will enable the host controller\r
+ //\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_PROGRESS_CODE,\r
+ (EFI_IO_BUS_LPC | EFI_IOB_PC_ENABLE),\r
+ ParentDevicePath\r
+ );\r
+\r
+ //\r
+ // Create each ISA device handle in this ISA bus\r
+ //\r
+ IsaDevice = NULL;\r
+ do {\r
+ Status = IsaAcpi->DeviceEnumerate (IsaAcpi, &IsaDevice);\r
+ if (EFI_ERROR (Status)) {\r
+ break;\r
+ }\r
+ //\r
+ // Get current resource of this ISA device\r
+ //\r
+ ResourceList = NULL;\r
+ Status = IsaAcpi->GetCurResource (IsaAcpi, IsaDevice, &ResourceList);\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+\r
+ //\r
+ // Create handle for this ISA device\r
+ //\r
+ Status = IsaCreateDevice (\r
+ This,\r
+ Controller,\r
+ PciIo,\r
+ ParentDevicePath,\r
+ ResourceList,\r
+ &DevicePathData\r
+ //&AllocFailExtendedData.DevicePath\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+ //\r
+ // Initialize ISA device\r
+ //\r
+ IsaAcpi->InitDevice (IsaAcpi, IsaDevice);\r
+\r
+ //\r
+ // Set resources for this ISA device\r
+ //\r
+ Status = IsaAcpi->SetResource (IsaAcpi, IsaDevice, ResourceList);\r
+\r
+ //\r
+ // Report Status Code here when failed to resource conflicts\r
+ //\r
+ if (EFI_ERROR (Status) && (Status != EFI_UNSUPPORTED)) {\r
+ //\r
+ // It's hard to tell which resource conflicts\r
+ //\r
+ AllocFailExtendedData.Bar = 0;\r
+ AllocFailExtendedData.ReqRes = NULL;\r
+ AllocFailExtendedData.AllocRes = NULL;\r
+ REPORT_STATUS_CODE_WITH_DEVICE_PATH (\r
+ EFI_ERROR_CODE,\r
+ (EFI_IO_BUS_LPC | EFI_IOB_EC_RESOURCE_CONFLICT),\r
+ DevicePathData\r
+ );\r
+\r
+ }\r
+ //\r
+ // Set power for this ISA device\r
+ //\r
+ IsaAcpi->SetPower (IsaAcpi, IsaDevice, TRUE);\r
+\r
+ //\r
+ // Enable this ISA device\r
+ //\r
+ IsaAcpi->EnableDevice (IsaAcpi, IsaDevice, TRUE);\r
+\r
+ } while (TRUE);\r
+\r
+ BootScriptSaveInformationAsciiString (\r
+ EFI_ACPI_S3_RESUME_SCRIPT_TABLE,\r
+ "IsaBusBindingStartEnd"\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaBusControllerDriverStop (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL * This,\r
+ IN EFI_HANDLE Controller,\r
+ IN UINTN NumberOfChildren,\r
+ IN EFI_HANDLE * ChildHandleBuffer OPTIONAL\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ This function tells the ISA Bus Driver to stop managing a PCI to ISA \r
+ Bridge controller. \r
+ \r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - A handle to the device being stopped.\r
+ NumberOfChindren - The number of child device handles in ChildHandleBuffer.\r
+ ChildHandleBuffer - An array of child handles to be freed.\r
+\r
+ \r
+ Returns:\r
+ \r
+ EFI_SUCCESS - The device was stopped.\r
+ EFI_DEVICE_ERROR - The device could not be stopped due to a device error.\r
+ EFI_NOT_STARTED - The device has not been started.\r
+ EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ BOOLEAN AllChildrenStopped;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+ EFI_ISA_IO_PROTOCOL *IsaIo;\r
+\r
+ if (NumberOfChildren == 0) {\r
+ //\r
+ // Close the bus driver\r
+ //\r
+ Status = gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiDevicePathProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiIsaAcpiProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ Controller\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Complete all outstanding transactions to Controller.\r
+ // Don't allow any new transaction to Controller to be started.\r
+ //\r
+ //\r
+ // Stop all the children\r
+ // Find all the ISA devices that were discovered on this PCI to ISA Bridge\r
+ // with the Start() function.\r
+ //\r
+ AllChildrenStopped = TRUE;\r
+\r
+ for (Index = 0; Index < NumberOfChildren; Index++) {\r
+\r
+ Status = gBS->OpenProtocol (\r
+ ChildHandleBuffer[Index],\r
+ &gEfiIsaIoProtocolGuid,\r
+ (VOID **) &IsaIo,\r
+ This->DriverBindingHandle,\r
+ Controller,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (IsaIo);\r
+\r
+ Status = gBS->UninstallMultipleProtocolInterfaces (\r
+ ChildHandleBuffer[Index],\r
+ &gEfiDevicePathProtocolGuid,\r
+ IsaIoDevice->DevicePath,\r
+ &gEfiIsaIoProtocolGuid,\r
+ &IsaIoDevice->IsaIo,\r
+ NULL\r
+ );\r
+\r
+ if (!EFI_ERROR (Status)) {\r
+ //\r
+ // Close the child handle\r
+ //\r
+ Status = gBS->CloseProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ This->DriverBindingHandle,\r
+ ChildHandleBuffer[Index]\r
+ );\r
+\r
+ gBS->FreePool (IsaIoDevice->DevicePath);\r
+ gBS->FreePool (IsaIoDevice);\r
+ }\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ AllChildrenStopped = FALSE;\r
+ }\r
+ }\r
+\r
+ if (!AllChildrenStopped) {\r
+ return EFI_DEVICE_ERROR;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+//\r
+// Internal Function\r
+//\r
+EFI_STATUS\r
+IsaCreateDevice (\r
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
+ IN EFI_HANDLE Controller,\r
+ IN EFI_PCI_IO_PROTOCOL *PciIo,\r
+ IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r
+ IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDeviceResourceList,\r
+ OUT EFI_DEVICE_PATH_PROTOCOL **ChildDevicePath\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ \r
+ Create ISA device found by IsaPnpProtocol \r
+\r
+ Arguments:\r
+ \r
+ This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r
+ Controller - The handle of ISA bus controller(PCI to ISA bridge)\r
+ PciIo - The Pointer to the PCI protocol \r
+ ParentDevicePath - Device path of the ISA bus controller\r
+ IsaDeviceResourceList - The resource list of the ISA device\r
+ ChildDevicePath - The pointer to the child device.\r
+\r
+ Returns:\r
+ \r
+ EFI_SUCCESS - Create the child device.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r
+ resources.\r
+ EFI_DEVICE_ERROR - Can not create child device.\r
+ \r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+ EFI_DEV_PATH Node;\r
+\r
+ //\r
+ // Initialize the PCI_IO_DEVICE structure\r
+ //\r
+ IsaIoDevice = AllocateZeroPool (sizeof (ISA_IO_DEVICE));\r
+ if (IsaIoDevice == NULL) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ IsaIoDevice->Signature = ISA_IO_DEVICE_SIGNATURE;\r
+ IsaIoDevice->Handle = NULL;\r
+ IsaIoDevice->PciIo = PciIo;\r
+\r
+ //\r
+ // Initialize the ISA I/O instance structure\r
+ //\r
+ Status = InitializeIsaIoInstance (IsaIoDevice, IsaDeviceResourceList);\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (IsaIoDevice);\r
+ return Status;\r
+ }\r
+ //\r
+ // Build the child device path\r
+ //\r
+ Node.DevPath.Type = ACPI_DEVICE_PATH;\r
+ Node.DevPath.SubType = ACPI_DP;\r
+ SetDevicePathNodeLength (&Node.DevPath, sizeof (ACPI_HID_DEVICE_PATH));\r
+ Node.Acpi.HID = IsaDeviceResourceList->Device.HID;\r
+ Node.Acpi.UID = IsaDeviceResourceList->Device.UID;\r
+\r
+ IsaIoDevice->DevicePath = AppendDevicePathNode (\r
+ ParentDevicePath,\r
+ &Node.DevPath\r
+ );\r
+\r
+ if (IsaIoDevice->DevicePath == NULL) {\r
+ Status = EFI_DEVICE_ERROR;\r
+ goto Done;\r
+ }\r
+\r
+ *ChildDevicePath = IsaIoDevice->DevicePath;\r
+\r
+ //\r
+ // Create a child handle and attach the DevicePath,\r
+ // PCI I/O, and Controller State\r
+ //\r
+ Status = gBS->InstallMultipleProtocolInterfaces (\r
+ &IsaIoDevice->Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ IsaIoDevice->DevicePath,\r
+ &gEfiIsaIoProtocolGuid,\r
+ &IsaIoDevice->IsaIo,\r
+ NULL\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ Status = gBS->OpenProtocol (\r
+ Controller,\r
+ &gEfiPciIoProtocolGuid,\r
+ (VOID **) &PciIo,\r
+ This->DriverBindingHandle,\r
+ IsaIoDevice->Handle,\r
+ EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->UninstallMultipleProtocolInterfaces (\r
+ IsaIoDevice->Handle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ IsaIoDevice->DevicePath,\r
+ &gEfiIsaIoProtocolGuid,\r
+ &IsaIoDevice->IsaIo,\r
+ NULL\r
+ );\r
+ }\r
+\r
+Done:\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ if (IsaIoDevice->DevicePath != NULL) {\r
+ gBS->FreePool (IsaIoDevice->DevicePath);\r
+ }\r
+\r
+ gBS->FreePool (IsaIoDevice);\r
+ }\r
+\r
+ return Status;\r
+}\r
--- /dev/null
+#/** @file\r
+# Component description file for IsaBus module.\r
+#\r
+# Discovers all the ISA Controllers and their resources by using the ISA PnP\r
+# Protocol, produces an instance of the ISA I/O Protocol for every ISA\r
+# Controller found, loads and initializes all ISA Device Drivers, matches ISA\r
+# Device Drivers with their respective ISA Controllers in a deterministic\r
+# manner, and informs a ISA Device Driver when it is to start managing an ISA\r
+# Controller.\r
+# Copyright (c) 2006 - 2007, Intel Corporation.\r
+#\r
+# All rights reserved.\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = IsaBus\r
+ FILE_GUID = 240612B5-A063-11d4-9A3A-0090273FC14D\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+ ENTRY_POINT = InitializeIsaBus\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+# DRIVER_BINDING = gIsaBusControllerDriver \r
+# COMPONENT_NAME = gIsaBusComponentName \r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ ComponentName.c\r
+ IsaIo.c\r
+ IsaBus.c\r
+ IsaIo.h\r
+ IsaBus.h\r
+ IsaAcpi.h\r
+ ComponentName.h\r
+ CommonHeader.h\r
+ EntryPoint.c\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+ IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec\r
+\r
+\r
+################################################################################\r
+#\r
+# Library Class Section - list of Library Classes that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[LibraryClasses]\r
+ PcdLib\r
+ BootScriptLib\r
+ ReportStatusCodeLib\r
+ UefiBootServicesTableLib\r
+ MemoryAllocationLib\r
+ BaseMemoryLib\r
+ DevicePathLib\r
+ UefiLib\r
+ UefiDriverEntryPoint\r
+ DebugLib\r
+\r
+\r
+################################################################################\r
+#\r
+# Guid C Name Section - list of Guids that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Guids]\r
+ gEfiStatusCodeSpecificDataGuid # ALWAYS_CONSUMED\r
+\r
+\r
+################################################################################\r
+#\r
+# Protocol C Name Section - list of Protocol and Protocol Notify C Names\r
+# that this module uses or produces.\r
+#\r
+################################################################################\r
+\r
+[Protocols]\r
+ gEfiIsaIoProtocolGuid # PROTOCOL BY_START\r
+ gEfiIsaAcpiProtocolGuid # PROTOCOL TO_START\r
+ gEfiPciIoProtocolGuid # PROTOCOL TO_START\r
+ gEfiDevicePathProtocolGuid # PROTOCOL TO_START\r
+ gEfiGenericMemTestProtocolGuid # PROTOCOL TO_START\r
+\r
+\r
+################################################################################\r
+#\r
+# Pcd FEATURE_FLAG - list of PCDs that this module is coded for.\r
+#\r
+################################################################################\r
+\r
+[PcdsFeatureFlag.common]\r
+ PcdIsaBusOnlySupportSlaveDma|gEfiIntelFrameworkModulePkgTokenSpaceGuid\r
+ PcdIsaBusSupportDma|gEfiIntelFrameworkModulePkgTokenSpaceGuid\r
+ PcdIsaBusSupportIsaMemory|gEfiIntelFrameworkModulePkgTokenSpaceGuid\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xsi:schemaLocation="http://www.TianoCore.org/2006/Edk2.0 http://www.TianoCore.org/2006/Edk2.0/SurfaceArea.xsd" xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>IsaBus</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>240612B5-A063-11d4-9A3A-0090273FC14D</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>Component description file for IsaBus module.</Abstract>\r
+ <Description>Discovers all the ISA Controllers and their resources by using the ISA PnP
+ Protocol, produces an instance of the ISA I/O Protocol for every ISA
+ Controller found, loads and initializes all ISA Device Drivers, matches ISA
+ Device Drivers with their respective ISA Controllers in a deterministic
+ manner, and informs a ISA Device Driver when it is to start managing an ISA
+ Controller.</Description>\r
+ <Copyright>Copyright (c) 2006 - 2007, Intel Corporation.</Copyright>\r
+ <License>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.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>IsaBus</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DebugLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiDriverModelLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiDriverEntryPoint</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>DevicePathLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BaseMemoryLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>MemoryAllocationLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>UefiBootServicesTableLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>ReportStatusCodeLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>BootScriptLib</Keyword>\r
+ </LibraryClass>\r
+ <LibraryClass Usage="ALWAYS_CONSUMED">\r
+ <Keyword>PcdLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>ComponentName.h</Filename>\r
+ <Filename>IsaAcpi.h</Filename>\r
+ <Filename>IsaBus.h</Filename>\r
+ <Filename>IsaIo.h</Filename>\r
+ <Filename>IsaBus.c</Filename>\r
+ <Filename>IsaIo.c</Filename>\r
+ <Filename>ComponentName.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ <Package PackageGuid="bea835f9-fd62-464a-81ff-f3a806360c6b"/>\r
+ </PackageDependencies>\r
+ <Protocols>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiGenericMemTestProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiDevicePathProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiPciIoProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="TO_START">\r
+ <ProtocolCName>gEfiIsaAcpiProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ <Protocol Usage="BY_START">\r
+ <ProtocolCName>gEfiIsaIoProtocolGuid</ProtocolCName>\r
+ </Protocol>\r
+ </Protocols>\r
+ <Guids>\r
+ <GuidCNames Usage="ALWAYS_CONSUMED">\r
+ <GuidCName>gEfiStatusCodeSpecificDataGuid</GuidCName>\r
+ </GuidCNames>\r
+ </Guids>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ <Extern>\r
+ <DriverBinding>gIsaBusControllerDriver</DriverBinding>\r
+ <ComponentName>gIsaBusComponentName</ComponentName>\r
+ </Extern>\r
+ </Externs>\r
+ <PcdCoded>\r
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+ <C_Name>PcdIsaBusSupportIsaMemory</C_Name>\r
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <DefaultValue>TRUE</DefaultValue>\r
+ <HelpText>This feature flag is used to enable the implementation for interface
+ _EFI_ISA_IO_PROTOCOL.Mem.Read, _EFI_ISA_IO_PROTOCOL.Mem.Write and _EFI_ISA_IO_PROTOCOL.CopyMem.
+ If it is unset, these interfaces will return EFI_UNSUPPORTED. When it is disabled,
+ it is will save code size if a platform does not have ISA device with ISA memory.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+ <C_Name>PcdIsaBusSupportDma</C_Name>\r
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <DefaultValue>TRUE</DefaultValue>\r
+ <HelpText>This feature flag is used to enable the implementation for interface
+ _EFI_ISA_IO_PROTOCOL.AllocateBuffer, _EFI_ISA_IO_PROTOCOL.FreeBuffer, _EFI_ISA_IO_PROTOCOL.Map
+ and _EFI_ISA_IO_PROTOCOL.UnMap. If it is unset, these interfaces will return EFI_UNSUPPORTED.
+ It is useful to save code size if a platform does not have ISA device which did DMA transfer.</HelpText>\r
+ </PcdEntry>\r
+ <PcdEntry PcdItemType="FEATURE_FLAG" Usage="ALWAYS_CONSUMED">\r
+ <C_Name>PcdIsaBusOnlySupportSlaveDma</C_Name>\r
+ <TokenSpaceGuidCName>gEfiGenericPlatformTokenSpaceGuid</TokenSpaceGuidCName>\r
+ <DefaultValue>FALSE</DefaultValue>\r
+ <HelpText>This feature flag is used to enable the implementation for interface
+ _EFI_ISA_IO_PROTOCOL.Map and _EFI_ISA_IO_PROTOCOL.UnMap to only support Slave DMA
+ transfers. In addition, unsetting this feature flag also make AllocateBuffer() and
+ FreeBuffer() to return EFI_UNSUPPORTED. It is useful to save code size if a platform have only
+ ISA device to do slave DMA R/W transfer. This flag is only effective when PcdIsaBusSupportDma
+ is set to TRUE. If PcdIsaBusSupportDma is set to FALSE, Map() and UnMap() will simply
+ return EFI_UNSUPPORTED. Please check description for PcdIsaBusSupportDma for details.</HelpText>\r
+ </PcdEntry>\r
+ </PcdCoded>\r
+</ModuleSurfaceArea>
\ No newline at end of file
--- /dev/null
+/*++\r
+ \r
+Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved. <BR> \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+\r
+Module Name:\r
+\r
+ IsaIo.c\r
+ \r
+Abstract:\r
+\r
+ The implementation for EFI_ISA_IO_PROTOCOL. \r
+\r
+--*/\r
+\r
+//\r
+// Include common header file for this module.\r
+//\r
+#include "InternalIsaIo.h"\r
+\r
+#include <IndustryStandard/Pcat.h>\r
+\r
+//\r
+// Driver Support Global Variables\r
+//\r
+EFI_ISA_IO_PROTOCOL IsaIoInterface = {\r
+ { \r
+ IsaIoMemRead,\r
+ IsaIoMemWrite\r
+ },\r
+ { \r
+ IsaIoIoRead,\r
+ IsaIoIoWrite\r
+ },\r
+ IsaIoCopyMem,\r
+ IsaIoMap,\r
+ IsaIoUnmap,\r
+ IsaIoAllocateBuffer,\r
+ IsaIoFreeBuffer,\r
+ IsaIoFlush,\r
+ NULL,\r
+ 0,\r
+ NULL\r
+};\r
+\r
+static EFI_ISA_DMA_REGISTERS DmaRegisters[8] = {\r
+ {\r
+ 0x00,\r
+ 0x87,\r
+ 0x01\r
+ },\r
+ {\r
+ 0x02,\r
+ 0x83,\r
+ 0x03\r
+ },\r
+ {\r
+ 0x04,\r
+ 0x81,\r
+ 0x05\r
+ },\r
+ {\r
+ 0x06,\r
+ 0x82,\r
+ 0x07\r
+ },\r
+ {\r
+ 0x00,\r
+ 0x00,\r
+ 0x00\r
+ }, // Channel 4 is invalid\r
+ {\r
+ 0xC4,\r
+ 0x8B,\r
+ 0xC6\r
+ },\r
+ {\r
+ 0xC8,\r
+ 0x89,\r
+ 0xCA\r
+ },\r
+ {\r
+ 0xCC,\r
+ 0x8A,\r
+ 0xCE\r
+ },\r
+};\r
+\r
+EFI_STATUS\r
+ReportErrorStatusCode (\r
+ EFI_STATUS_CODE_VALUE Code\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ report a error Status code of PCI bus driver controller\r
+\r
+Arguments:\r
+\r
+ Code - The error status code.\r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Success to report status code.\r
+ \r
+\r
+--*/\r
+{\r
+ return REPORT_STATUS_CODE (\r
+ EFI_ERROR_CODE | EFI_ERROR_MINOR,\r
+ Code\r
+ );\r
+}\r
+\r
+//\r
+// Driver Support Functions\r
+//\r
+\r
+EFI_STATUS\r
+InitializeIsaIoInstance (\r
+ IN ISA_IO_DEVICE *IsaIoDevice,\r
+ IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDeviceResourceList\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Initializes an ISA I/O Instance\r
+\r
+Arguments:\r
+\r
+ IsaIoDevice - The iso device to be initialized.\r
+ IsaDeviceResourceList - The resource list.\r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Initial success.\r
+ \r
+--*/\r
+{\r
+ //\r
+ // Initializes an ISA I/O Instance\r
+ //\r
+ CopyMem (\r
+ &IsaIoDevice->IsaIo,\r
+ &IsaIoInterface,\r
+ sizeof (EFI_ISA_IO_PROTOCOL)\r
+ );\r
+\r
+ IsaIoDevice->IsaIo.ResourceList = IsaDeviceResourceList;\r
+ \r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoIoRead (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Performs an ISA I/O Read Cycle\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Width - Signifies the width of the I/O operation.\r
+ Offset - The offset in ISA I/O space to start the I/O operation. \r
+ Count - The number of I/O operations to perform. \r
+ Buffer - The destination buffer to store the results\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was read from the device sucessfully.\r
+ EFI_UNSUPPORTED - The Offset is not valid for this device.\r
+ EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Verify Isa IO Access\r
+ //\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeIo,\r
+ Width,\r
+ Count,\r
+ &Offset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call PciIo->Io.Read\r
+ //\r
+ Status = IsaIoDevice->PciIo->Io.Read (\r
+ IsaIoDevice->PciIo,\r
+ (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Offset,\r
+ Count,\r
+ Buffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoIoWrite (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Performs an ISA I/O Write Cycle\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Width - Signifies the width of the I/O operation.\r
+ Offset - The offset in ISA I/O space to start the I/O operation. \r
+ Count - The number of I/O operations to perform. \r
+ Buffer - The source buffer to write data from\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was writen to the device sucessfully.\r
+ EFI_UNSUPPORTED - The Offset is not valid for this device.\r
+ EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Verify Isa IO Access\r
+ //\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeIo,\r
+ Width,\r
+ Count,\r
+ &Offset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call PciIo->Io.Write\r
+ //\r
+ Status = IsaIoDevice->PciIo->Io.Write (\r
+ IsaIoDevice->PciIo,\r
+ (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Offset,\r
+ Count,\r
+ Buffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+WritePort (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINT32 Offset,\r
+ IN UINT8 Value\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Writes an 8 bit I/O Port\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Offset - The offset in ISA IO space to start the IO operation. \r
+ Value - The data to write port.\r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Success.\r
+ EFI_INVALID_PARAMETER - Parameter is invalid.\r
+ EFI_UNSUPPORTED - The address range specified by Offset is not valid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+ \r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Call PciIo->Io.Write\r
+ //\r
+ Status = IsaIoDevice->PciIo->Io.Write (\r
+ IsaIoDevice->PciIo,\r
+ EfiPciIoWidthUint8,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Offset,\r
+ 1,\r
+ &Value\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ return Status;\r
+ }\r
+\r
+ gBS->Stall (50);\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+WriteDmaPort (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINT32 AddrOffset,\r
+ IN UINT32 PageOffset,\r
+ IN UINT32 CountOffset,\r
+ IN UINT32 BaseAddress,\r
+ IN UINT16 Count\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Writes I/O operation base address and count number to a 8 bit I/O Port.\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ AddrOffset - The address' offset.\r
+ PageOffset - The page's offest.\r
+ CountOffset - The count's offset.\r
+ BaseAddress - The base address.\r
+ Count - The number of I/O operations to perform. \r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Success.\r
+ EFI_INVALID_PARAMETER - Parameter is invalid.\r
+ EFI_UNSUPPORTED - The address range specified by these Offsets and Count is not valid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = WritePort (This, AddrOffset, (UINT8) (BaseAddress & 0xff));\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, AddrOffset, (UINT8) ((BaseAddress >> 8) & 0xff));\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, PageOffset, (UINT8) ((BaseAddress >> 16) & 0xff));\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, CountOffset, (UINT8) (Count & 0xff));\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, CountOffset, (UINT8) ((Count >> 8) & 0xff));\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoUnmap (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN VOID *Mapping\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Unmaps a memory region for DMA\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Mapping - The mapping value returned from EFI_ISA_IO.Map().\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The range was unmapped.\r
+ EFI_DEVICE_ERROR - The data was not committed to the target system memory.\r
+\r
+--*/\r
+{\r
+ ISA_MAP_INFO *IsaMapInfo;\r
+\r
+ //\r
+ // Unset Feature Flag PcdIsaBusSupportDma to disable support for ISA DMA.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportDma)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ //\r
+ // See if the Map() operation associated with this Unmap() required a mapping\r
+ // buffer.If a mapping buffer was not required, then this function simply\r
+ // returns EFI_SUCCESS.\r
+ //\r
+ if (Mapping != NULL) {\r
+ //\r
+ // Get the MAP_INFO structure from Mapping\r
+ //\r
+ IsaMapInfo = (ISA_MAP_INFO *) Mapping;\r
+\r
+ //\r
+ // If this is a write operation from the Agent's point of view,\r
+ // then copy the contents of the mapped buffer into the real buffer\r
+ // so the processor can read the contents of the real buffer.\r
+ //\r
+ if (IsaMapInfo->Operation == EfiIsaIoOperationBusMasterWrite) {\r
+ CopyMem (\r
+ (VOID *) (UINTN) IsaMapInfo->HostAddress,\r
+ (VOID *) (UINTN) IsaMapInfo->MappedHostAddress,\r
+ IsaMapInfo->NumberOfBytes\r
+ );\r
+ }\r
+ //\r
+ // Free the mapped buffer and the MAP_INFO structure.\r
+ //\r
+ gBS->FreePages (IsaMapInfo->MappedHostAddress, IsaMapInfo->NumberOfPages);\r
+ gBS->FreePool (IsaMapInfo);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoFlush (\r
+ IN EFI_ISA_IO_PROTOCOL *This\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Flushes a DMA buffer\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The buffers were flushed.\r
+ EFI_DEVICE_ERROR - The buffers were not flushed due to a hardware error.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Call PciIo->Flush\r
+ //\r
+ Status = IsaIoDevice->PciIo->Flush (IsaIoDevice->PciIo);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+IsaIoVerifyAccess (\r
+ IN ISA_IO_DEVICE *IsaIoDevice,\r
+ IN ISA_ACCESS_TYPE Type,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINTN Count,\r
+ IN OUT UINT32 *Offset\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Verifies access to an ISA device\r
+\r
+Arguments:\r
+\r
+ IsaIoDevice - The ISA device to be verified.\r
+ Type - The Access type. The input must be either IsaAccessTypeMem or IsaAccessTypeIo.\r
+ Width - Signifies the width of the memory operation.\r
+ Count - The number of memory operations to perform. \r
+ Offset - The offset in ISA memory space to start the memory operation. \r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - Verify success.\r
+ EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r
+ EFI_UNSUPPORTED - The device ont support the access type.\r
+\r
+--*/\r
+{\r
+ EFI_ISA_ACPI_RESOURCE *Item;\r
+ EFI_STATUS Status;\r
+\r
+ if (Width < EfiIsaIoWidthUint8 ||\r
+ Width >= EfiIsaIoWidthMaximum ||\r
+ Width == EfiIsaIoWidthReserved ||\r
+ Width == EfiIsaIoWidthFifoReserved ||\r
+ Width == EfiIsaIoWidthFillReserved\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ //\r
+ // If Width is EfiIsaIoWidthFifoUintX then convert to EfiIsaIoWidthUintX\r
+ // If Width is EfiIsaIoWidthFillUintX then convert to EfiIsaIoWidthUintX\r
+ //\r
+ if (Width >= EfiIsaIoWidthFifoUint8 && Width <= EfiIsaIoWidthFifoReserved) {\r
+ Count = 1;\r
+ }\r
+\r
+ Width = (EFI_ISA_IO_PROTOCOL_WIDTH) (Width & 0x03);\r
+\r
+ Status = EFI_UNSUPPORTED;\r
+ Item = IsaIoDevice->IsaIo.ResourceList->ResourceItem;\r
+ while (Item->Type != EfiIsaAcpiResourceEndOfList) {\r
+ if ((Type == IsaAccessTypeMem && Item->Type == EfiIsaAcpiResourceMemory) ||\r
+ (Type == IsaAccessTypeIo && Item->Type == EfiIsaAcpiResourceIo)\r
+ ) {\r
+ if (*Offset >= Item->StartRange && (*Offset + Count * (UINT32)(1 << Width)) - 1 <= Item->EndRange) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if (*Offset >= Item->StartRange && *Offset <= Item->EndRange) {\r
+ Status = EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+\r
+ Item++;\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMemRead (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Performs an ISA Memory Read Cycle\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Width - Signifies the width of the memory operation.\r
+ Offset - The offset in ISA memory space to start the memory operation. \r
+ Count - The number of memory operations to perform. \r
+ Buffer - The destination buffer to store the results\r
+ \r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was read from the device successfully.\r
+ EFI_UNSUPPORTED - The Offset is not valid for this device.\r
+ EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ //\r
+ // Set Feature Flag PcdIsaBusSupportBusMaster to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ //\r
+ // So we just return EFI_UNSUPPORTED for these functions.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportIsaMemory)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Verify the Isa Io Access\r
+ //\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeMem,\r
+ Width,\r
+ Count,\r
+ &Offset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call PciIo->Mem.Read\r
+ //\r
+ Status = IsaIoDevice->PciIo->Mem.Read (\r
+ IsaIoDevice->PciIo,\r
+ (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Offset,\r
+ Count,\r
+ Buffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMemWrite (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Performs an ISA Memory Write Cycle\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance. \r
+ Width - Signifies the width of the memory operation.\r
+ Offset - The offset in ISA memory space to start the memory operation. \r
+ Count - The number of memory operations to perform. \r
+ Buffer - The source buffer to write data from\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was written to the device sucessfully.\r
+ EFI_UNSUPPORTED - The Offset is not valid for this device.\r
+ EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ //\r
+ // Set Feature Flag PcdIsaBusSupportBusMaster to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ //\r
+ // So we just return EFI_UNSUPPORTED for these functions.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportIsaMemory)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Verify Isa IO Access\r
+ //\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeMem,\r
+ Width,\r
+ Count,\r
+ &Offset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call PciIo->Mem.Write\r
+ //\r
+ Status = IsaIoDevice->PciIo->Mem.Write (\r
+ IsaIoDevice->PciIo,\r
+ (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ Offset,\r
+ Count,\r
+ Buffer\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoCopyMem (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 DestOffset,\r
+ IN UINT32 SrcOffset,\r
+ IN UINTN Count\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Performs an ISA I/O Copy Memory \r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Width - Signifies the width of the memory copy operation.\r
+ DestOffset - The offset of the destination \r
+ SrcOffset - The offset of the source\r
+ Count - The number of memory copy operations to perform\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The data was copied sucessfully.\r
+ EFI_UNSUPPORTED - The DestOffset or SrcOffset is not valid for this device.\r
+ EFI_INVALID_PARAMETER - Width or Count, or both, were invalid.\r
+ EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of resources.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ ISA_IO_DEVICE *IsaIoDevice;\r
+\r
+ //\r
+ // Set Feature Flag PcdIsaBusSupportBusMaster to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ //\r
+ // So we just return EFI_UNSUPPORTED for these functions.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportIsaMemory)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ IsaIoDevice = ISA_IO_DEVICE_FROM_ISA_IO_THIS (This);\r
+\r
+ //\r
+ // Verify Isa IO Access for destination and source\r
+ //\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeMem,\r
+ Width,\r
+ Count,\r
+ &DestOffset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = IsaIoVerifyAccess (\r
+ IsaIoDevice,\r
+ IsaAccessTypeMem,\r
+ Width,\r
+ Count,\r
+ &SrcOffset\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call PciIo->CopyMem\r
+ //\r
+ Status = IsaIoDevice->PciIo->CopyMem (\r
+ IsaIoDevice->PciIo,\r
+ (EFI_PCI_IO_PROTOCOL_WIDTH) Width,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ DestOffset,\r
+ EFI_PCI_IO_PASS_THROUGH_BAR,\r
+ SrcOffset,\r
+ Count\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+STATIC\r
+EFI_STATUS\r
+IsaIoMap_OnlySupportSlaveReadWrite (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
+ IN UINT8 ChannelNumber OPTIONAL,\r
+ IN UINT32 ChannelAttributes,\r
+ IN VOID *HostAddress,\r
+ IN OUT UINTN *NumberOfBytes,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Maps a memory region for DMA, note this implementation\r
+ only supports slave read/write operation to save code size.\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Operation - Indicates the type of DMA (slave or bus master), and if \r
+ the DMA operation is going to read or write to system memory. \r
+ ChannelNumber - The slave channel number to use for this DMA operation. \r
+ If Operation and ChannelAttributes shows that this device \r
+ performs bus mastering DMA, then this field is ignored. \r
+ The legal range for this field is 0..7. \r
+ ChannelAttributes - The attributes of the DMA channel to use for this DMA operation\r
+ HostAddress - The system memory address to map to the device. \r
+ NumberOfBytes - On input the number of bytes to map. On output the number \r
+ of bytes that were mapped.\r
+ DeviceAddress - The resulting map address for the bus master device to use \r
+ to access the hosts HostAddress. \r
+ Mapping - A resulting value to pass to EFI_ISA_IO.Unmap().\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.\r
+ EFI_INVALID_PARAMETER - The Operation or HostAddress is undefined.\r
+ EFI_UNSUPPORTED - The HostAddress can not be mapped as a common buffer.\r
+ EFI_DEVICE_ERROR - The system hardware could not map the requested address.\r
+ EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
+ ISA_MAP_INFO *IsaMapInfo;\r
+ UINT8 DmaMode;\r
+ UINTN MaxNumberOfBytes;\r
+ UINT32 BaseAddress;\r
+ UINT16 Count;\r
+\r
+ UINT8 DmaMask;\r
+ UINT8 DmaClear;\r
+ UINT8 DmaChannelMode;\r
+ \r
+ if ((NULL == This) ||\r
+ (NULL == HostAddress) ||\r
+ (NULL == NumberOfBytes) ||\r
+ (NULL == DeviceAddress) ||\r
+ (NULL == Mapping)\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ //\r
+ // Initialize the return values to their defaults\r
+ //\r
+ *Mapping = NULL;\r
+\r
+ //\r
+ // Make sure the Operation parameter is valid.\r
+ // Light IsaIo only supports two operations.\r
+ //\r
+ if (!(Operation == EfiIsaIoOperationSlaveRead || \r
+ Operation == EfiIsaIoOperationSlaveWrite)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (ChannelNumber >= 4) {\r
+ //\r
+ // The Light IsaIo doesn't support channelNumber larger than 4.\r
+ //\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ //\r
+ // Map the HostAddress to a DeviceAddress.\r
+ //\r
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress;\r
+ if ((PhysicalAddress +*NumberOfBytes) > ISA_MAX_MEMORY_ADDRESS) {\r
+ //\r
+ // Common Buffer operations can not be remapped. If the common buffer\r
+ // is above 16MB, then it is not possible to generate a mapping, so return\r
+ // an error.\r
+ //\r
+ if (Operation == EfiIsaIoOperationBusMasterCommonBuffer) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Allocate an ISA_MAP_INFO structure to remember the mapping when Unmap()\r
+ // is called later.\r
+ //\r
+ IsaMapInfo = AllocatePool (sizeof (ISA_MAP_INFO));\r
+ if (IsaMapInfo == NULL) {\r
+ *NumberOfBytes = 0;\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ //\r
+ // Return a pointer to the MAP_INFO structure in Mapping\r
+ //\r
+ *Mapping = IsaMapInfo;\r
+\r
+ //\r
+ // Initialize the MAP_INFO structure\r
+ //\r
+ IsaMapInfo->Operation = Operation;\r
+ IsaMapInfo->NumberOfBytes = *NumberOfBytes;\r
+ IsaMapInfo->NumberOfPages = EFI_SIZE_TO_PAGES (*NumberOfBytes);\r
+ IsaMapInfo->HostAddress = PhysicalAddress;\r
+ IsaMapInfo->MappedHostAddress = ISA_MAX_MEMORY_ADDRESS - 1;\r
+\r
+ //\r
+ // Allocate a buffer below 16MB to map the transfer to.\r
+ //\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiBootServicesData,\r
+ IsaMapInfo->NumberOfPages,\r
+ &IsaMapInfo->MappedHostAddress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (IsaMapInfo);\r
+ *NumberOfBytes = 0;\r
+ *Mapping = NULL;\r
+ return Status;\r
+ }\r
+ //\r
+ // If this is a read operation from the DMA agents's point of view,\r
+ // then copy the contents of the real buffer into the mapped buffer\r
+ // so the DMA agent can read the contents of the real buffer.\r
+ //\r
+ if (Operation == EfiIsaIoOperationSlaveRead) {\r
+ CopyMem (\r
+ (VOID *) (UINTN) IsaMapInfo->MappedHostAddress,\r
+ (VOID *) (UINTN) IsaMapInfo->HostAddress,\r
+ IsaMapInfo->NumberOfBytes\r
+ );\r
+ }\r
+ //\r
+ // The DeviceAddress is the address of the maped buffer below 16 MB\r
+ //\r
+ *DeviceAddress = IsaMapInfo->MappedHostAddress;\r
+ } else {\r
+ //\r
+ // The transfer is below 16 MB, so the DeviceAddress is simply the\r
+ // HostAddress\r
+ //\r
+ *DeviceAddress = PhysicalAddress;\r
+ }\r
+ \r
+ //\r
+ // Figure out what to program into the DMA Channel Mode Register\r
+ //\r
+ DmaMode = (UINT8) (B_8237_DMA_CHMODE_INCREMENT | (ChannelNumber & 0x03));\r
+ if (Operation == EfiIsaIoOperationSlaveRead) {\r
+ DmaMode |= V_8237_DMA_CHMODE_MEM2IO;\r
+ } else {\r
+ DmaMode |= V_8237_DMA_CHMODE_IO2MEM;\r
+ }\r
+ //\r
+ // We only support EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE in simplified IsaIo\r
+ //\r
+ DmaMode |= V_8237_DMA_CHMODE_SINGLE;\r
+\r
+ //\r
+ // A Slave DMA transfer can not cross a 64K boundary.\r
+ // Compute *NumberOfBytes based on this restriction.\r
+ //\r
+ MaxNumberOfBytes = 0x10000 - ((UINT32) (*DeviceAddress) & 0xffff);\r
+ if (*NumberOfBytes > MaxNumberOfBytes) {\r
+ *NumberOfBytes = MaxNumberOfBytes;\r
+ }\r
+ //\r
+ // Compute the values to program into the BaseAddress and Count registers\r
+ // of the Slave DMA controller\r
+ //\r
+ BaseAddress = (UINT32) (*DeviceAddress);\r
+ Count = (UINT16) (*NumberOfBytes - 1);\r
+ //\r
+ // Program the DMA Write Single Mask Register for ChannelNumber\r
+ // Clear the DMA Byte Pointer Register\r
+ //\r
+ DmaMask = R_8237_DMA_WRSMSK_CH0_3;\r
+ DmaClear = R_8237_DMA_CBPR_CH0_3;\r
+ DmaChannelMode = R_8237_DMA_CHMODE_CH0_3;\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaMask,\r
+ (UINT8) (B_8237_DMA_WRSMSK_CMS | (ChannelNumber & 0x03))\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaClear,\r
+ (UINT8) (B_8237_DMA_WRSMSK_CMS | (ChannelNumber & 0x03))\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, DmaChannelMode, DmaMode);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WriteDmaPort (\r
+ This,\r
+ DmaRegisters[ChannelNumber].Address,\r
+ DmaRegisters[ChannelNumber].Page,\r
+ DmaRegisters[ChannelNumber].Count,\r
+ BaseAddress,\r
+ Count\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaMask,\r
+ (UINT8) (ChannelNumber & 0x03)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+STATIC\r
+EFI_STATUS\r
+IsaIoMap_FullSupport (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
+ IN UINT8 ChannelNumber OPTIONAL,\r
+ IN UINT32 ChannelAttributes,\r
+ IN VOID *HostAddress,\r
+ IN OUT UINTN *NumberOfBytes,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Maps a memory region for DMA. This implementation implement the \r
+ the full mapping support.\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Operation - Indicates the type of DMA (slave or bus master), and if \r
+ the DMA operation is going to read or write to system memory. \r
+ ChannelNumber - The slave channel number to use for this DMA operation. \r
+ If Operation and ChannelAttributes shows that this device \r
+ performs bus mastering DMA, then this field is ignored. \r
+ The legal range for this field is 0..7. \r
+ ChannelAttributes - The attributes of the DMA channel to use for this DMA operation\r
+ HostAddress - The system memory address to map to the device. \r
+ NumberOfBytes - On input the number of bytes to map. On output the number \r
+ of bytes that were mapped.\r
+ DeviceAddress - The resulting map address for the bus master device to use \r
+ - to access the hosts HostAddress. \r
+ Mapping - A resulting value to pass to EFI_ISA_IO.Unmap().\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.\r
+ EFI_INVALID_PARAMETER - The Operation or HostAddress is undefined.\r
+ EFI_UNSUPPORTED - The HostAddress can not be mapped as a common buffer.\r
+ EFI_DEVICE_ERROR - The system hardware could not map the requested address.\r
+ EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ BOOLEAN Master;\r
+ BOOLEAN Read;\r
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
+ ISA_MAP_INFO *IsaMapInfo;\r
+ UINT8 DmaMode;\r
+ UINTN MaxNumberOfBytes;\r
+ UINT32 BaseAddress;\r
+ UINT16 Count;\r
+\r
+ UINT8 DmaMask;\r
+ UINT8 DmaClear;\r
+ UINT8 DmaChannelMode;\r
+\r
+ if ((NULL == This) ||\r
+ (NULL == HostAddress) ||\r
+ (NULL == NumberOfBytes) ||\r
+ (NULL == DeviceAddress) ||\r
+ (NULL == Mapping)\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+\r
+ //\r
+ // Initialize the return values to their defaults\r
+ //\r
+ *Mapping = NULL;\r
+\r
+ //\r
+ // Make sure the Operation parameter is valid\r
+ //\r
+ if (Operation < 0 || Operation >= EfiIsaIoOperationMaximum) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // See if this is a Slave DMA Operation\r
+ //\r
+ Master = TRUE;\r
+ Read = FALSE;\r
+ if (Operation == EfiIsaIoOperationSlaveRead) {\r
+ Operation = EfiIsaIoOperationBusMasterRead;\r
+ Master = FALSE;\r
+ Read = TRUE;\r
+ }\r
+\r
+ if (Operation == EfiIsaIoOperationSlaveWrite) {\r
+ Operation = EfiIsaIoOperationBusMasterWrite;\r
+ Master = FALSE;\r
+ Read = FALSE;\r
+ }\r
+\r
+ if (!Master) {\r
+ //\r
+ // Make sure that ChannelNumber is a valid channel number\r
+ // Channel 4 is used to cascade, so it is illegal.\r
+ //\r
+ if (ChannelNumber == 4 || ChannelNumber > 7) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // This implementation only support COMPATIBLE DMA Transfers\r
+ //\r
+ if (!(ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (ChannelAttributes &\r
+ (\r
+ EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A |\r
+ EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B |\r
+ EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C\r
+ )\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (ChannelNumber < 4) {\r
+ //\r
+ // If this is Channel 0..3, then the width must be 8 bit\r
+ //\r
+ if (!(ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8) ||\r
+ (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16)\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ } else {\r
+ //\r
+ // If this is Channel 4..7, then the width must be 16 bit\r
+ //\r
+ if ((ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8) ||\r
+ (!(ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16))\r
+ ) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ //\r
+ // Either Demand Mode or Single Mode must be selected, but not both\r
+ //\r
+ if (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE) {\r
+ if (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ } else {\r
+ if (!(ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE)) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ }\r
+ //\r
+ // Map the HostAddress to a DeviceAddress.\r
+ //\r
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress;\r
+ if ((PhysicalAddress +*NumberOfBytes) > ISA_MAX_MEMORY_ADDRESS) {\r
+ //\r
+ // Common Buffer operations can not be remapped. If the common buffer\r
+ // is above 16MB, then it is not possible to generate a mapping, so return\r
+ // an error.\r
+ //\r
+ if (Operation == EfiIsaIoOperationBusMasterCommonBuffer) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Allocate an ISA_MAP_INFO structure to remember the mapping when Unmap()\r
+ // is called later.\r
+ //\r
+ IsaMapInfo = AllocatePool (sizeof (ISA_MAP_INFO));\r
+ if (IsaMapInfo == NULL) {\r
+ *NumberOfBytes = 0;\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ //\r
+ // Return a pointer to the MAP_INFO structure in Mapping\r
+ //\r
+ *Mapping = IsaMapInfo;\r
+\r
+ //\r
+ // Initialize the MAP_INFO structure\r
+ //\r
+ IsaMapInfo->Operation = Operation;\r
+ IsaMapInfo->NumberOfBytes = *NumberOfBytes;\r
+ IsaMapInfo->NumberOfPages = EFI_SIZE_TO_PAGES (*NumberOfBytes);\r
+ IsaMapInfo->HostAddress = PhysicalAddress;\r
+ IsaMapInfo->MappedHostAddress = ISA_MAX_MEMORY_ADDRESS - 1;\r
+\r
+ //\r
+ // Allocate a buffer below 16MB to map the transfer to.\r
+ //\r
+ Status = gBS->AllocatePages (\r
+ AllocateMaxAddress,\r
+ EfiBootServicesData,\r
+ IsaMapInfo->NumberOfPages,\r
+ &IsaMapInfo->MappedHostAddress\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ gBS->FreePool (IsaMapInfo);\r
+ *NumberOfBytes = 0;\r
+ *Mapping = NULL;\r
+ return Status;\r
+ }\r
+ //\r
+ // If this is a read operation from the DMA agents's point of view,\r
+ // then copy the contents of the real buffer into the mapped buffer\r
+ // so the DMA agent can read the contents of the real buffer.\r
+ //\r
+ if (Operation == EfiIsaIoOperationBusMasterRead) {\r
+ CopyMem (\r
+ (VOID *) (UINTN) IsaMapInfo->MappedHostAddress,\r
+ (VOID *) (UINTN) IsaMapInfo->HostAddress,\r
+ IsaMapInfo->NumberOfBytes\r
+ );\r
+ }\r
+ //\r
+ // The DeviceAddress is the address of the maped buffer below 16 MB\r
+ //\r
+ *DeviceAddress = IsaMapInfo->MappedHostAddress;\r
+ } else {\r
+ //\r
+ // The transfer is below 16 MB, so the DeviceAddress is simply the\r
+ // HostAddress\r
+ //\r
+ *DeviceAddress = PhysicalAddress;\r
+ }\r
+ //\r
+ // If this is a Bus Master operation then return\r
+ //\r
+ if (Master) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Figure out what to program into the DMA Channel Mode Register\r
+ //\r
+ DmaMode = (UINT8) (B_8237_DMA_CHMODE_INCREMENT | (ChannelNumber & 0x03));\r
+ if (Read) {\r
+ DmaMode |= V_8237_DMA_CHMODE_MEM2IO;\r
+ } else {\r
+ DmaMode |= V_8237_DMA_CHMODE_IO2MEM;\r
+ }\r
+\r
+ if (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE) {\r
+ DmaMode |= B_8237_DMA_CHMODE_AE;\r
+ }\r
+\r
+ if (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE) {\r
+ DmaMode |= V_8237_DMA_CHMODE_DEMAND;\r
+ }\r
+\r
+ if (ChannelAttributes & EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE) {\r
+ DmaMode |= V_8237_DMA_CHMODE_SINGLE;\r
+ }\r
+ //\r
+ // A Slave DMA transfer can not cross a 64K boundary.\r
+ // Compute *NumberOfBytes based on this restriction.\r
+ //\r
+ MaxNumberOfBytes = 0x10000 - ((UINT32) (*DeviceAddress) & 0xffff);\r
+ if (*NumberOfBytes > MaxNumberOfBytes) {\r
+ *NumberOfBytes = MaxNumberOfBytes;\r
+ }\r
+ //\r
+ // Compute the values to program into the BaseAddress and Count registers\r
+ // of the Slave DMA controller\r
+ //\r
+ if (ChannelNumber < 4) {\r
+ BaseAddress = (UINT32) (*DeviceAddress);\r
+ Count = (UINT16) (*NumberOfBytes - 1);\r
+ } else {\r
+ BaseAddress = (UINT32) (((UINT32) (*DeviceAddress) & 0xff0000) | (((UINT32) (*DeviceAddress) & 0xffff) >> 1));\r
+ Count = (UINT16) ((*NumberOfBytes - 1) >> 1);\r
+ }\r
+ //\r
+ // Program the DMA Write Single Mask Register for ChannelNumber\r
+ // Clear the DMA Byte Pointer Register\r
+ //\r
+ if (ChannelNumber < 4) {\r
+ DmaMask = R_8237_DMA_WRSMSK_CH0_3;\r
+ DmaClear = R_8237_DMA_CBPR_CH0_3;\r
+ DmaChannelMode = R_8237_DMA_CHMODE_CH0_3;\r
+ } else {\r
+ DmaMask = R_8237_DMA_WRSMSK_CH4_7;\r
+ DmaClear = R_8237_DMA_CBPR_CH4_7;\r
+ DmaChannelMode = R_8237_DMA_CHMODE_CH4_7;\r
+ }\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaMask,\r
+ (UINT8) (B_8237_DMA_WRSMSK_CMS | (ChannelNumber & 0x03))\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaClear,\r
+ (UINT8) (B_8237_DMA_WRSMSK_CMS | (ChannelNumber & 0x03))\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (This, DmaChannelMode, DmaMode);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WriteDmaPort (\r
+ This,\r
+ DmaRegisters[ChannelNumber].Address,\r
+ DmaRegisters[ChannelNumber].Page,\r
+ DmaRegisters[ChannelNumber].Count,\r
+ BaseAddress,\r
+ Count\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ Status = WritePort (\r
+ This,\r
+ DmaMask,\r
+ (UINT8) (ChannelNumber & 0x03)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoMap (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
+ IN UINT8 ChannelNumber OPTIONAL,\r
+ IN UINT32 ChannelAttributes,\r
+ IN VOID *HostAddress,\r
+ IN OUT UINTN *NumberOfBytes,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Maps a memory region for DMA\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Operation - Indicates the type of DMA (slave or bus master), and if \r
+ the DMA operation is going to read or write to system memory. \r
+ ChannelNumber - The slave channel number to use for this DMA operation. \r
+ If Operation and ChannelAttributes shows that this device \r
+ performs bus mastering DMA, then this field is ignored. \r
+ The legal range for this field is 0..7. \r
+ ChannelAttributes - The attributes of the DMA channel to use for this DMA operation\r
+ HostAddress - The system memory address to map to the device. \r
+ NumberOfBytes - On input the number of bytes to map. On output the number \r
+ of bytes that were mapped.\r
+ DeviceAddress - The resulting map address for the bus master device to use \r
+ - to access the hosts HostAddress. \r
+ Mapping - A resulting value to pass to EFI_ISA_IO.Unmap().\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The range was mapped for the returned NumberOfBytes.\r
+ EFI_INVALID_PARAMETER - The Operation or HostAddress is undefined.\r
+ EFI_UNSUPPORTED - The HostAddress can not be mapped as a common buffer.\r
+ EFI_DEVICE_ERROR - The system hardware could not map the requested address.\r
+ EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.\r
+\r
+--*/\r
+{\r
+ //\r
+ // Or unset Feature Flag PcdIsaBusSupportDma to disable support for ISA DMA.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportDma)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Set Feature Flag PcdIsaBusSupportBusMaster to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ //\r
+ // So we just return EFI_UNSUPPORTED for these functions.\r
+ //\r
+ if (FeaturePcdGet (PcdIsaBusOnlySupportSlaveDma)) {\r
+ return IsaIoMap_OnlySupportSlaveReadWrite (\r
+ This,\r
+ Operation,\r
+ ChannelNumber,\r
+ ChannelAttributes,\r
+ HostAddress,\r
+ NumberOfBytes,\r
+ DeviceAddress,\r
+ Mapping\r
+ );\r
+\r
+ } else {\r
+ return IsaIoMap_FullSupport (\r
+ This,\r
+ Operation,\r
+ ChannelNumber,\r
+ ChannelAttributes,\r
+ HostAddress,\r
+ NumberOfBytes,\r
+ DeviceAddress,\r
+ Mapping\r
+ );\r
+ }\r
+}\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoAllocateBuffer (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ OUT VOID **HostAddress,\r
+ IN UINT64 Attributes\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Allocates a common buffer for DMA\r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Type - The type allocation to perform.\r
+ MemoryType - The type of memory to allocate.\r
+ Pages - The number of pages to allocate.\r
+ HostAddress - A pointer to store the base address of the allocated range.\r
+ Attributes - The requested bit mask of attributes for the allocated range.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The requested memory pages were allocated.\r
+ EFI_INVALID_PARAMETER - Type is invalid or MemoryType is invalid or HostAddress is NULL\r
+ EFI_UNSUPPORTED - Attributes is unsupported or the memory range specified \r
+ by HostAddress, Pages, and Type is not available for common buffer use.\r
+ EFI_OUT_OF_RESOURCES - The memory pages could not be allocated.\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
+\r
+ //\r
+ // Set Feature Flag PcdIsaBusOnlySupportSlaveDma to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ // Or unset Feature Flag PcdIsaBusSupportDma to disable support for ISA DMA.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportDma) || FeaturePcdGet (PcdIsaBusOnlySupportSlaveDma)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ if (HostAddress == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Type < AllocateAnyPages || Type >= MaxAllocateType) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // The only valid memory types are EfiBootServicesData and EfiRuntimeServicesData\r
+ //\r
+ if (MemoryType != EfiBootServicesData && MemoryType != EfiRuntimeServicesData) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Attributes &~(EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE | EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) (ISA_MAX_MEMORY_ADDRESS - 1);\r
+ if (Type == AllocateAddress) {\r
+ if ((UINTN) (*HostAddress) >= ISA_MAX_MEMORY_ADDRESS) {\r
+ return EFI_UNSUPPORTED;\r
+ } else {\r
+ PhysicalAddress = (UINTN) (*HostAddress);\r
+ }\r
+ }\r
+\r
+ if (Type == AllocateAnyPages) {\r
+ Type = AllocateMaxAddress;\r
+ }\r
+\r
+ Status = gBS->AllocatePages (Type, MemoryType, Pages, &PhysicalAddress);\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ return Status;\r
+ }\r
+\r
+ *HostAddress = (VOID *) (UINTN) PhysicalAddress;\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+IsaIoFreeBuffer (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINTN Pages,\r
+ IN VOID *HostAddress\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Frees a common buffer \r
+\r
+Arguments:\r
+\r
+ This - A pointer to the EFI_ISA_IO_PROTOCOL instance.\r
+ Pages - The number of pages to free.\r
+ HostAddress - The base address of the allocated range.\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The requested memory pages were freed.\r
+ EFI_INVALID_PARAMETER - The memory was not allocated with EFI_ISA_IO.AllocateBufer().\r
+\r
+--*/\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PHYSICAL_ADDRESS PhysicalAddress;\r
+\r
+ //\r
+ // Set Feature Flag PcdIsaBusOnlySupportSlaveDma to FALSE to disable support for \r
+ // ISA Bus Master.\r
+ // Or unset Feature Flag PcdIsaBusSupportDma to disable support for ISA DMA.\r
+ //\r
+ if (!FeaturePcdGet (PcdIsaBusSupportDma) || FeaturePcdGet (PcdIsaBusOnlySupportSlaveDma)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ PhysicalAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) HostAddress;\r
+ Status = gBS->FreePages (\r
+ PhysicalAddress,\r
+ Pages\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ReportErrorStatusCode (EFI_IO_BUS_LPC | EFI_IOB_EC_CONTROLLER_ERROR);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ Include file for PC-AT compatability.\r
+\r
+Copyright (c) 2006, Intel Corporation. All rights reserved. \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+**/\r
+\r
+#ifndef _PC_AT_H_\r
+#define _PC_AT_H_\r
+\r
+//\r
+// 8254 Timer\r
+//\r
+#define TIMER0_COUNT_PORT 0x40\r
+#define TIMER1_COUNT_PORT 0x41\r
+#define TIMER2_COUNT_PORT 0x42\r
+#define TIMER_CONTROL_PORT 0x43\r
+\r
+//\r
+// 8259 PIC interrupt controller\r
+//\r
+\r
+#define PIC_CONTROL_REGISTER_MASTER 0x20\r
+#define PIC_MASK_REGISTER_MASTER 0x21\r
+#define PIC_CONTROL_REGISTER_SLAVE 0xA0\r
+#define PIC_MASK_REGISTER_SLAVE 0xA1\r
+#define PIC_EDGE_LEVEL_TRIGGERED_REGISTER_MASTER 0x4D0\r
+#define PIC_EDGE_LEVEL_TRIGGERED_REGISTER_SLAVE 0x4D1\r
+\r
+#define PIC_EOI 0x20\r
+\r
+//\r
+// 8237 DMA registers\r
+//\r
+#define R_8237_DMA_BASE_CA_CH0 0x00\r
+#define R_8237_DMA_BASE_CA_CH1 0x02\r
+#define R_8237_DMA_BASE_CA_CH2 0x04\r
+#define R_8237_DMA_BASE_CA_CH3 0xd6\r
+#define R_8237_DMA_BASE_CA_CH5 0xc4\r
+#define R_8237_DMA_BASE_CA_CH6 0xc8\r
+#define R_8237_DMA_BASE_CA_CH7 0xcc\r
+\r
+#define R_8237_DMA_BASE_CC_CH0 0x01\r
+#define R_8237_DMA_BASE_CC_CH1 0x03\r
+#define R_8237_DMA_BASE_CC_CH2 0x05\r
+#define R_8237_DMA_BASE_CC_CH3 0xd7\r
+#define R_8237_DMA_BASE_CC_CH5 0xc6\r
+#define R_8237_DMA_BASE_CC_CH6 0xca\r
+#define R_8237_DMA_BASE_CC_CH7 0xce\r
+\r
+#define R_8237_DMA_MEM_LP_CH0 0x87\r
+#define R_8237_DMA_MEM_LP_CH1 0x83\r
+#define R_8237_DMA_MEM_LP_CH2 0x81\r
+#define R_8237_DMA_MEM_LP_CH3 0x82\r
+#define R_8237_DMA_MEM_LP_CH5 0x8B\r
+#define R_8237_DMA_MEM_LP_CH6 0x89\r
+#define R_8237_DMA_MEM_LP_CH7 0x8A\r
+\r
+\r
+#define R_8237_DMA_COMMAND_CH0_3 0x08\r
+#define R_8237_DMA_COMMAND_CH4_7 0xd0\r
+#define B_8237_DMA_COMMAND_GAP 0x10\r
+#define B_8237_DMA_COMMAND_CGE 0x04\r
+\r
+\r
+#define R_8237_DMA_STA_CH0_3 0xd8\r
+#define R_8237_DMA_STA_CH4_7 0xd0\r
+\r
+#define R_8237_DMA_WRSMSK_CH0_3 0x0a\r
+#define R_8237_DMA_WRSMSK_CH4_7 0xd4\r
+#define B_8237_DMA_WRSMSK_CMS 0x04\r
+\r
+\r
+#define R_8237_DMA_CHMODE_CH0_3 0x0b\r
+#define R_8237_DMA_CHMODE_CH4_7 0xd6\r
+#define V_8237_DMA_CHMODE_DEMAND 0x00\r
+#define V_8237_DMA_CHMODE_SINGLE 0x40\r
+#define V_8237_DMA_CHMODE_CASCADE 0xc0\r
+#define B_8237_DMA_CHMODE_DECREMENT 0x20\r
+#define B_8237_DMA_CHMODE_INCREMENT 0x00\r
+#define B_8237_DMA_CHMODE_AE 0x10\r
+#define V_8237_DMA_CHMODE_VERIFY 0\r
+#define V_8237_DMA_CHMODE_IO2MEM 0x04\r
+#define V_8237_DMA_CHMODE_MEM2IO 0x08\r
+\r
+#define R_8237_DMA_CBPR_CH0_3 0x0c\r
+#define R_8237_DMA_CBPR_CH4_7 0xd8\r
+\r
+#define R_8237_DMA_MCR_CH0_3 0x0d\r
+#define R_8237_DMA_MCR_CH4_7 0xda\r
+\r
+#define R_8237_DMA_CLMSK_CH0_3 0x0e\r
+#define R_8237_DMA_CLMSK_CH4_7 0xdc\r
+\r
+#define R_8237_DMA_WRMSK_CH0_3 0x0f\r
+#define R_8237_DMA_WRMSK_CH4_7 0xde\r
+\r
+#endif\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006 - 2007, Intel Corporation \r
+All rights reserved. This program and the accompanying materials \r
+are licensed and made available under the terms and conditions of the BSD License \r
+which accompanies this distribution. The full text of the license may be found at \r
+http://opensource.org/licenses/bsd-license.php \r
+ \r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+Module Name:\r
+\r
+ IsaIo.h\r
+ \r
+Abstract:\r
+\r
+ EFI ISA I/O Protocol\r
+\r
+Revision History\r
+\r
+--*/\r
+\r
+#ifndef _EFI_ISA_IO_H\r
+#define _EFI_ISA_IO_H\r
+\r
+\r
+#include <Protocol/IsaAcpi.h>\r
+\r
+//\r
+// Global ID for the ISA I/O Protocol\r
+//\r
+\r
+#define EFI_ISA_IO_PROTOCOL_GUID \\r
+ { 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } }\r
+\r
+typedef struct _EFI_ISA_IO_PROTOCOL EFI_ISA_IO_PROTOCOL;\r
+\r
+//\r
+// Prototypes for the ISA I/O Protocol\r
+//\r
+\r
+typedef enum {\r
+ EfiIsaIoWidthUint8,\r
+ EfiIsaIoWidthUint16,\r
+ EfiIsaIoWidthUint32,\r
+ EfiIsaIoWidthReserved,\r
+ EfiIsaIoWidthFifoUint8,\r
+ EfiIsaIoWidthFifoUint16,\r
+ EfiIsaIoWidthFifoUint32,\r
+ EfiIsaIoWidthFifoReserved,\r
+ EfiIsaIoWidthFillUint8,\r
+ EfiIsaIoWidthFillUint16,\r
+ EfiIsaIoWidthFillUint32,\r
+ EfiIsaIoWidthFillReserved,\r
+ EfiIsaIoWidthMaximum\r
+} EFI_ISA_IO_PROTOCOL_WIDTH;\r
+\r
+//\r
+// Attributes for common buffer allocations\r
+//\r
+#define EFI_ISA_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x080 // Map a memory range so write are combined\r
+#define EFI_ISA_IO_ATTRIBUTE_MEMORY_CACHED 0x800 // Map a memory range so all r/w accesses are cached\r
+#define EFI_ISA_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 // Disable a memory range \r
+\r
+//\r
+// Channel attribute for DMA operations\r
+//\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_COMPATIBLE 0x001\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_A 0x002\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_B 0x004\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SPEED_C 0x008\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_8 0x010\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_WIDTH_16 0x020\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_SINGLE_MODE 0x040\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_DEMAND_MODE 0x080\r
+#define EFI_ISA_IO_SLAVE_DMA_ATTRIBUTE_AUTO_INITIALIZE 0x100\r
+\r
+typedef enum {\r
+ EfiIsaIoOperationBusMasterRead,\r
+ EfiIsaIoOperationBusMasterWrite,\r
+ EfiIsaIoOperationBusMasterCommonBuffer,\r
+ EfiIsaIoOperationSlaveRead,\r
+ EfiIsaIoOperationSlaveWrite,\r
+ EfiIsaIoOperationMaximum\r
+} EFI_ISA_IO_PROTOCOL_OPERATION;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_IO_MEM) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 Offset,\r
+ IN UINTN Count,\r
+ IN OUT VOID *Buffer\r
+ );\r
+\r
+typedef struct {\r
+ EFI_ISA_IO_PROTOCOL_IO_MEM Read;\r
+ EFI_ISA_IO_PROTOCOL_IO_MEM Write;\r
+} EFI_ISA_IO_PROTOCOL_ACCESS;\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_COPY_MEM) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT32 DestOffset,\r
+ IN UINT32 SrcOffset,\r
+ IN UINTN Count\r
+ );\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_MAP) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ISA_IO_PROTOCOL_OPERATION Operation,\r
+ IN UINT8 ChannelNumber OPTIONAL,\r
+ IN UINT32 ChannelAttributes,\r
+ IN VOID *HostAddress,\r
+ IN OUT UINTN *NumberOfBytes,\r
+ OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
+ OUT VOID **Mapping\r
+ );\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_UNMAP) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN VOID *Mapping\r
+ );\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN EFI_ALLOCATE_TYPE Type,\r
+ IN EFI_MEMORY_TYPE MemoryType,\r
+ IN UINTN Pages,\r
+ OUT VOID **HostAddress,\r
+ IN UINT64 Attributes\r
+ );\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_FREE_BUFFER) (\r
+ IN EFI_ISA_IO_PROTOCOL *This,\r
+ IN UINTN Pages,\r
+ IN VOID *HostAddress\r
+ );\r
+\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EFI_ISA_IO_PROTOCOL_FLUSH) (\r
+ IN EFI_ISA_IO_PROTOCOL *This\r
+ );\r
+\r
+//\r
+// Interface structure for the ISA I/O Protocol\r
+//\r
+struct _EFI_ISA_IO_PROTOCOL {\r
+ EFI_ISA_IO_PROTOCOL_ACCESS Mem;\r
+ EFI_ISA_IO_PROTOCOL_ACCESS Io;\r
+ EFI_ISA_IO_PROTOCOL_COPY_MEM CopyMem;\r
+ EFI_ISA_IO_PROTOCOL_MAP Map;\r
+ EFI_ISA_IO_PROTOCOL_UNMAP Unmap;\r
+ EFI_ISA_IO_PROTOCOL_ALLOCATE_BUFFER AllocateBuffer;\r
+ EFI_ISA_IO_PROTOCOL_FREE_BUFFER FreeBuffer;\r
+ EFI_ISA_IO_PROTOCOL_FLUSH Flush;\r
+ EFI_ISA_ACPI_RESOURCE_LIST *ResourceList;\r
+ UINT32 RomSize;\r
+ VOID *RomImage;\r
+};\r
+\r
+extern EFI_GUID gEfiIsaIoProtocolGuid;\r
+\r
+#endif\r
gMemoryStatusCodeRecordGuid = { 0x060CC026, 0x4C0D, 0x4DDA, { 0x8F, 0x41, 0x59, 0x5F, 0xEF, 0x00, 0xA5, 0x02 }}\r
\r
\r
-\r
-\r
################################################################################\r
#\r
# Global Protocols Definition section - list of Global Protocols C Name Data\r
gEfiVgaMiniPortProtocolGuid = { 0xc7735a2f, 0x88f5, 0x4882, { 0xae, 0x63, 0xfa, 0xac, 0x8c, 0x8b, 0x86, 0xb3 }}\r
gEfiPciHotPlugInitProtocolGuid = { 0xAA0E8BC1, 0xDABC, 0x46B0, { 0xA8, 0x44, 0x37, 0xB8, 0x16, 0x9B, 0x2B, 0xEA }}\r
gEfiPciHotPlugRequestProtocolGuid = { 0x19CB87AB, 0x2CB9, 0x4665, { 0x83, 0x60, 0xDD, 0xCF, 0x60, 0x54, 0xF7, 0x9D }}\r
-\r
-\r
+ gEfiIsaIoProtocolGuid = { 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d }}\r
\r
\r
################################################################################\r
PcdPciIsaEnable|0x00010039|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|FALSE\r
PcdPciVgaEnable|0x0001003a|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|FALSE\r
PcdPciBusHotplugDeviceSupport|0x0001003d|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|TRUE\r
+ PcdIsaBusSupportDma|0x00010040|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|TRUE\r
+ PcdIsaBusOnlySupportSlaveDma|0x00010041|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|FALSE\r
+ PcdIsaBusSupportIsaMemory|0x00010042|gEfiIntelFrameworkModulePkgTokenSpaceGuid|BOOLEAN|TRUE\r
\r
[PcdsFixedAtBuild.common]\r
PcdStatusCodeMemorySize|0x00010025|gEfiIntelFrameworkModulePkgTokenSpaceGuid|UINT16|1\r
DxeServicesTableLib|${WORKSPACE}/MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf\r
FvbServiceLib|${WORKSPACE}/MdeModulePkg/Library/EdkFvbServiceLib/EdkFvbServiceLib.inf\r
ReportStatusCodeLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeReportStatusCodeLibFramework/DxeReportStatusCodeLib.inf\r
+ BootScriptLib|${WORKSPACE}/IntelFrameworkPkg/Library/DxeBootScriptLibNull/DxeBootScriptLibNull.inf\r
HiiLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/HiiLibFramework/HiiLib.inf\r
IfrSupportLibFramework|$(WORKSPACE)/IntelFrameworkPkg/Library/IfrSupportLibFramework/IfrSupportLib.inf\r
PciIncompatibleDeviceSupportLib|${WORKSPACE}/IntelFrameworkModulePkg/Library/PciIncompatibleDeviceSupportLib/PciIncompatibleDeviceSupportLib.inf\r
PcdPciIsaEnable|gEfiIntelFrameworkModulePkgTokenSpaceGuid|FALSE\r
PcdPciVgaEnable|gEfiIntelFrameworkModulePkgTokenSpaceGuid|FALSE\r
PcdPciBusHotplugDeviceSupport|gEfiIntelFrameworkModulePkgTokenSpaceGuid|TRUE\r
+ PcdIsaBusSupportDma|gEfiIntelFrameworkModulePkgTokenSpaceGuid|TRUE\r
+ PcdIsaBusOnlySupportSlaveDma|gEfiIntelFrameworkModulePkgTokenSpaceGuid|FALSE\r
+ PcdIsaBusSupportIsaMemory|gEfiIntelFrameworkModulePkgTokenSpaceGuid|TRUE\r
\r
[PcdsFixedAtBuild.common]\r
PcdMaximumUnicodeStringLength|gEfiMdePkgTokenSpaceGuid|1000000\r
$(WORKSPACE)/IntelFrameworkModulePkg/Library\GraphicsLib\GraphicsLib.inf\r
$(WORKSPACE)/IntelFrameworkModulePkg/Bus\Pci\PciBus\Dxe\PciBus.inf\r
$(WORKSPACE)/IntelFrameworkModulePkg/Bus\Pci\IdeBus\Dxe\IdeBus.inf\r
+ $(WORKSPACE)\IntelFrameworkModulePkg\Bus\Isa\IsaBusDxe\IsaBus.inf\r
$(WORKSPACE)/IntelFrameworkModulePkg/Universal/DataHub/DataHub/Dxe/DataHub.inf\r
$(WORKSPACE)/IntelFrameworkModulePkg/Universal/DataHub/DataHubStdErr/Dxe/DataHubStdErr.inf\r
$(WORKSPACE)/IntelFrameworkModulePkg/Universal/StatusCode/Dxe/DxeStatusCode.inf\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation. All rights reserved. \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+Module Name:\r
+ \r
+ EfiScriptLib.h\r
+\r
+Abstract:\r
+\r
+ \r
+--*/\r
+\r
+#ifndef _BOOT_SCRIPT_LIB_H_\r
+#define _BOOT_SCRIPT_LIB_H_\r
+\r
+#include <PiPei.h>\r
+#include <Ppi/BootScriptExecuter.h>\r
+\r
+#include <IndustryStandard/SmBus.h>\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveIoWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script with opcode EFI_BOOT_SCRIPT_IO_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the I/O operations.\r
+ \r
+ Address - The base address of the I/O operations.\r
+ \r
+ Count - The number of I/O operations to perform.\r
+ \r
+ Buffer - The source buffer from which to write data. \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveIoReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O modify to boot script with opcode EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the I/O operations.\r
+ \r
+ Address - The base address of the I/O operations.\r
+ \r
+ Data - A pointer to the data to be OR-ed.\r
+ \r
+ DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveMemWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save memory write to boot script with opcode EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the memory operations.\r
+ \r
+ Address - The base address of the memory operations.\r
+ \r
+ Count - The number of memory operations to perform.\r
+ \r
+ Buffer - The source buffer from which to write the data. \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveMemReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save memory modify to boot script with opcode EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the memory operations.\r
+ \r
+ Address - The base address of the memory operations.\r
+ \r
+ Data - A pointer to the data to be OR-ed.\r
+ \r
+ DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSavePciCfgWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save PCI configuration space write operation to boot script with opcode \r
+ EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the PCI operations\r
+ \r
+ Address - The address within the PCI configuration space.\r
+ \r
+ Count - The number of PCI operations to perform.\r
+ \r
+ Buffer - The source buffer from which to write the data.\r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSavePciCfgReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save PCI configuration space modify operation to boot script with opcode \r
+ EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ Width - The width of the PCI operations\r
+ \r
+ Address - The address within the PCI configuration space.\r
+ \r
+ Data - A pointer to the data to be OR-ed.\r
+ \r
+ DataMask - A pointer to the data mask to be AND-ed with the data read from the register.\r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveSmbusExecute (\r
+ IN UINT16 TableName,\r
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
+ IN EFI_SMBUS_DEVICE_COMMAND Command,\r
+ IN EFI_SMBUS_OPERATION Operation,\r
+ IN BOOLEAN PecCheck,\r
+ IN UINTN *Length,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save SMBus command execution to boot script with opcode \r
+ EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+ SlaveAddress - The SMBus address for the slave device that the operation is targeting.\r
+ Command - The command that is transmitted by the SMBus host controller to the \r
+ SMBus slave device.\r
+ Operation - Indicates which particular SMBus protocol it will use to execute the \r
+ SMBus transactions.\r
+ PecCheck - Defines if Packet Error Code (PEC) checking is required for this operation.\r
+ Length - A pointer to signify the number of bytes that this operation will do.\r
+ Buffer - Contains the value of data to execute to the SMBUS slave device.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveStall (\r
+ IN UINT16 TableName,\r
+ IN UINTN Duration\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save execution stall on the processor to boot script with opcode \r
+ EFI_BOOT_SCRIPT_STALL_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+ \r
+ Duration - Duration in microseconds of the stall.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch (\r
+ IN UINT16 TableName,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save dispatching specified arbitrary code to boot script with opcode \r
+ EFI_BOOT_SCRIPT_DISPATCH_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+ \r
+ EntryPoint - Entry point of the code to be dispatched.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch2 (\r
+ IN UINT16 TableName,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint,\r
+ IN EFI_PHYSICAL_ADDRESS Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save dispatching specified arbitrary code to boot script with opcode \r
+ EFI_BOOT_SCRIPT_DISPATCH_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+ \r
+ EntryPoint - Entry point of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch2Image (\r
+ IN UINT16 TableName,\r
+ IN EFI_GUID *FfsName,\r
+ IN EFI_PHYSICAL_ADDRESS Context,\r
+ IN EFI_HANDLE ParentHandle\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save dispatching specified arbitrary code to boot script with opcode \r
+ EFI_BOOT_SCRIPT_DISPATCH_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformation (\r
+ IN UINT16 TableName,\r
+ IN UINT32 Length, \r
+ IN EFI_PHYSICAL_ADDRESS Buffer\r
+ )\r
+ /*++\r
+\r
+Routine Description:\r
+\r
+ Save information specified by Buffer, length is specified by Length, to \r
+ boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformationUnicodeString (\r
+ IN UINT16 TableName,\r
+ IN CONST CHAR16 *String\r
+ )\r
+ /*++\r
+\r
+Routine Description:\r
+\r
+ Save unicode string information specified by Buffer to \r
+ boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformationAsciiString (\r
+ IN UINT16 TableName,\r
+ IN CONST CHAR8 *String\r
+ )\r
+ /*++\r
+\r
+Routine Description:\r
+\r
+ Save ASCII string information specified by Buffer to \r
+ boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInitialize (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Intialize Boot Script Lib if it has not yet been initialized. \r
+\r
+Arguments:\r
+\r
+ ImageHandle - The firmware allocated handle for the EFI image.\r
+ \r
+ SystemTable - A pointer to the EFI System Table.\r
+\r
+Returns: \r
+\r
+ EFI_STATUS always returns EFI_SUCCESS\r
+\r
+--*/\r
+; \r
+#endif\r
+\r
+\r
#ifndef _PEI_BOOT_SCRIPT_EXECUTER_PPI_H\r
#define _PEI_BOOT_SCRIPT_EXECUTER_PPI_H\r
\r
-#include <PiPei.h>\r
+#define EFI_ACPI_S3_RESUME_SCRIPT_TABLE 0x00\r
+\r
+//\r
+// Boot Script Opcode Definitions\r
+//\r
+\r
+#define EFI_BOOT_SCRIPT_IO_WRITE_OPCODE 0x00\r
+#define EFI_BOOT_SCRIPT_IO_READ_WRITE_OPCODE 0x01\r
+#define EFI_BOOT_SCRIPT_MEM_WRITE_OPCODE 0x02\r
+#define EFI_BOOT_SCRIPT_MEM_READ_WRITE_OPCODE 0x03\r
+#define EFI_BOOT_SCRIPT_PCI_CONFIG_WRITE_OPCODE 0x04\r
+#define EFI_BOOT_SCRIPT_PCI_CONFIG_READ_WRITE_OPCODE 0x05\r
+#define EFI_BOOT_SCRIPT_SMBUS_EXECUTE_OPCODE 0x06\r
+#define EFI_BOOT_SCRIPT_STALL_OPCODE 0x07\r
+#define EFI_BOOT_SCRIPT_DISPATCH_OPCODE 0x08\r
+\r
+//\r
+// Extensions to boot script definitions\r
+//\r
+#define EFI_BOOT_SCRIPT_MEM_POLL_OPCODE 0x09\r
+#define EFI_BOOT_SCRIPT_INFORMATION_OPCODE 0x0A\r
+#define EFI_BOOT_SCRIPT_PCI_CONFIG2_WRITE_OPCODE 0x0B\r
+#define EFI_BOOT_SCRIPT_PCI_CONFIG2_READ_WRITE_OPCODE 0x0C\r
+#define EFI_BOOT_SCRIPT_DISPATCH_2_OPCODE 0x0D\r
+#define EFI_BOOT_SCRIPT_TABLE_OPCODE 0xAA\r
+#define EFI_BOOT_SCRIPT_TERMINATE_OPCODE 0xFF\r
+\r
+//\r
+// EFI Boot Script Width\r
+//\r
+typedef enum {\r
+ EfiBootScriptWidthUint8,\r
+ EfiBootScriptWidthUint16,\r
+ EfiBootScriptWidthUint32,\r
+ EfiBootScriptWidthUint64,\r
+ EfiBootScriptWidthFifoUint8,\r
+ EfiBootScriptWidthFifoUint16,\r
+ EfiBootScriptWidthFifoUint32,\r
+ EfiBootScriptWidthFifoUint64,\r
+ EfiBootScriptWidthFillUint8,\r
+ EfiBootScriptWidthFillUint16,\r
+ EfiBootScriptWidthFillUint32,\r
+ EfiBootScriptWidthFillUint64,\r
+ EfiBootScriptWidthMaximum\r
+} EFI_BOOT_SCRIPT_WIDTH;\r
\r
#define EFI_PEI_BOOT_SCRIPT_EXECUTER_PPI_GUID \\r
{ \\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2007, Intel Corporation. All rights reserved. <BR> \r
+This software and associated documentation (if any) is furnished\r
+under a license and may only be used or copied in accordance\r
+with the terms of the license. Except as permitted by such\r
+license, no part of this software or documentation may be\r
+reproduced, stored in a retrieval system, or transmitted in any\r
+form or by any means without the express written consent of\r
+Intel Corporation.\r
+\r
+\r
+\r
+Module Name:\r
+ \r
+ BootScriptLib.c\r
+\r
+Abstract:\r
+\r
+ Support for EFI script. \r
+\r
+--*/\r
+\r
+//\r
+// The package level header files this module uses\r
+//\r
+#include <PiDxe.h>\r
+//\r
+// The protocols, PPI and GUID defintions for this module\r
+//\r
+//\r
+// The Library classes this module consumes\r
+//\r
+#include <Library/BootScriptLib.h>\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveIoWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI IO write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Count - add argument and description to function comment\r
+// GC_TODO: Buffer - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveIoReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI IO read write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Data - add argument and description to function comment\r
+// GC_TODO: DataMask - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveMemWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI MEM write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Count - add argument and description to function comment\r
+// GC_TODO: Buffer - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveMemReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI MEM read write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Data - add argument and description to function comment\r
+// GC_TODO: DataMask - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSavePciCfgWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Count,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI PCI write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Count - add argument and description to function comment\r
+// GC_TODO: Buffer - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSavePciCfgReadWrite (\r
+ IN UINT16 TableName,\r
+ IN EFI_BOOT_SCRIPT_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN VOID *Data,\r
+ IN VOID *DataMask\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI PCI read write script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Width - add argument and description to function comment\r
+// GC_TODO: Address - add argument and description to function comment\r
+// GC_TODO: Data - add argument and description to function comment\r
+// GC_TODO: DataMask - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveSmbusExecute (\r
+ IN UINT16 TableName,\r
+ IN EFI_SMBUS_DEVICE_ADDRESS SlaveAddress,\r
+ IN EFI_SMBUS_DEVICE_COMMAND Command,\r
+ IN EFI_SMBUS_OPERATION Operation,\r
+ IN BOOLEAN PecCheck,\r
+ IN UINTN *Length,\r
+ IN VOID *Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI Smbus execute script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: SlaveAddress - add argument and description to function comment\r
+// GC_TODO: Command - add argument and description to function comment\r
+// GC_TODO: Operation - add argument and description to function comment\r
+// GC_TODO: PecCheck - add argument and description to function comment\r
+// GC_TODO: Length - add argument and description to function comment\r
+// GC_TODO: Buffer - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveStall (\r
+ IN UINT16 TableName,\r
+ IN UINTN Duration\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save I/O write to boot script \r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ (Standard EFI stall script parameter) \r
+\r
+Returns: \r
+ \r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+// GC_TODO: Duration - add argument and description to function comment\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch2 (\r
+ IN UINT16 TableName,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint,\r
+ IN EFI_PHYSICAL_ADDRESS Context\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ TableName - GC_TODO: add argument description\r
+ EntryPoint - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - GC_TODO: Add description for return value\r
+ EFI_SUCCESS - GC_TODO: Add description for return value\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformation (\r
+ IN UINT16 TableName,\r
+ IN UINT32 Length, \r
+ IN EFI_PHYSICAL_ADDRESS Buffer\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ TableName - GC_TODO: add argument description\r
+ EntryPoint - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - GC_TODO: Add description for return value\r
+ EFI_SUCCESS - GC_TODO: Add description for return value\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformationUnicodeString (\r
+ IN UINT16 TableName,\r
+ IN CONST CHAR16 *String\r
+ )\r
+ /*++\r
+\r
+Routine Description:\r
+\r
+ Save unicode string information specified by Buffer to \r
+ boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveInformationAsciiString (\r
+ IN UINT16 TableName,\r
+ IN CONST CHAR8 *String\r
+ )\r
+ /*++\r
+\r
+Routine Description:\r
+\r
+ Save ASCII string information specified by Buffer to \r
+ boot script with opcode EFI_BOOT_SCRIPT_INFORMATION_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch (\r
+ IN UINT16 TableName,\r
+ IN EFI_PHYSICAL_ADDRESS EntryPoint\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ GC_TODO: Add function description\r
+\r
+Arguments:\r
+\r
+ TableName - GC_TODO: add argument description\r
+ EntryPoint - GC_TODO: add argument description\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - GC_TODO: Add description for return value\r
+ EFI_SUCCESS - GC_TODO: Add description for return value\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+BootScriptSaveDispatch2Image (\r
+ IN UINT16 TableName,\r
+ IN EFI_GUID *FfsName,\r
+ IN EFI_PHYSICAL_ADDRESS Context,\r
+ IN EFI_HANDLE ParentHandle\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Save dispatching specified arbitrary code to boot script with opcode \r
+ EFI_BOOT_SCRIPT_DISPATCH_OPCODE\r
+\r
+Arguments:\r
+\r
+ TableName - Desired boot script table\r
+\r
+ FfsName - The file name of the code to be dispatched.\r
+\r
+ Context - The data that will be passed into code.\r
+\r
+ ParentHandle - The caller's image handle.\r
+\r
+Returns:\r
+\r
+ EFI_NOT_FOUND - BootScriptSave Protocol not exist.\r
+ \r
+ EFI_STATUS - BootScriptSave Protocol exist, always returns EFI_SUCCESS\r
+\r
+--*/\r
+{\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+#/** @file\r
+# BootScriptLib instance that always produces NOP operation.\r
+#\r
+# This library is primarily used by platform that does not support ACPI S3 resume.\r
+# All the library interfaces simply return EFI_SUCCESS without performing any operation.\r
+# Copyright (c) 2007, Intel Corporation.\r
+#\r
+# All rights reserved.\r
+# This software and associated documentation (if any) is furnished\r
+# under a license and may only be used or copied in accordance\r
+# with the terms of the license. Except as permitted by such\r
+# license, no part of this software or documentation may be\r
+# reproduced, stored in a retrieval system, or transmitted in any\r
+# form or by any means without the express written consent of\r
+# Intel Corporation.\r
+#\r
+#\r
+#**/\r
+\r
+################################################################################\r
+#\r
+# Defines Section - statements that will be processed to create a Makefile.\r
+#\r
+################################################################################\r
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = DxeBootScriptLibNull\r
+ FILE_GUID = 9A6DC1AC-94C0-43b1-8714-4C70FD58A815\r
+ MODULE_TYPE = DXE_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = BootScriptLib \r
+ EDK_RELEASE_VERSION = 0x00020000\r
+ EFI_SPECIFICATION_VERSION = 0x00020000\r
+\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC\r
+#\r
+\r
+################################################################################\r
+#\r
+# Sources Section - list of files that are required for the build to succeed.\r
+#\r
+################################################################################\r
+\r
+[Sources.common]\r
+ BootScriptLib.c\r
+\r
+\r
+################################################################################\r
+#\r
+# Includes Section - list of Include locations that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Includes]\r
+\r
+################################################################################\r
+#\r
+# Package Dependency Section - list of Package files that are required for\r
+# this module.\r
+#\r
+################################################################################\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ IntelFrameworkPkg/IntelFrameworkPkg.dec\r
+\r
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\r
+ <MsaHeader>\r
+ <ModuleName>DxeBootScriptLibNull</ModuleName>\r
+ <ModuleType>DXE_DRIVER</ModuleType>\r
+ <GuidValue>9A6DC1AC-94C0-43b1-8714-4C70FD58A815</GuidValue>\r
+ <Version>1.0</Version>\r
+ <Abstract>BootScriptLib instance that always produces NOP operation.</Abstract>\r
+ <Description>This library is primarily used by platform that does not support ACPI S3 resume.\r
+ All the library interfaces simply return EFI_SUCCESS without performing any operation.</Description>\r
+ <Copyright>Copyright (c) 2007, Intel Corporation.</Copyright>\r
+ <License>All rights reserved.\r
+ This software and associated documentation (if any) is furnished\r
+ under a license and may only be used or copied in accordance\r
+ with the terms of the license. Except as permitted by such\r
+ license, no part of this software or documentation may be\r
+ reproduced, stored in a retrieval system, or transmitted in any\r
+ form or by any means without the express written consent of\r
+ Intel Corporation.</License>\r
+ <Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>\r
+ </MsaHeader>\r
+ <ModuleDefinitions>\r
+ <SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>\r
+ <BinaryModule>false</BinaryModule>\r
+ <OutputFileBasename>DxeBootScriptLibNull</OutputFileBasename>\r
+ </ModuleDefinitions>\r
+ <LibraryClassDefinitions>\r
+ <LibraryClass Usage="ALWAYS_PRODUCED">\r
+ <Keyword>BootScriptLib</Keyword>\r
+ </LibraryClass>\r
+ </LibraryClassDefinitions>\r
+ <SourceFiles>\r
+ <Filename>BootScriptLib.c</Filename>\r
+ </SourceFiles>\r
+ <PackageDependencies>\r
+ <Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>\r
+ <Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>\r
+ <Package PackageGuid="bea835f9-fd62-464a-81ff-f3a806360c6b"/>\r
+ </PackageDependencies>\r
+ <Externs>\r
+ <Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>\r
+ <Specification>EDK_RELEASE_VERSION 0x00020000</Specification>\r
+ </Externs>\r
+</ModuleSurfaceArea>\r