Date: Thu, 15 Jul 2010 19:52:55 +0000 (UTC) From: Jung-uk Kim <jkim@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r210137 - head/sys/dev/acpica/Osd Message-ID: <201007151952.o6FJqtgH084988@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jkim Date: Thu Jul 15 19:52:54 2010 New Revision: 210137 URL: http://svn.freebsd.org/changeset/base/210137 Log: - 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. Modified: head/sys/dev/acpica/Osd/OsdHardware.c Modified: head/sys/dev/acpica/Osd/OsdHardware.c ============================================================================== --- head/sys/dev/acpica/Osd/OsdHardware.c Thu Jul 15 19:40:48 2010 (r210136) +++ head/sys/dev/acpica/Osd/OsdHardware.c Thu Jul 15 19:52:54 2010 (r210137) @@ -79,9 +79,6 @@ AcpiOsReadPort(ACPI_IO_ADDRESS InPort, U 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, 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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007151952.o6FJqtgH084988>