]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/IsaAcpiDxe/IsaAcpi.c
Add TPM Physical Presence >=128 operation value support.
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / IsaAcpi.c
index 5eba8591b629fb86bc20b8aee264ae19257127a0..7b1ab1c8d5c55a649786399b0983f4a88ea634d7 100644 (file)
@@ -1,26 +1,15 @@
-/*++\r
+/** @file\r
+  ISA ACPI Protocol Implementation\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
-All rights reserved. This program and the accompanying materials                          \r
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+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
-\r
-Module Name:\r
-\r
-  IsaAcpi.c\r
-    \r
-Abstract: \r
-  \r
-    ISA ACPI Protocol Implementation\r
-\r
-Revision History\r
-\r
---*/\r
+**/\r
 \r
 #include "PcatIsaAcpi.h"\r
 \r
@@ -31,6 +20,7 @@ Revision History
 //\r
 // COM 1 UART Controller\r
 //\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources[] = {\r
   {EfiIsaAcpiResourceIo,        0, 0x3f8, 0x3ff},\r
   {EfiIsaAcpiResourceInterrupt, 0, 4,     0},\r
@@ -40,6 +30,7 @@ EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom1DeviceResources[] = {
 //\r
 // COM 2 UART Controller\r
 //\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources[] = {\r
   {EfiIsaAcpiResourceIo,        0, 0x2f8, 0x2ff},\r
   {EfiIsaAcpiResourceInterrupt, 0, 3,     0},\r
@@ -49,6 +40,7 @@ EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiCom2DeviceResources[] = {
 //\r
 // PS/2 Keyboard Controller\r
 //\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
 EFI_ISA_ACPI_RESOURCE  mPcatIsaAcpiPs2KeyboardDeviceResources[] = {\r
   {EfiIsaAcpiResourceIo,        0, 0x60, 0x64},\r
   {EfiIsaAcpiResourceInterrupt, 0, 1,     0},\r
@@ -58,6 +50,7 @@ EFI_ISA_ACPI_RESOURCE  mPcatIsaAcpiPs2KeyboardDeviceResources[] = {
 //\r
 // PS/2 Mouse Controller\r
 //\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
 EFI_ISA_ACPI_RESOURCE  mPcatIsaAcpiPs2MouseDeviceResources[] = {\r
   {EfiIsaAcpiResourceIo,        0, 0x60, 0x64},\r
   {EfiIsaAcpiResourceInterrupt, 0, 12,     0},\r
@@ -67,6 +60,7 @@ EFI_ISA_ACPI_RESOURCE  mPcatIsaAcpiPs2MouseDeviceResources[] = {
 //\r
 // Floppy Disk Controller\r
 //\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
 EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources[] = {\r
   {EfiIsaAcpiResourceIo,        0, 0x3f0, 0x3f7},\r
   {EfiIsaAcpiResourceInterrupt, 0, 6,     0},\r
@@ -74,38 +68,94 @@ EFI_ISA_ACPI_RESOURCE mPcatIsaAcpiFloppyResources[] = {
   {EfiIsaAcpiResourceEndOfList, 0, 0,     0}\r
 };\r
 \r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom1Device = {\r
+  {EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources\r
+}; // COM 1 UART Controller\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiCom2Device = {\r
+  {EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources\r
+}; // COM 2 UART Controller\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2KeyboardDevice = {\r
+  {EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources\r
+}; // PS/2 Keyboard Controller\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiPs2MouseDevice = {\r
+  {EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources\r
+}; // PS/2 Mouse Controller\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyADevice = {\r
+  {EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources\r
+}; // Floppy Disk Controller A:\r
+\r
+GLOBAL_REMOVE_IF_UNREFERENCED\r
+EFI_ISA_ACPI_RESOURCE_LIST mPcatIsaAcpiFloppyBDevice = {\r
+  {EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources\r
+}; // Floppy Disk Controller B:\r
+\r
 //\r
 // Table of ISA Controllers\r
 //\r
-EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList[] = {\r
-  {{EISA_PNP_ID(0x501), 0}, mPcatIsaAcpiCom1DeviceResources        }, // COM 1 UART Controller\r
-  {{EISA_PNP_ID(0x501), 1}, mPcatIsaAcpiCom2DeviceResources        }, // COM 2 UART Controller\r
-  {{EISA_PNP_ID(0x303), 0}, mPcatIsaAcpiPs2KeyboardDeviceResources }, // PS/2 Keyboard Controller\r
-  {{EISA_PNP_ID(0x303), 1}, mPcatIsaAcpiPs2MouseDeviceResources    }, // PS/2 Mouse Controller\r
-  {{EISA_PNP_ID(0x604), 0}, mPcatIsaAcpiFloppyResources            }, // Floppy Disk Controller A:\r
-  {{EISA_PNP_ID(0x604), 1}, mPcatIsaAcpiFloppyResources            }, // Floppy Disk Controller B:\r
-  {{0,                  0}, NULL                                   }  // End if ISA Controllers\r
-};\r
+EFI_ISA_ACPI_RESOURCE_LIST gPcatIsaAcpiDeviceList[7] = {{{0, 0}, NULL}};\r
+\r
+/**\r
+  Initialize gPcatIsaAcpiDeviceList.\r
+**/\r
+VOID\r
+InitializePcatIsaAcpiDeviceList (\r
+  VOID\r
+  )\r
+{\r
+  UINTN  Index;\r
+\r
+  Index = 0;\r
+  if (PcdGetBool (PcdIsaAcpiCom1Enable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiCom1Device, sizeof(mPcatIsaAcpiCom1Device));\r
+    Index++;\r
+  }\r
+  if (PcdGetBool (PcdIsaAcpiCom2Enable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiCom2Device, sizeof(mPcatIsaAcpiCom2Device));\r
+    Index++;\r
+  }\r
+  if (PcdGetBool (PcdIsaAcpiPs2KeyboardEnable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiPs2KeyboardDevice, sizeof(mPcatIsaAcpiPs2KeyboardDevice));\r
+    Index++;\r
+  }\r
+  if (PcdGetBool (PcdIsaAcpiPs2MouseEnable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiPs2MouseDevice, sizeof(mPcatIsaAcpiPs2MouseDevice));\r
+    Index++;\r
+  }\r
+  if (PcdGetBool (PcdIsaAcpiFloppyAEnable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiFloppyADevice, sizeof(mPcatIsaAcpiFloppyADevice));\r
+    Index++;\r
+  }\r
+  if (PcdGetBool (PcdIsaAcpiFloppyBEnable)) {\r
+    CopyMem (&gPcatIsaAcpiDeviceList[Index], &mPcatIsaAcpiFloppyBDevice, sizeof(mPcatIsaAcpiFloppyBDevice));\r
+    Index++;\r
+  }\r
+}\r
 \r
 //\r
 // ISA ACPI Protocol Functions\r
 //\r
+/**\r
+  Enumerate the ISA devices on the ISA bus.\r
+\r
+  @param Device             Point to device ID instance \r
+  @param IsaAcpiDevice      On return, point to resource data for Isa device\r
+  @param NextIsaAcpiDevice  On return, point to resource data for next Isa device\r
+**/\r
 VOID\r
 IsaDeviceLookup (\r
   IN  EFI_ISA_ACPI_DEVICE_ID      *Device,\r
   OUT EFI_ISA_ACPI_RESOURCE_LIST  **IsaAcpiDevice,\r
   OUT EFI_ISA_ACPI_RESOURCE_LIST  **NextIsaAcpiDevice\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Enumerate the ISA devices on the ISA bus\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   UINTN  Index;\r
 \r
@@ -133,22 +183,23 @@ Returns:
   }\r
 }\r
 \r
+/**\r
+  Enumerate the ISA devices on the ISA bus\r
+\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+\r
+  @retval EFI_NOT_FOUND Can not found the next Isa device.\r
+  @retval EFI_SUCESS    Success retrieve the next Isa device for enumration.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaDeviceEnumerate (\r
   IN  EFI_ISA_ACPI_PROTOCOL   *This,\r
   OUT EFI_ISA_ACPI_DEVICE_ID  **Device\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Enumerate the ISA devices on the ISA bus\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   EFI_ISA_ACPI_RESOURCE_LIST  *IsaAcpiDevice;\r
   EFI_ISA_ACPI_RESOURCE_LIST  *NextIsaAcpiDevice;\r
@@ -161,6 +212,17 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Set ISA device power\r
+\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+  @param OnOff           TRUE for setting isa device power on,\r
+                         FALSE for setting isa device power off\r
+\r
+  @return EFI_SUCCESS    Sucess to change power status for isa device.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaDeviceSetPower (\r
@@ -168,20 +230,20 @@ IsaDeviceSetPower (
   IN EFI_ISA_ACPI_DEVICE_ID  *Device,\r
   IN BOOLEAN                 OnOff\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Set ISA device power \r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return EFI_SUCCESS;\r
 } \r
 \r
+/**\r
+  Get current resource for the specific ISA device.\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+  @param ResourceList    On return, point to resources instances for given isa device\r
+\r
+  @retval EFI_NOT_FOUND Can not found the resource instance for given isa device\r
+  @retval EFI_SUCCESS   Success to get resource instance for given isa device.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaGetCurrentResource (\r
@@ -189,16 +251,6 @@ IsaGetCurrentResource (
   IN  EFI_ISA_ACPI_DEVICE_ID      *Device,  \r
   OUT EFI_ISA_ACPI_RESOURCE_LIST  **ResourceList\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-  Get current Resource of the specific ISA device\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   IsaDeviceLookup (Device, ResourceList, NULL);\r
   if (*ResourceList == NULL) {\r
@@ -207,6 +259,15 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Get possible resource for the specific ISA device.\r
+  \r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+  @param ResourceList    On return, point to resources instances for given isa device\r
+\r
+  @retval EFI_SUCCESS   Success to get resource instance for given isa device.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaGetPossibleResource (\r
@@ -214,19 +275,20 @@ IsaGetPossibleResource (
   IN  EFI_ISA_ACPI_DEVICE_ID      *Device,  \r
   OUT EFI_ISA_ACPI_RESOURCE_LIST  **ResourceList\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/ \r
 {\r
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Set resource for the specific ISA device.\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+  @param ResourceList    Point to resources instances for given isa device\r
+\r
+  @return EFI_SUCESS  Success to set resource.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaSetResource (\r
@@ -234,19 +296,20 @@ IsaSetResource (
   IN EFI_ISA_ACPI_DEVICE_ID      *Device,  \r
   IN EFI_ISA_ACPI_RESOURCE_LIST  *ResourceList\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return EFI_SUCCESS;\r
 }\r
         \r
+/**\r
+  Enable/Disable the specific ISA device.\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+  @param Enable          Enable/Disable\r
+\r
+  @return EFI_SUCESS  Success to enable/disable.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaEnableDevice (\r
@@ -254,53 +317,43 @@ IsaEnableDevice (
   IN EFI_ISA_ACPI_DEVICE_ID  *Device,\r
   IN BOOLEAN                 Enable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return EFI_SUCCESS;  \r
 }\r
 \r
+/**\r
+  Initialize the specific ISA device.\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+  @param Device          Point to device ID instance \r
+\r
+  @return EFI_SUCESS  Success to initialize.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaInitDevice (\r
   IN EFI_ISA_ACPI_PROTOCOL   *This,\r
   IN EFI_ISA_ACPI_DEVICE_ID  *Device\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return EFI_SUCCESS;\r
 }\r
 \r
 \r
+/**\r
+  Initialize the ISA interface.\r
+\r
+  @param This            Point to instance of EFI_ISA_ACPI_PROTOCOL\r
+\r
+  @return EFI_SUCESS  Success to initialize ISA interface.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 IsaInterfaceInit (\r
   IN EFI_ISA_ACPI_PROTOCOL  *This\r
 )  \r
-/*++\r
-\r
-Routine Description:\r
-\r
-Arguments:\r
-\r
-Returns:\r
-\r
---*/\r
 {\r
   return EFI_SUCCESS;\r
 }  \r