From 66838c310f5a207d833c9840fdd69cae8aa4db73 Mon Sep 17 00:00:00 2001 From: jkim Date: Thu, 15 Jul 2010 19:52:54 +0000 Subject: [PATCH] - AcpiOsReadPciConfiguration() needs similar fixes as r209965 and r210129. According to ACPICA User Guide and Programmer Reference, the read data must be zero extended to fill the 64-bit return value even if the bit width of the location is less than 64. - Return error when 64-bit access is requested as we do not support 64-bit PCI register access (yet). XXX We may have to split it up into two 32-bit accesses if it is really required. --- sys/dev/acpica/Osd/OsdHardware.c | 35 ++++++++------------------------ 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/sys/dev/acpica/Osd/OsdHardware.c b/sys/dev/acpica/Osd/OsdHardware.c index 14e08e8a3ebd..869065e3cd84 100644 --- a/sys/dev/acpica/Osd/OsdHardware.c +++ b/sys/dev/acpica/Osd/OsdHardware.c @@ -79,9 +79,6 @@ AcpiOsReadPort(ACPI_IO_ADDRESS InPort, UINT32 *Value, UINT32 Width) case 32: *Value = bus_space_read_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, InPort); break; - default: - /* debug trap goes here */ - break; } return (AE_OK); @@ -101,9 +98,6 @@ AcpiOsWritePort(ACPI_IO_ADDRESS OutPort, UINT32 Value, UINT32 Width) case 32: bus_space_write_4(ACPI_BUS_SPACE_IO, ACPI_BUS_HANDLE, OutPort, Value); break; - default: - /* debug trap goes here */ - break; } return (AE_OK); @@ -113,28 +107,15 @@ ACPI_STATUS AcpiOsReadPciConfiguration(ACPI_PCI_ID *PciId, UINT32 Register, void *Value, UINT32 Width) { - u_int32_t byte_width = Width / 8; - u_int32_t val; + + if (Width == 64) + return (AE_SUPPORT); if (!pci_cfgregopen()) return (AE_NOT_EXIST); - val = pci_cfgregread(PciId->Bus, PciId->Device, PciId->Function, Register, - byte_width); - switch (Width) { - case 8: - *(u_int8_t *)Value = val & 0xff; - break; - case 16: - *(u_int16_t *)Value = val & 0xffff; - break; - case 32: - *(u_int32_t *)Value = val; - break; - default: - /* debug trap goes here */ - break; - } + *(UINT64 *)Value = pci_cfgregread(PciId->Bus, PciId->Device, + PciId->Function, Register, Width / 8); return (AE_OK); } @@ -144,13 +125,15 @@ ACPI_STATUS AcpiOsWritePciConfiguration (ACPI_PCI_ID *PciId, UINT32 Register, UINT64 Value, UINT32 Width) { - u_int32_t byte_width = Width / 8; + + if (Width == 64) + return (AE_SUPPORT); if (!pci_cfgregopen()) return (AE_NOT_EXIST); pci_cfgregwrite(PciId->Bus, PciId->Device, PciId->Function, Register, - Value, byte_width); + Value, Width / 8); return (AE_OK); }