PERFORCE change 140249 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Apr 19 08:31:36 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=140249
Change 140249 by hselasky at hselasky_laptop001 on 2008/04/19 08:31:09
Bring the ehci, ohci and uhci PCI ID match code closer to the
original. In addition a switch statement is faster than a
series of if's, hence the compile can optimise switch
statements into using binary search, for example.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/ehci_pci.c#35 edit
.. //depot/projects/usb/src/sys/dev/usb/ohci_pci.c#30 edit
.. //depot/projects/usb/src/sys/dev/usb/uhci_pci.c#32 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/ehci_pci.c#35 (text+ko) ====
@@ -139,63 +139,68 @@
{
uint32_t device_id = pci_get_devid(self);
- if (device_id == 0x268c8086)
+ switch (device_id) {
+ case 0x268c8086:
return ("Intel 63XXESB USB 2.0 controller");
- if (device_id == 0x523910b9)
+ case 0x523910b9:
return "ALi M5239 USB 2.0 controller";
- if (device_id == 0x10227463)
+ case 0x10227463:
return "AMD 8111 USB 2.0 controller";
- if (device_id == 0x20951022)
+ case 0x20951022:
return ("AMD CS5536 (Geode) USB 2.0 controller");
- if (device_id == 0x43451002)
+ case 0x43451002:
return "ATI SB200 USB 2.0 controller";
- if (device_id == 0x43731002)
+ case 0x43731002:
return "ATI SB400 USB 2.0 controller";
- if (device_id == 0x25ad8086)
+ case 0x25ad8086:
return "Intel 6300ESB USB 2.0 controller";
- if (device_id == 0x24cd8086)
+ case 0x24cd8086:
return "Intel 82801DB/L/M (ICH4) USB 2.0 controller";
- if (device_id == 0x24dd8086)
+ case 0x24dd8086:
return "Intel 82801EB/R (ICH5) USB 2.0 controller";
- if (device_id == 0x265c8086)
+ case 0x265c8086:
return "Intel 82801FB (ICH6) USB 2.0 controller";
- if (device_id == 0x27cc8086)
+ case 0x27cc8086:
return "Intel 82801GB/R (ICH7) USB 2.0 controller";
- if (device_id == 0x28368086)
+ case 0x28368086:
return "Intel 82801H (ICH8) USB 2.0 controller USB2-A";
- if (device_id == 0x283a8086)
+ case 0x283a8086:
return "Intel 82801H (ICH8) USB 2.0 controller USB2-B";
- if (device_id == 0x293a8086)
+ case 0x293a8086:
return "Intel 82801I (ICH9) USB 2.0 controller";
- if (device_id == 0x293c8086)
+ case 0x293c8086:
return "Intel 82801I (ICH9) USB 2.0 controller";
- if (device_id == 0x00e01033) {
+ case 0x00e01033:
return ("NEC uPD 720100 USB 2.0 controller");
- }
- if (device_id == 0x006810de)
+
+ case 0x006810de:
return "NVIDIA nForce2 USB 2.0 controller";
- if (device_id == 0x008810de)
+ case 0x008810de:
return "NVIDIA nForce2 Ultra 400 USB 2.0 controller";
- if (device_id == 0x00d810de)
+ case 0x00d810de:
return "NVIDIA nForce3 USB 2.0 controller";
- if (device_id == 0x00e810de)
+ case 0x00e810de:
return "NVIDIA nForce3 250 USB 2.0 controller";
- if (device_id == 0x005b10de)
+ case 0x005b10de:
return "NVIDIA nForce4 USB 2.0 controller";
- if (device_id == 0x15621131)
+ case 0x15621131:
return "Philips ISP156x USB 2.0 controller";
- if (device_id == 0x31041106) {
+ case 0x31041106:
return ("VIA VT6202 USB 2.0 controller");
+
+ default:
+ break;
}
+
if ((pci_get_class(self) == PCIC_SERIALBUS)
&& (pci_get_subclass(self) == PCIS_SERIALBUS_USB)
&& (pci_get_progif(self) == PCI_INTERFACE_EHCI)) {
==== //depot/projects/usb/src/sys/dev/usb/ohci_pci.c#30 (text+ko) ====
@@ -126,43 +126,47 @@
{
uint32_t device_id = pci_get_devid(self);
- if (device_id == 0x523710b9) {
+ switch (device_id) {
+ case 0x523710b9:
return ("AcerLabs M5237 (Aladdin-V) USB controller");
- }
- if (device_id == 0x740c1022) {
+
+ case 0x740c1022:
return ("AMD-756 USB Controller");
- }
- if (device_id == 0x74141022) {
+
+ case 0x74141022:
return ("AMD-766 USB Controller");
- }
- if (device_id == 0x43741002)
+
+ case 0x43741002:
return "ATI SB400 USB Controller";
- if (device_id == 0x43751002)
+ case 0x43751002:
return "ATI SB400 USB Controller";
- if (device_id == 0x06701095) {
+ case 0x06701095:
return ("CMD Tech 670 (USB0670) USB controller");
- }
- if (device_id == 0x06731095) {
+
+ case 0x06731095:
return ("CMD Tech 673 (USB0673) USB controller");
- }
- if (device_id == 0xc8611045) {
+
+ case 0xc8611045:
return ("OPTi 82C861 (FireLink) USB controller");
- }
- if (device_id == 0x00351033) {
+
+ case 0x00351033:
return ("NEC uPD 9210 USB controller");
- }
- if (device_id == 0x00d710de) {
+
+ case 0x00d710de:
return ("nVidia nForce3 USB Controller");
- }
- if (device_id == 0x70011039) {
+
+ case 0x70011039:
return ("SiS 5571 USB controller");
- }
- if (device_id == 0x1103108e)
+
+ case 0x1103108e:
return "Sun PCIO-2 USB controller";
- if (device_id == 0x0019106b) {
+ case 0x0019106b:
return ("Apple KeyLargo USB controller");
+
+ default:
+ break;
}
if ((pci_get_class(self) == PCIC_SERIALBUS) &&
(pci_get_subclass(self) == PCIS_SERIALBUS_USB) &&
==== //depot/projects/usb/src/sys/dev/usb/uhci_pci.c#32 (text+ko) ====
@@ -111,110 +111,115 @@
{
uint32_t device_id = pci_get_devid(self);
- if (device_id == 0x26888086)
+ switch (device_id) {
+ case 0x26888086:
return ("Intel 631XESB/632XESB/3100 USB controller USB-1");
- if (device_id == 0x26898086)
+ case 0x26898086:
return ("Intel 631XESB/632XESB/3100 USB controller USB-2");
- if (device_id == 0x268a8086)
+ case 0x268a8086:
return ("Intel 631XESB/632XESB/3100 USB controller USB-3");
- if (device_id == 0x268b8086)
+ case 0x268b8086:
return ("Intel 631XESB/632XESB/3100 USB controller USB-4");
- if (device_id == 0x70208086) {
+ case 0x70208086:
return ("Intel 82371SB (PIIX3) USB controller");
- }
- if (device_id == 0x71128086) {
+
+ case 0x71128086:
return ("Intel 82371AB/EB (PIIX4) USB controller");
- }
- if (device_id == 0x24128086) {
+
+ case 0x24128086:
return ("Intel 82801AA (ICH) USB controller");
- }
- if (device_id == 0x24228086) {
+
+ case 0x24228086:
return ("Intel 82801AB (ICH0) USB controller");
- }
- if (device_id == 0x24428086) {
+
+ case 0x24428086:
return ("Intel 82801BA/BAM (ICH2) USB controller USB-A");
- }
- if (device_id == 0x24448086) {
+
+ case 0x24448086:
return ("Intel 82801BA/BAM (ICH2) USB controller USB-B");
- }
- if (device_id == 0x24828086) {
+
+ case 0x24828086:
return ("Intel 82801CA/CAM (ICH3) USB controller USB-A");
- }
- if (device_id == 0x24848086) {
+
+ case 0x24848086:
return ("Intel 82801CA/CAM (ICH3) USB controller USB-B");
- }
- if (device_id == 0x24878086) {
+
+ case 0x24878086:
return ("Intel 82801CA/CAM (ICH3) USB controller USB-C");
- }
- if (device_id == 0x24c28086) {
+
+ case 0x24c28086:
return ("Intel 82801DB (ICH4) USB controller USB-A");
- }
- if (device_id == 0x24c48086) {
+
+ case 0x24c48086:
return ("Intel 82801DB (ICH4) USB controller USB-B");
- }
- if (device_id == 0x24c78086) {
+
+ case 0x24c78086:
return ("Intel 82801DB (ICH4) USB controller USB-C");
- }
- if (device_id == 0x24d28086) {
+
+ case 0x24d28086:
return ("Intel 82801EB (ICH5) USB controller USB-A");
- }
- if (device_id == 0x24d48086) {
+
+ case 0x24d48086:
return ("Intel 82801EB (ICH5) USB controller USB-B");
- }
- if (device_id == 0x24d78086) {
+
+ case 0x24d78086:
return ("Intel 82801EB (ICH5) USB controller USB-C");
- }
- if (device_id == 0x24de8086) {
+
+ case 0x24de8086:
return ("Intel 82801EB (ICH5) USB controller USB-D");
- }
- if (device_id == 0x26588086) {
+
+ case 0x26588086:
return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-A");
- }
- if (device_id == 0x26598086) {
+
+ case 0x26598086:
return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-B");
- }
- if (device_id == 0x265a8086) {
+
+ case 0x265a8086:
return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-C");
- }
- if (device_id == 0x265b8086) {
+
+ case 0x265b8086:
return ("Intel 82801FB/FR/FW/FRW (ICH6) USB controller USB-D");
- }
- if (device_id == 0x28308086)
+
+ case 0x28308086:
return ("Intel 82801H (ICH8) USB controller USB-A");
- if (device_id == 0x28318086)
+ case 0x28318086:
return ("Intel 82801H (ICH8) USB controller USB-B");
- if (device_id == 0x28328086)
+ case 0x28328086:
return ("Intel 82801H (ICH8) USB controller USB-C");
- if (device_id == 0x28348086)
+ case 0x28348086:
return ("Intel 82801H (ICH8) USB controller USB-D");
- if (device_id == 0x28358086)
+ case 0x28358086:
return ("Intel 82801H (ICH8) USB controller USB-E");
- if (device_id == 0x29348086)
+ case 0x29348086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x29358086)
+ case 0x29358086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x29368086)
+ case 0x29368086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x29378086)
+ case 0x29378086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x29388086)
+ case 0x29388086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x29398086)
+ case 0x29398086:
return ("Intel 82801I (ICH9) USB controller");
- if (device_id == 0x719a8086) {
+ case 0x719a8086:
return ("Intel 82443MX USB controller");
- }
- if (device_id == 0x76028086) {
+
+ case 0x76028086:
return ("Intel 82372FB/82468GX USB controller");
- }
- if (device_id == 0x30381106) {
+
+ case 0x30381106:
return ("VIA 83C572 USB controller");
+
+ default:
+ break;
}
+
if ((pci_get_class(self) == PCIC_SERIALBUS) &&
(pci_get_subclass(self) == PCIS_SERIALBUS_USB) &&
(pci_get_progif(self) == PCI_INTERFACE_UHCI)) {
More information about the p4-projects
mailing list