PERFORCE change 144738 for review

Marcel Moolenaar marcel at FreeBSD.org
Sat Jul 5 19:33:03 UTC 2008


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

Change 144738 by marcel at marcel_xcllnt on 2008/07/05 19:32:37

	Unify PC98 cbus attachment with standard isa bus attachment.
	On PC98 the cbus is put under option isa and is for the most
	part similar to isa. There's no need to duplicate the whole
	isa bus attachment into a new files.

Affected files ...

.. //depot/projects/uart/conf/files#89 edit
.. //depot/projects/uart/conf/files.amd64#35 edit
.. //depot/projects/uart/conf/files.i386#41 edit
.. //depot/projects/uart/conf/files.pc98#34 edit
.. //depot/projects/uart/conf/files.sparc64#23 edit
.. //depot/projects/uart/dev/uart/uart_bus_cbus.c#3 delete
.. //depot/projects/uart/dev/uart/uart_bus_isa.c#9 edit
.. //depot/projects/uart/dev/uart/uart_cpu_pc98.c#18 edit

Differences ...

==== //depot/projects/uart/conf/files#89 (text+ko) ====

@@ -1253,6 +1253,7 @@
 dev/txp/if_txp.c		optional txp
 dev/uart/uart_bus_acpi.c	optional uart acpi
 dev/uart/uart_bus_ebus.c	optional uart ebus
+dev/uart/uart_bus_isa.c		optional uart isa
 dev/uart/uart_bus_pccard.c	optional uart pccard
 dev/uart/uart_bus_pci.c		optional uart pci
 dev/uart/uart_bus_puc.c		optional uart puc

==== //depot/projects/uart/conf/files.amd64#35 (text+ko) ====

@@ -205,7 +205,6 @@
 dev/syscons/scterm-sc.c		optional	sc
 dev/syscons/scvgarndr.c		optional	sc vga
 dev/syscons/scvtb.c		optional	sc
-dev/uart/uart_bus_isa.c		optional	uart isa
 dev/uart/uart_cpu_amd64.c	optional	uart
 dev/wpi/if_wpi.c		optional	wpi
 isa/atrtc.c			standard

==== //depot/projects/uart/conf/files.i386#41 (text+ko) ====

@@ -224,7 +224,6 @@
 dev/syscons/scvesactl.c		optional sc vga vesa
 dev/syscons/scvgarndr.c		optional sc vga
 dev/syscons/scvtb.c		optional sc
-dev/uart/uart_bus_isa.c		optional uart isa
 dev/uart/uart_cpu_i386.c	optional uart
 dev/acpica/acpi_if.m		standard
 dev/wpi/if_wpi.c		optional wpi

==== //depot/projects/uart/conf/files.pc98#34 (text+ko) ====

@@ -130,7 +130,6 @@
 dev/snc/if_snc_pccard.c		optional snc pccard
 dev/speaker/spkr.c		optional speaker
 dev/syscons/apm/apm_saver.c	optional apm_saver apm
-dev/uart/uart_bus_cbus.c	optional uart isa
 dev/uart/uart_cpu_pc98.c	optional uart
 i386/bios/apm.c			optional apm
 #i386/i386/apic_vector.s		optional apic

==== //depot/projects/uart/conf/files.sparc64#23 (text+ko) ====

@@ -65,7 +65,6 @@
 dev/syscons/scgfbrndr.c		optional	sc
 dev/syscons/scterm-sc.c		optional	sc
 dev/syscons/scvtb.c		optional	sc
-dev/uart/uart_bus_isa.c		optional	uart isa
 dev/uart/uart_cpu_sparc64.c	optional	uart
 dev/uart/uart_kbd_sun.c		optional	uart sc
 kern/syscalls.c			optional	ktr

==== //depot/projects/uart/dev/uart/uart_bus_isa.c#9 (text+ko) ====

@@ -1,5 +1,7 @@
 /*-
- * Copyright (c) 2001 M. Warner Losh.  All rights reserved.
+ * Copyright (c) 2001 M. Warner Losh
+ * Copyright (c) 2008 TAKAHASHI Yoshihiro
+ * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -63,6 +65,7 @@
 	{0x1005d041, "Generic IRDA-compatible device"},	/* PNP0510 */
 	{0x1105d041, "Generic IRDA-compatible device"},	/* PNP0511 */
 	/* Devices that do not have a compatid */
+#ifndef PC98
 	{0x12206804, NULL},     /* ACH2012 - 5634BTS 56K Video Ready Modem */
 	{0x7602a904, NULL},	/* AEI0276 - 56K v.90 Fax Modem (LKT) */
 	{0x00007905, NULL},	/* AKY0000 - 56K Plug&Play Modem */
