PERFORCE change 94957 for review

Marcel Moolenaar marcel at FreeBSD.org
Mon Apr 10 22:38:54 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=94957

Change 94957 by marcel at marcel_nfs on 2006/04/10 22:38:15

	Allow specification of subvendor and subdevice.
	Resort on vendor, device.

Affected files ...

.. //depot/projects/uart/dev/puc/pucdata.c#18 edit
.. //depot/projects/uart/dev/uart/uart_bus_pci.c#14 edit

Differences ...

==== //depot/projects/uart/dev/puc/pucdata.c#18 (text+ko) ====

@@ -693,27 +693,6 @@
 	    },
 	},
 
-	/*
-	 * NEC PK-UG-X001 K56flex PCI Modem card.
-	 * Uses NEC MARTH bridge chip and Rockwell RCVDL56ACF/SP.
-	 */
-	{   "NEC PK-UG-X001 K56flex PCI Modem",
-	    {	0x1033,	0x0074,	0x1033,	0x8014	},
-	    {	0xffff,	0xffff,	0xffff,	0xffff	},
-	    {
-		{ PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ },
-	    },
-	},
-
-	/* NEC PK-UG-X008 */
-	{   "NEC PK-UG-X008",
-	    {	0x1033,	0x007d,	0x1033,	0x8012	},
-	    {	0xffff,	0xffff,	0xffff,	0xffff	},
-	    {
-		{ PUC_PORT_TYPE_COM, 0x10, 0x00, COM_FREQ },
-	    },
-	},
-
 	/* Lava Computers 2SP-PCI */
 	{   "Lava Computers 2SP-PCI parallel port",
 	    {	0x1407,	0x8000,	0,	0	},

==== //depot/projects/uart/dev/uart/uart_bus_pci.c#14 (text+ko) ====

@@ -59,47 +59,65 @@
 };
 
 struct pci_id {
-	uint32_t	type;
+	uint16_t	vendor;
+	uint16_t	device;
+	uint16_t	subven;
+	uint16_t	subdev;
 	const char	*desc;
 	int		rid;
 	int		rclk;
 };
 
 static struct pci_id pci_ns8250_ids[] = {
-{ 0x100812b9, "3Com - 56K FaxModem Model 5610", 0x10 },
-{ 0x048011c1, "Agere Systems - Venus Modem (V90, 56KFlex)", 0x14 },
-{ 0x00081028, "Dell - Remote Access Card III", 0x14, 128 * DEFAULT_RCLK },
-{ 0x00121028, "Dell - Remote Access Card 4 Daughter Card Virtual UART", 0x14, 128 * DEFAULT_RCLK },
-{ 0x01101407, "Lava Computer mfg - DSerial-PCI Port A", 0x10 },
-{ 0x01111407, "Lava Computer mfg - DSerial-PCI Port B", 0x10 },
-{ 0x9051deaf, "Middle Digital - PC Weasel Serial Port", 0x10 },
-{ 0x950b1415, "Oxford Semiconductor - OXCB950 Cardbus 16950 UART", 0x10, 16384000 },
-{ 0x01c0135c, "Quatech - SSCLP-200/300", 0x18 
+{ 0x1028, 0x0008, 0xffff, 0, "Dell - Remote Access Card III", 0x14, 128 * DEFAULT_RCLK },
+{ 0x1028, 0x0012, 0xffff, 0, "Dell - Remote Access Card 4 Daughter Card Virtual UART", 0x14, 128 * DEFAULT_RCLK },
+{ 0x1033, 0x0074, 0x1033, 0x8014, "NEC - RCV56ACF 56k Voice Modem", 0x10 },
+{ 0x1033, 0x007d, 0x1033, 0x8012, "NEC - RS232C", 0x10 },
+{ 0x11c1, 0x0480, 0xffff, 0, "Agere Systems - Venus Modem (V90, 56KFlex)", 0x14 },
+{ 0x115d, 0x0103, 0xffff, 0, "Xircom - Cardbus Ethernet + 56k Modem", 0x10 },
+{ 0x12b9, 0x1008, 0xffff, 0, "3Com - 56K FaxModem Model 5610", 0x10 },
+{ 0x131f, 0x1000, 0xffff, 0, "Siig - CyberSerial (1-port) 16550", 0x18 },
+{ 0x131f, 0x1001, 0xffff, 0, "Siig - CyberSerial (1-port) 16650", 0x18 },
+{ 0x131f, 0x1002, 0xffff, 0, "Siig - CyberSerial (1-port) 16850", 0x18 },
+{ 0x131f, 0x2000, 0xffff, 0, "Siig - CyberSerial (1-port) 16550", 0x10 },
+{ 0x131f, 0x2001, 0xffff, 0, "Siig - CyberSerial (1-port) 16650", 0x10 },
+{ 0x131f, 0x2002, 0xffff, 0, "Siig - CyberSerial (1-port) 16850", 0x10 },
+{ 0x135c, 0x01c0, 0xffff, 0, "Quatech - SSCLP-200/300", 0x18 
 	/* 
 	 * NB: You must mount the "SPAD" jumper to correctly detect
 	 * the FIFO on the UART.  Set the options on the jumpers,
 	 * we do not support the extra registers on the Quatech.
 	 */
 },
-{ 0x7101135e, "Sealevel Systems - Single Port RS-232/422/485/530", 0x18 },
-{ 0x1000131f, "Siig - CyberSerial (1-port) 16550", 0x18 },
-{ 0x1001131f, "Siig - CyberSerial (1-port) 16650", 0x18 },
-{ 0x1002131f, "Siig - CyberSerial (1-port) 16850", 0x18 },
-{ 0x2000131f, "Siig - CyberSerial (1-port) 16550", 0x10 },
-{ 0x2001131f, "Siig - CyberSerial (1-port) 16650", 0x10 },
-{ 0x2002131f, "Siig - CyberSerial (1-port) 16850", 0x10 },
-{ 0x0000151f, "TOPIC SEMICONDUCTOR - TP560 Data/Fax/Voice 56k modem", 0x10 },
-{ 0x0103115d, "Xircom - Cardbus Ethernet + 56k Modem", 0x10 },
-{ 0x00000000, NULL, 0 }
+{ 0x135e, 0x7101, 0xffff, 0, "Sealevel Systems - Single Port RS-232/422/485/530", 0x18 },
+{ 0x1407, 0x0110, 0xffff, 0, "Lava Computer mfg - DSerial-PCI Port A", 0x10 },
+{ 0x1407, 0x0111, 0xffff, 0, "Lava Computer mfg - DSerial-PCI Port B", 0x10 },
+{ 0x1415, 0x950b, 0xffff, 0, "Oxford Semiconductor - OXCB950 Cardbus 16950 UART", 0x10, 16384000 },
+{ 0x151f, 0x0000, 0xffff, 0, "TOPIC SEMICONDUCTOR - TP560 Data/Fax/Voice 56k modem", 0x10 },
+{ 0xdeaf, 0x9051, 0xffff, 0, "Middle Digital - PC Weasel Serial Port", 0x10 },
+{ 0xffff, 0, 0xffff, 0, NULL, 0, 0}
 };
 
 static struct pci_id *
-uart_pci_match(uint32_t type, struct pci_id *id)
+uart_pci_match(device_t dev, struct pci_id *id)
 {
+	uint16_t device, subdev, subven, vendor;
 
-	while (id->type && id->type != type)
+	vendor = pci_get_vendor(dev);
+	device = pci_get_device(dev);
+	while (id->vendor != 0xffff &&
+	    (id->vendor != vendor || id->device != device))
+		id++;
+	if (id->vendor == 0xffff)
+		return (NULL);
+	if (id->subven == 0xffff)
+		return (id);
+	subven = pci_get_subvendor(dev);
+	subdev = pci_get_subdevice(dev);
+	while (id->vendor == vendor && id->device == device &&
+	    (id->subven != subven || id->subdev != subdev))
 		id++;
-	return ((id->type) ? id : NULL);
+	return ((id->vendor == vendor && id->device == device) ? id : NULL);
 }
 
 static int
@@ -110,7 +128,7 @@
 
 	sc = device_get_softc(dev);
 
-	id = uart_pci_match(pci_get_devid(dev), pci_ns8250_ids);
+	id = uart_pci_match(dev, pci_ns8250_ids);
 	if (id != NULL) {
 		sc->sc_class = &uart_ns8250_class;
 		goto match;


More information about the p4-projects mailing list