From owner-p4-projects Sun Dec 22 11:15:51 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 68FBD37B405; Sun, 22 Dec 2002 11:15:47 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 121E237B401 for ; Sun, 22 Dec 2002 11:15:47 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6697B43EE8 for ; Sun, 22 Dec 2002 11:15:46 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gBMJFkfh009599 for ; Sun, 22 Dec 2002 11:15:46 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gBMJFjoA009596 for perforce@freebsd.org; Sun, 22 Dec 2002 11:15:45 -0800 (PST) Date: Sun, 22 Dec 2002 11:15:45 -0800 (PST) Message-Id: <200212221915.gBMJFjoA009596@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 22624 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=22624 Change 22624 by marcel@marcel_nfs on 2002/12/22 11:15:02 Convert sio_isa.c to the new sioprobe/sioattach interface. Leak a debbuging function in here as well, because we now do probe the ACPI listed memory mapped UARTS, we just have to grab the resources so that we can allocate them. Affected files ... .. //depot/projects/ia64/sys/dev/sio/sio_isa.c#9 edit Differences ... ==== //depot/projects/ia64/sys/dev/sio/sio_isa.c#9 (text+ko) ==== @@ -33,9 +33,13 @@ #include #include #include +#include #include + #include -#include +#include + +#include #include @@ -49,14 +53,13 @@ /* Device interface */ DEVMETHOD(device_probe, sio_isa_probe), DEVMETHOD(device_attach, sio_isa_attach), - { 0, 0 } }; static driver_t sio_isa_driver = { sio_driver_name, sio_isa_methods, - 0, + sizeof(struct com_s), }; static struct isa_pnp_id sio_ids[] = { @@ -144,21 +147,69 @@ {0} }; +static struct resource * +sio_isa_alloc(device_t dev, int *sp, int *rid) +{ + struct resource *res; + + *rid = 0; + *sp = SYS_RES_IOPORT; + device_printf(dev, "trying I/O port\n"); + res = bus_alloc_resource(dev, *sp, rid, 0, ~0, 8, RF_ACTIVE); + if (res == NULL) { + device_printf(dev, "trying memory mapped\n"); + *rid = 0; + *sp = SYS_RES_MEMORY; + res = bus_alloc_resource(dev, *sp, rid, 0, ~0, 8, RF_ACTIVE); + if (res == NULL) { + device_printf(dev, "Bollocks!\n"); + return (NULL); + } + } + + return (res); +} + static int -sio_isa_probe(dev) - device_t dev; +sio_isa_probe(device_t dev) { + struct com_s *com; + struct resource *res; + int error, rid, space; + /* Check isapnp ids */ if (ISA_PNP_PROBE(device_get_parent(dev), dev, sio_ids) == ENXIO) return (ENXIO); - return (sioprobe(dev, 0, 0UL, 0)); + + com = device_get_softc(dev); + res = sio_isa_alloc(dev, &space, &rid); + if (res == NULL) + return (0); + com->bsh = rman_get_bushandle(res); + com->bst = rman_get_bustag(res); + error = sioprobe(dev); + bus_release_resource(dev, space, rid, res); + return (error); } static int sio_isa_attach(dev) device_t dev; { - return (sioattach(dev, 0, 0UL)); + struct com_s *com; + struct resource *res; + int error, rid, space; + + com = device_get_softc(dev); + res = sio_isa_alloc(dev, &space, &rid); + if (res == NULL) + return (ENXIO); + com->bsh = rman_get_bushandle(res); + com->bst = rman_get_bustag(res); + error = sioattach(dev); + if (error) + bus_release_resource(dev, space, rid, res); + return (error); } DRIVER_MODULE(sio, isa, sio_isa_driver, sio_devclass, 0, 0); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message