diff options
author | Robert Moore <Robert.Moore@intel.com> | 2012-02-02 13:39:57 -0800 |
---|---|---|
committer | Robert Moore <Robert.Moore@intel.com> | 2012-02-02 13:39:57 -0800 |
commit | 558ddb10211d63a2c6dc4c01d8d2222ff250e909 (patch) | |
tree | 3dd736c2ec9907945ef46894fd36bc3c873632c5 | |
parent | d58abe67a91759ef481e7c3e9934183e164b91ce (diff) | |
download | acpica-558ddb10211d63a2c6dc4c01d8d2222ff250e909.tar.gz |
Expand OSL memory read/write interfaces to 64 bits.
This change expands AcpiOsReadMemory and AcpiOsWriteMemory to
a full 64 bits. This allows 64 bit transfers via the AcpiRead
and AcpiWrite interfaces. Note: The internal AcpiHwRead and
AcpiHwWrite interfaces remain at 32 bits, because 64 bits is not
needed to access the standard ACPI registers.
-rw-r--r-- | source/components/hardware/hwregs.c | 7 | ||||
-rw-r--r-- | source/components/hardware/hwxface.c | 52 | ||||
-rw-r--r-- | source/include/acpiosxf.h | 4 | ||||
-rw-r--r-- | source/os_specific/service_layers/osunixxf.c | 12 | ||||
-rw-r--r-- | source/os_specific/service_layers/oswinxf.c | 11 |
5 files changed, 34 insertions, 52 deletions
diff --git a/source/components/hardware/hwregs.c b/source/components/hardware/hwregs.c index 328b95d46..5a9a776ef 100644 --- a/source/components/hardware/hwregs.c +++ b/source/components/hardware/hwregs.c @@ -245,6 +245,7 @@ AcpiHwRead ( ACPI_GENERIC_ADDRESS *Reg) { UINT64 Address; + UINT64 Value64; ACPI_STATUS Status; @@ -270,7 +271,9 @@ AcpiHwRead ( 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 */ { @@ -329,7 +332,7 @@ AcpiHwWrite ( 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 */ { diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c index 24d9bd10a..de4daae46 100644 --- a/source/components/hardware/hwxface.c +++ b/source/components/hardware/hwxface.c @@ -226,12 +226,6 @@ AcpiRead ( return (Status); } - Width = Reg->BitWidth; - if (Width == 64) - { - Width = 32; /* Break into two 32-bit transfers */ - } - /* Initialize entire 64-bit return value to zero */ *ReturnValue = 0; @@ -244,28 +238,20 @@ AcpiRead ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - Address, &Value, Width); + Address, ReturnValue, Reg->BitWidth); if (ACPI_FAILURE (Status)) { return (Status); } - *ReturnValue = Value; - - if (Reg->BitWidth == 64) - { - /* Read the top 32 bits */ - - Status = AcpiOsReadMemory ((ACPI_PHYSICAL_ADDRESS) - (Address + 4), &Value, 32); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - *ReturnValue |= ((UINT64) Value << 32); - } } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { + Width = Reg->BitWidth; + if (Width == 64) + { + Width = 32; /* Break into two 32-bit transfers */ + } + Status = AcpiHwReadPort ((ACPI_IO_ADDRESS) Address, &Value, Width); if (ACPI_FAILURE (Status)) @@ -334,12 +320,6 @@ AcpiWrite ( return (Status); } - Width = Reg->BitWidth; - if (Width == 64) - { - Width = 32; /* Break into two 32-bit transfers */ - } - /* * Two address spaces supported: Memory or IO. PCI_Config is * not supported here because the GAS structure is insufficient @@ -347,24 +327,20 @@ AcpiWrite ( if (Reg->SpaceId == ACPI_ADR_SPACE_SYSTEM_MEMORY) { Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - Address, ACPI_LODWORD (Value), Width); + Address, Value, Reg->BitWidth); if (ACPI_FAILURE (Status)) { return (Status); } - - if (Reg->BitWidth == 64) - { - Status = AcpiOsWriteMemory ((ACPI_PHYSICAL_ADDRESS) - (Address + 4), ACPI_HIDWORD (Value), 32); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } } else /* ACPI_ADR_SPACE_SYSTEM_IO, validated earlier */ { + Width = Reg->BitWidth; + if (Width == 64) + { + Width = 32; /* Break into two 32-bit transfers */ + } + Status = AcpiHwWritePort ((ACPI_IO_ADDRESS) Address, ACPI_LODWORD (Value), Width); if (ACPI_FAILURE (Status)) diff --git a/source/include/acpiosxf.h b/source/include/acpiosxf.h index 75cb029df..5cc7364aa 100644 --- a/source/include/acpiosxf.h +++ b/source/include/acpiosxf.h @@ -375,13 +375,13 @@ AcpiOsWritePort ( ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 *Value, + UINT64 *Value, UINT32 Width); ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 Value, + UINT64 Value, UINT32 Width); diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index 8247714b4..1b13354ab 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -1089,9 +1089,10 @@ AcpiOsWritePort ( * * PARAMETERS: Address - Physical Memory Address to read * Value - Where value is placed - * Width - Number of bits + * Width - Number of bits (8,16,32, or 64) * - * RETURN: Value read from physical memory address + * RETURN: Value read from physical memory address. Always returned + * as a 64-bit integer, regardless of the read width. * * DESCRIPTION: Read data from a physical memory address * @@ -1100,7 +1101,7 @@ AcpiOsWritePort ( ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 *Value, + UINT64 *Value, UINT32 Width) { @@ -1109,6 +1110,7 @@ AcpiOsReadMemory ( case 8: case 16: case 32: + case 64: *Value = 0; break; @@ -1125,7 +1127,7 @@ AcpiOsReadMemory ( * * PARAMETERS: Address - Physical Memory Address to write * Value - Value to write - * Width - Number of bits + * Width - Number of bits (8,16,32, or 64) * * RETURN: None * @@ -1136,7 +1138,7 @@ AcpiOsReadMemory ( ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 Value, + UINT64 Value, UINT32 Width) { diff --git a/source/os_specific/service_layers/oswinxf.c b/source/os_specific/service_layers/oswinxf.c index 29422a130..7c47145ba 100644 --- a/source/os_specific/service_layers/oswinxf.c +++ b/source/os_specific/service_layers/oswinxf.c @@ -1299,10 +1299,10 @@ AcpiOsWritePort ( * * PARAMETERS: Address - Physical Memory Address to read * Value - Where value is placed - * Width - Number of bits + * Width - Number of bits (8,16,32, or 64) * * RETURN: Value read from physical memory address. Always returned - * as a 32-bit integer, regardless of the read width. + * as a 64-bit integer, regardless of the read width. * * DESCRIPTION: Read data from a physical memory address * @@ -1311,7 +1311,7 @@ AcpiOsWritePort ( ACPI_STATUS AcpiOsReadMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 *Value, + UINT64 *Value, UINT32 Width) { @@ -1320,6 +1320,7 @@ AcpiOsReadMemory ( case 8: case 16: case 32: + case 64: *Value = 0; break; @@ -1338,7 +1339,7 @@ AcpiOsReadMemory ( * * PARAMETERS: Address - Physical Memory Address to write * Value - Value to write - * Width - Number of bits + * Width - Number of bits (8,16,32, or 64) * * RETURN: None * @@ -1349,7 +1350,7 @@ AcpiOsReadMemory ( ACPI_STATUS AcpiOsWriteMemory ( ACPI_PHYSICAL_ADDRESS Address, - UINT32 Value, + UINT64 Value, UINT32 Width) { |