From 0f265fea235a7df00b2e164da6874f60002052b1 Mon Sep 17 00:00:00 2001 From: Marcel Moolenaar Date: Sun, 23 Feb 2003 23:09:17 +0000 Subject: [PATCH] Use the correct size for reading and writing the PCI config space. Reading the PCI config space with the wrong (larger) size is not a problem in this case, but writing can be as it clobbers unrelated registers. In this case the clobbering is for reserved fields, which too is mostly harmless... for now. Hence, this change is mostly preventive in nature. --- sys/dev/usb/uhci_pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/uhci_pci.c b/sys/dev/usb/uhci_pci.c index e77db618d830..5c37051827d4 100644 --- a/sys/dev/usb/uhci_pci.c +++ b/sys/dev/usb/uhci_pci.c @@ -271,7 +271,7 @@ uhci_pci_attach(device_t self) sprintf(sc->sc_vendor, "(0x%04x)", pci_get_vendor(self)); } - switch (pci_read_config(self, PCI_USBREV, 4) & PCI_USBREV_MASK) { + switch (pci_read_config(self, PCI_USBREV, 1) & PCI_USBREV_MASK) { case PCI_USBREV_PRE_1_0: sc->sc_bus.usbrev = USBREV_PRE_1_0; break; @@ -298,11 +298,11 @@ uhci_pci_attach(device_t self) * to the ports of the root hub? */ #ifdef USB_DEBUG - if (pci_read_config(self, PCI_LEGSUP, 4) != PCI_LEGSUP_USBPIRQDEN) - device_printf(self, "LegSup = 0x%08x\n", - pci_read_config(self, PCI_LEGSUP, 4)); + if (pci_read_config(self, PCI_LEGSUP, 2) != PCI_LEGSUP_USBPIRQDEN) + device_printf(self, "LegSup = 0x%04x\n", + pci_read_config(self, PCI_LEGSUP, 2)); #endif - pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 4); + pci_write_config(self, PCI_LEGSUP, PCI_LEGSUP_USBPIRQDEN, 2); err = uhci_init(sc); if (!err)