Date: Wed, 25 Dec 2002 16:06:36 -0800 (PST) From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 22745 for review Message-ID: <200212260006.gBQ06a9p050474@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=22745 Change 22745 by marcel@marcel_nfs on 2002/12/25 16:06:33 Add support to puc(4) for memory mapped communication devices. Introduce PUC_FLAGS_MEMORY for this purpose. While here, create PUC_FLAGS_FASTINTR to replace the non-abstracted use of INTR_FAST. The PUC_FLAGS_MEMORY bit controls the address resource type. By default it is still SYS_RES_IOPORT. The flag switches to SYS_RES_MEMORY. In sio_puc.c we check the flags using device_get_flags() and use the corresponding resource type. Add the HP Diva multi-port to the device table. It's a memory mapped multi-port card. Also, since sio(4) sets the device description when not already set, stop duplicating the puc(4) description to the containing sio(4) devices. The output is more sensible that way: \begin{example} : puc0: <Diva Serial [GSP] Multiport UART> mem 0xf8030000-0xf8030fff irq 82 at device 1.1 on pci224 sio0: <16950 or compatible> on puc0 sio1: <16950 or compatible> on puc0 sio2: <16950 or compatible> on puc0 : sio3: <16550 or compatible> iomem 0xff5e0000-0xff5e0007 irq 34 on acpi0 sio3: console sio4: <16550 or compatible> iomem 0xff5e2000-0xff5e2007 irq 35 on acpi0 : \end{example} There is at least one loose end: interrupts cannot not be activated for the UARTs under puc(4)... Affected files ... .. //depot/projects/ia64/sys/dev/puc/puc.c#9 edit .. //depot/projects/ia64/sys/dev/puc/pucdata.c#7 edit .. //depot/projects/ia64/sys/dev/puc/pucvar.h#6 edit .. //depot/projects/ia64/sys/dev/sio/sio_puc.c#8 edit .. //depot/projects/ia64/sys/ia64/conf/HP_RX2600#7 edit Differences ... ==== //depot/projects/ia64/sys/dev/puc/puc.c#9 (text+ko) ==== @@ -134,7 +134,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc) { char *typestr; - int bidx, childunit, i, irq_setup, rid; + int bidx, childunit, i, irq_setup, rid, type; struct puc_softc *sc; struct puc_device *pdev; struct resource *res; @@ -163,7 +163,7 @@ irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, INTR_TYPE_TTY | INTR_FAST, puc_intr, sc, &sc->intr_cookie); if (irq_setup == 0) - sc->fastintr = INTR_FAST; + sc->fastintr = PUC_FLAGS_FASTINTR; else irq_setup = BUS_SETUP_INTR(device_get_parent(dev), dev, res, INTR_TYPE_TTY, puc_intr, sc, &sc->intr_cookie); @@ -183,15 +183,21 @@ if (sc->sc_bar_mappings[bidx].res != NULL) continue; - res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, 1, RF_ACTIVE); + + type = (sc->sc_desc->ports[i].flags & PUC_FLAGS_MEMORY) + ? SYS_RES_MEMORY : SYS_RES_IOPORT; + + res = bus_alloc_resource(dev, type, &rid, 0ul, ~0ul, 1, + RF_ACTIVE); if (res == NULL) { printf("could not get resource\n"); continue; } + sc->sc_bar_mappings[bidx].type = type; sc->sc_bar_mappings[bidx].res = res; #ifdef PUC_DEBUG - printf("port rid %d bst %x, start %x, end %x\n", rid, + printf("%s rid %d bst %x, start %x, end %x\n", + (type == SYS_RES_MEMORY) ? "memory" : "port", rid, (u_int)rman_get_bustag(res), (u_int)rman_get_start(res), (u_int)rman_get_end(res)); #endif @@ -229,13 +235,14 @@ rle = resource_list_find(&pdev->resources, SYS_RES_IRQ, 0); rle->res = sc->irqres; - /* Now fake an IOPORT resource */ + /* Now fake an IOPORT or MEMORY resource */ res = sc->sc_bar_mappings[bidx].res; - resource_list_add(&pdev->resources, SYS_RES_IOPORT, 0, + type = sc->sc_bar_mappings[bidx].type; + resource_list_add(&pdev->resources, type, 0, rman_get_start(res) + sc->sc_desc->ports[i].offset, rman_get_start(res) + sc->sc_desc->ports[i].offset + 8 - 1, 8); - rle = resource_list_find(&pdev->resources, SYS_RES_IOPORT, 0); + rle = resource_list_find(&pdev->resources, type, 0); if (sc->barmuxed == 0) { rle->res = sc->sc_bar_mappings[bidx].res; @@ -264,15 +271,16 @@ if (sc->sc_ports[i].dev == NULL) { if (sc->barmuxed) { bus_space_unmap(rman_get_bustag(rle->res), - rman_get_bushandle(rle->res), - 8); + rman_get_bushandle(rle->res), 8); free(rle->res, M_DEVBUF); free(pdev, M_DEVBUF); } continue; } device_set_ivars(sc->sc_ports[i].dev, pdev); +#if 0 device_set_desc(sc->sc_ports[i].dev, sc->sc_desc->name); +#endif if (!bootverbose) device_quiet(sc->sc_ports[i].dev); #ifdef PUC_DEBUG @@ -463,7 +471,7 @@ struct puc_softc *sc; sc = (struct puc_softc *)device_get_softc(dev); - if ((flags & INTR_FAST) != sc->fastintr) + if ((flags & PUC_FLAGS_FASTINTR) != sc->fastintr) return (ENXIO); for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { if (sc->sc_ports[i].dev == child) { ==== //depot/projects/ia64/sys/dev/puc/pucdata.c#7 (text+ko) ==== @@ -49,6 +49,17 @@ const struct puc_device_description puc_devices[] = { + { "Diva Serial [GSP] Multiport UART", + NULL, + { 0x103c, 0x1048, 0x103c, 0x1282 }, + { 0xffff, 0xffff, 0xffff, 0xffff }, + { + { PUC_PORT_TYPE_COM, 0x10, 0x00, 0, PUC_FLAGS_MEMORY }, + { PUC_PORT_TYPE_COM, 0x10, 0x10, 0, PUC_FLAGS_MEMORY }, + { PUC_PORT_TYPE_COM, 0x10, 0x38, 0, PUC_FLAGS_MEMORY }, + }, + }, + { "Comtrol RocketPort 550/4 RJ45", NULL, { 0x11fe, 0x8014, 0, 0 }, ==== //depot/projects/ia64/sys/dev/puc/pucvar.h#6 (text+ko) ==== @@ -91,6 +91,9 @@ #define PUC_PORT_TYPE_COM 1 #define PUC_PORT_TYPE_LPT 2 +#define PUC_FLAGS_FASTINTR 0x0001 /* Use fast interrupts. */ +#define PUC_FLAGS_MEMORY 0x0002 /* Use memory mapped I/O. */ + #define PUC_PORT_VALID(desc, port) \ ((port) < PUC_MAX_PORTS && (desc)->ports[(port)].type != PUC_PORT_TYPE_NONE) @@ -128,6 +131,7 @@ struct { int used; int bar; + int type; /* SYS_RES_IOPORT or SYS_RES_MEMORY. */ struct resource *res; } sc_bar_mappings[PUC_MAX_BAR]; ==== //depot/projects/ia64/sys/dev/sio/sio_puc.c#8 (text+ko) ==== @@ -68,14 +68,17 @@ { struct com_s *com; uintptr_t rclk; + int flags; #ifdef PC98 SET_FLAG(dev, SET_IFTYPE(COM_IF_NS16550)); #endif + flags = device_get_flags(dev); com = device_get_softc(dev); com->addr_rid = 0; - com->addr_type = SYS_RES_IOPORT; + com->addr_type = (flags & PUC_FLAGS_MEMORY) + ? SYS_RES_MEMORY : SYS_RES_IOPORT; com->addr_res = bus_alloc_resource(dev, com->addr_type, &com->addr_rid, 0, ~0, 8, RF_ACTIVE); if (com->addr_res == NULL) ==== //depot/projects/ia64/sys/ia64/conf/HP_RX2600#7 (text+ko) ==== @@ -46,6 +46,7 @@ device pass device pci device pty +device puc device random device sc device scbus To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212260006.gBQ06a9p050474>