@@ -141,8 +144,30 @@
 	{0x0300695c, NULL},	/* WCI0003 - Fax/Voice/Modem/Speakphone/Asvd */
 	{0x01a0896a, NULL},	/* ZTIA001 - Zoom Internal V90 Faxmodem */
 	{0x61f7896a, NULL},	/* ZTIF761 - Zoom ComStar 33.6 */
+#else
+	{0x4180a3b8, NULL},     /* NEC8041 - PC-9821CB-B04 */
+	{0x0181a3b8, NULL},     /* NEC8101 - PC-9821CB2-B04 */
+	{0x5181a3b8, NULL},     /* NEC8151 - Internal FAX/Modem for Cx3, Cb3 */
+	{0x9181a3b8, NULL},     /* NEC8191 - PC-9801-120 */
+	{0xe181a3b8, NULL},     /* NEC81E1 - Internal FAX/Modem */
+	{0x1182a3b8, NULL},     /* NEC8211 - PC-9801-123 */
+	{0x3182a3b8, NULL},     /* NEC8231 - Internal FAX/Modem (Voice) */
+	{0x4182a3b8, NULL},     /* NEC8241 - PC-9821NR-B05 */
+	{0x5182a3b8, NULL},     /* NEC8251 - Internel FAX/Modem */
+	{0x7182a3b8, NULL},     /* NEC8271 - PC-9801-125 */
+	{0x11802fbf, NULL},     /* OYO8011 - Internal FAX/Modem (Ring) */
+#endif
+	{0}
+};
+
+#ifdef PC98
+extern struct uart_class *uart_pc98_getdev(u_long);
+
+static struct isa_pnp_id isa_i8251_ids[] = {
+	{0x0100e4a5, "RSA-98III"},
 	{0}
 };
+#endif
 
 static int
 uart_isa_probe(device_t dev)
@@ -159,8 +184,19 @@
 		return (uart_bus_probe(dev, 0, 0, 0, 0));
 	}
 
-	/* Add checks for non-ns8250 IDs here. */
+#ifndef PC98
 	return (ENXIO);
+#else
+	/* Probe PnP _and_ non-PnP i8251 here. */
+	if (ISA_PNP_PROBE(parent, dev, isa_i8251_ids) != ENXIO) {
+		sc->sc_class = &uart_i8251_class;
+		return (uart_bus_probe(dev, 0, 0, 0, 0));
+	}
+
+	sc->sc_class = uart_pc98_getdev(bus_get_resource_start(dev,
+	    SYS_RES_IOPORT, 0));
+	return (uart_bus_probe(dev, 0, 0, 0, 0));
+#endif
 }
 
 DRIVER_MODULE(uart, isa, uart_isa_driver, uart_devclass, 0, 0);

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

@@ -37,17 +37,29 @@
 #include <dev/uart/uart.h>
 #include <dev/uart/uart_cpu.h>
 
+bus_space_tag_t uart_bus_space_io = I386_BUS_SPACE_IO;
+bus_space_tag_t uart_bus_space_mem = I386_BUS_SPACE_MEM;
+
 static struct {
-	bus_addr_t iobase;
+	u_long iobase;
 	struct uart_class *class;
-} uart_cbus_devs[] = {
+} uart_pc98_devs[] = {
 	{ 0x30, &uart_i8251_class },
 	{ 0x238, &uart_ns8250_class },
 	{ 0, NULL }
 };
 
-bus_space_tag_t uart_bus_space_io = I386_BUS_SPACE_IO;
-bus_space_tag_t uart_bus_space_mem = I386_BUS_SPACE_MEM;
+struct uart_class *
+uart_pc98_getdev(u_long port)
+{
+	int i;
+
+	for (i = 0; uart_pc98_devs[i].iobase; i++) {
+		if (port == uart_pc98_devs[i].iobase)
+			return (uart_pc98_devs[i].class);
+	}
+	return (NULL);
+}
 
 int
 uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2)
@@ -63,7 +75,7 @@
 uart_cpu_getdev(int devtype, struct uart_devinfo *di)
 {
 	struct uart_class *class;
-	unsigned int i, j, ivar;
+	unsigned int i, ivar;
 
 	class = &uart_i8251_class;
 
@@ -94,13 +106,7 @@
 		    ivar == 0)
 			continue;
 
-		class = NULL;
-		for (j = 0; uart_cbus_devs[j].iobase; j++) {
-			if (ivar == uart_cbus_devs[j].iobase) {
-				class = uart_cbus_devs[j].class;
-				break;
-			}
-		}
+		class = uart_pc98_isa_dev(ivar);
 		if (class == NULL)
 			continue;
 


More information about the p4-projects mailing list