From 89339b38d8451e5a8c1e70d49313e4474e97cd24 Mon Sep 17 00:00:00 2001 From: Jung-uk Kim Date: Thu, 15 Jul 2010 17:11:49 +0000 Subject: [PATCH] - AcpiOsReadMemory() needs similar fixes as r209965. [1] According to ACPICA User Guide and Programmer Reference, the read data must be zero extended to fill the 32-bit return value even if the bit width of the port is less than 32. - Remove 64-bit read/write from AcpiOsReadMemory() and AcpiOsWriteMemory(). These functions do not support 64-bit access (yet). Clean up style nits and unnecessary bit masking while I am here. Reported by: Liu, Jinsong (jinsong dot liu at intel dot com) via Lin Ming (ming dot m dot lin at intel dot com) [1] --- sys/dev/acpica/Osd/OsdMemory.c | 24 ++++++------------------ 1 file changed, 6 insertions(+), 18 deletions(-) diff --git a/sys/dev/acpica/Osd/OsdMemory.c b/sys/dev/acpica/Osd/OsdMemory.c index 8ed7a900c34d..573fa0e2ea2e 100644 --- a/sys/dev/acpica/Osd/OsdMemory.c +++ b/sys/dev/acpica/Osd/OsdMemory.c @@ -103,19 +103,13 @@ AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 *Value, UINT32 Width) switch (Width) { case 8: - *(u_int8_t *)Value = (*(volatile u_int8_t *)LogicalAddress); + *Value = *(volatile uint8_t *)LogicalAddress; break; case 16: - *(u_int16_t *)Value = (*(volatile u_int16_t *)LogicalAddress); + *Value = *(volatile uint16_t *)LogicalAddress; break; case 32: - *(u_int32_t *)Value = (*(volatile u_int32_t *)LogicalAddress); - break; - case 64: - *(u_int64_t *)Value = (*(volatile u_int64_t *)LogicalAddress); - break; - default: - /* debug trap goes here */ + *Value = *(volatile uint32_t *)LogicalAddress; break; } @@ -135,19 +129,13 @@ AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT32 Value, UINT32 Width) switch (Width) { case 8: - (*(volatile u_int8_t *)LogicalAddress) = Value & 0xff; + *(volatile uint8_t *)LogicalAddress = Value; break; case 16: - (*(volatile u_int16_t *)LogicalAddress) = Value & 0xffff; + *(volatile uint16_t *)LogicalAddress = Value; break; case 32: - (*(volatile u_int32_t *)LogicalAddress) = Value & 0xffffffff; - break; - case 64: - (*(volatile u_int64_t *)LogicalAddress) = Value; - break; - default: - /* debug trap goes here */ + *(volatile uint32_t *)LogicalAddress = Value; break; }