Print this page
acpica-unix2-20130823
PANKOVs restructure

@@ -1,15 +1,14 @@
-
 /*******************************************************************************
  *
  * Module Name: hwregs - Read/write access functions for the various ACPI
  *                       control and status registers.
  *
  ******************************************************************************/
 
 /*
- * Copyright (C) 2000 - 2011, Intel Corp.
+ * Copyright (C) 2000 - 2013, Intel Corp.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * are met:

@@ -51,10 +50,12 @@
 
 #define _COMPONENT          ACPI_HARDWARE
         ACPI_MODULE_NAME    ("hwregs")
 
 
+#if (!ACPI_REDUCED_HARDWARE)
+
 /* Local Prototypes */
 
 static ACPI_STATUS
 AcpiHwReadMultiple (
     UINT32                  *Value,

@@ -65,10 +66,11 @@
 AcpiHwWriteMultiple (
     UINT32                  Value,
     ACPI_GENERIC_ADDRESS    *RegisterA,
     ACPI_GENERIC_ADDRESS    *RegisterB);
 
+#endif /* !ACPI_REDUCED_HARDWARE */
 
 /******************************************************************************
  *
  * FUNCTION:    AcpiHwValidateRegister
  *

@@ -168,10 +170,11 @@
 AcpiHwRead (
     UINT32                  *Value,
     ACPI_GENERIC_ADDRESS    *Reg)
 {
     UINT64                  Address;
+    UINT64                  Value64;
     ACPI_STATUS             Status;
 
 
     ACPI_FUNCTION_NAME (HwRead);
 

@@ -193,11 +196,13 @@
      * not supported here because the GAS structure is insufficient
      */
     if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
     {
         Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS)
-                    Address, Value, Reg->BitWidth);
+                    Address, &Value64, Reg->BitWidth);
+
+        *Value = (UINT32) Value64;
     }
     else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
     {
         Status = AcpiHwReadPort ((ACPI_IO_ADDRESS)
                     Address, Value, Reg->BitWidth);

@@ -252,11 +257,11 @@
      * not supported here because the GAS structure is insufficient
      */
     if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY)
     {
         Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS)
-                    Address, Value, Reg->BitWidth);
+                    Address, (UINT64) Value, Reg->BitWidth);
     }
     else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */
     {
         Status = AcpiHwWritePort ((ACPI_IO_ADDRESS)
                     Address, Value, Reg->BitWidth);

@@ -269,10 +274,11 @@
 
     return (Status);
 }
 
 
+#if (!ACPI_REDUCED_HARDWARE)
 /*******************************************************************************
  *
  * FUNCTION:    AcpiHwClearAcpiStatus
  *
  * PARAMETERS:  None

@@ -319,11 +325,11 @@
 }
 
 
 /*******************************************************************************
  *
- * FUNCTION:    AcpiHwGetRegisterBitMask
+ * FUNCTION:    AcpiHwGetBitRegisterInfo
  *
  * PARAMETERS:  RegisterId          - Index of ACPI Register to access
  *
  * RETURN:      The bitmask to be used when accessing the register
  *

@@ -422,19 +428,17 @@
         Status = AcpiHwReadMultiple (&Value,
                     &AcpiGbl_XPm1aStatus,
                     &AcpiGbl_XPm1bStatus);
         break;
 
-
     case ACPI_REGISTER_PM1_ENABLE:           /* PM1 A/B: 16-bit access each */
 
         Status = AcpiHwReadMultiple (&Value,
                     &AcpiGbl_XPm1aEnable,
                     &AcpiGbl_XPm1bEnable);
         break;
 
-
     case ACPI_REGISTER_PM1_CONTROL:          /* PM1 A/B: 16-bit access each */
 
         Status = AcpiHwReadMultiple (&Value,
                     &AcpiGbl_FADT.XPm1aControlBlock,
                     &AcpiGbl_FADT.XPm1bControlBlock);

@@ -445,30 +449,27 @@
          * software masks out all write-only bits."
          */
         Value &= ~ACPI_PM1_CONTROL_WRITEONLY_BITS;
         break;
 
-
     case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
 
         Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPm2ControlBlock);
         break;
 
-
     case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
 
         Status = AcpiHwRead (&Value, &AcpiGbl_FADT.XPmTimerBlock);
         break;
 
-
     case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
 
         Status = AcpiHwReadPort (AcpiGbl_FADT.SmiCommand, &Value, 8);
         break;
 
-
     default:
+
         ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
             RegisterId));
         Status = AE_BAD_PARAMETER;
         break;
     }

@@ -538,21 +539,18 @@
         Status = AcpiHwWriteMultiple (Value,
                     &AcpiGbl_XPm1aStatus,
                     &AcpiGbl_XPm1bStatus);
         break;
 
-
     case ACPI_REGISTER_PM1_ENABLE:           /* PM1 A/B: 16-bit access each */
 
         Status = AcpiHwWriteMultiple (Value,
                     &AcpiGbl_XPm1aEnable,
                     &AcpiGbl_XPm1bEnable);
         break;
 
-
     case ACPI_REGISTER_PM1_CONTROL:          /* PM1 A/B: 16-bit access each */
-
         /*
          * Perform a read first to preserve certain bits (per ACPI spec)
          * Note: This includes SCI_EN, we never want to change this bit
          */
         Status = AcpiHwReadMultiple (&ReadValue,

@@ -572,13 +570,11 @@
         Status = AcpiHwWriteMultiple (Value,
                     &AcpiGbl_FADT.XPm1aControlBlock,
                     &AcpiGbl_FADT.XPm1bControlBlock);
         break;
 
-
     case ACPI_REGISTER_PM2_CONTROL:          /* 8-bit access */
-
         /*
          * For control registers, all reserved bits must be preserved,
          * as per the ACPI spec.
          */
         Status = AcpiHwRead (&ReadValue, &AcpiGbl_FADT.XPm2ControlBlock);

@@ -592,26 +588,24 @@
         ACPI_INSERT_BITS (Value, ACPI_PM2_CONTROL_PRESERVED_BITS, ReadValue);
 
         Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPm2ControlBlock);
         break;
 
-
     case ACPI_REGISTER_PM_TIMER:             /* 32-bit access */
 
         Status = AcpiHwWrite (Value, &AcpiGbl_FADT.XPmTimerBlock);
         break;
 
-
     case ACPI_REGISTER_SMI_COMMAND_BLOCK:    /* 8-bit access */
 
         /* SMI_CMD is currently always in IO space */
 
         Status = AcpiHwWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
         break;
 
-
     default:
+
         ACPI_ERROR ((AE_INFO, "Unknown Register ID: 0x%X",
             RegisterId));
         Status = AE_BAD_PARAMETER;
         break;
     }

@@ -729,5 +723,6 @@
     }
 
     return (Status);
 }
 
+#endif /* !ACPI_REDUCED_HARDWARE */