Date: Sat, 5 Jul 2008 17:50:13 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 144728 for review Message-ID: <200807051750.m65HoDv6054271@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=144728 Change 144728 by marcel@marcel_xcllnt on 2008/07/05 17:49:53 Add basic PC98 (infrastructure) support. Submitted by: nyan Affected files ... .. //depot/projects/uart/conf/files#88 edit .. //depot/projects/uart/conf/files.amd64#34 edit .. //depot/projects/uart/conf/files.i386#40 edit .. //depot/projects/uart/conf/files.pc98#33 edit .. //depot/projects/uart/conf/files.sparc64#22 edit .. //depot/projects/uart/dev/uart/uart_bus_cbus.c#1 add .. //depot/projects/uart/dev/uart/uart_cpu_pc98.c#16 edit Differences ... ==== //depot/projects/uart/conf/files#88 (text+ko) ==== @@ -1252,9 +1252,7 @@ dev/tx/if_tx.c optional tx dev/txp/if_txp.c optional txp dev/uart/uart_bus_acpi.c optional uart acpi -#dev/uart/uart_bus_cbus.c optional uart cbus 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#34 (text+ko) ==== @@ -205,6 +205,7 @@ 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#40 (text+ko) ==== @@ -224,6 +224,7 @@ 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#33 (text+ko) ==== @@ -130,6 +130,7 @@ 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#22 (text+ko) ==== @@ -65,6 +65,7 @@ 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_cpu_pc98.c#16 (text+ko) ==== @@ -1,4 +1,5 @@ /*- + * Copyright (c) 2008 TAKAHASHI Yoshihiro * Copyright (c) 2003 M. Warner Losh, Marcel Moolenaar * All rights reserved. * @@ -36,6 +37,17 @@ #include <dev/uart/uart.h> #include <dev/uart/uart_cpu.h> +static struct { + bus_addr_t iobase; + struct uart_class *class; +} uart_cbus_devs[] = { +#ifdef notyet + { 0x30, &uart_i8251_class }, +#endif + { 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; @@ -43,16 +55,19 @@ uart_cpu_eqres(struct uart_bas *b1, struct uart_bas *b2) { - return (0); /* XXX */ + if (i386_memio_compare(b1->bst, b1->bsh, b2->bst, b2->bsh) == 0) + return (1); + + return (0); } int uart_cpu_getdev(int devtype, struct uart_devinfo *di) { struct uart_class *class; - unsigned int i, ivar, flags; + unsigned int i, j, ivar; - class = &uart_ns8250_class; + class = &uart_ns8250_class; /* currently ns8250 only */ if (class == NULL) return (ENXIO); @@ -63,16 +78,14 @@ /* * There is a serial port on all pc98 hardware. It is 8251 or * an enhance version of that. Some pc98 have the second serial - * port which is 16550A compatible. However, for the sio driver, - * flags selected which type of uart was in the sytem. We use - * something similar to sort things out. + * port which is 16550A compatible. */ - for (i = 0; i < 1; i++) { - if (resource_int_value("uart", i, "flags", &flags)) + for (i = 0; i < 2; i++) { + if (resource_int_value("uart", i, "flags", &ivar)) continue; - if (devtype == UART_DEV_CONSOLE && !UART_FLAGS_CONSOLE(flags)) + if (devtype == UART_DEV_CONSOLE && !UART_FLAGS_CONSOLE(ivar)) continue; - if (devtype == UART_DEV_DBGPORT && !UART_FLAGS_DBGPORT(flags)) + if (devtype == UART_DEV_DBGPORT && !UART_FLAGS_DBGPORT(ivar)) continue; /* * We have a possible device. Make sure it's enabled and @@ -85,6 +98,16 @@ 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; + } + } + if (class == NULL) + continue; + di->ops = uart_getops(class); di->bas.chan = 0; di->bas.bst = uart_bus_space_io;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807051750.m65HoDv6054271>