puc.c (150549) | puc.c (150698) |
---|---|
1/* $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ */ 2 3/*- 4 * Copyright (c) 2002 JF Hay. All rights reserved. 5 * Copyright (c) 2000 M. Warner Losh. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 */ 59 60#include <sys/cdefs.h> | 1/* $NetBSD: puc.c,v 1.7 2000/07/29 17:43:38 jlam Exp $ */ 2 3/*- 4 * Copyright (c) 2002 JF Hay. All rights reserved. 5 * Copyright (c) 2000 M. Warner Losh. All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 44 unchanged lines hidden (view full) --- 53 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 54 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 55 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 56 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 57 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 58 */ 59 60#include <sys/cdefs.h> |
61__FBSDID("$FreeBSD: head/sys/dev/puc/puc.c 150549 2005-09-25 20:21:14Z phk $"); | 61__FBSDID("$FreeBSD: head/sys/dev/puc/puc.c 150698 2005-09-28 18:06:25Z phk $"); |
62 63/* 64 * PCI "universal" communication card device driver, glues com, lpt, 65 * and similar ports to PCI via bridge chip often much larger than 66 * the devices being glued. 67 * 68 * Author: Christopher G. Demetriou, May 14, 1998 (derived from NetBSD 69 * sys/dev/pci/pciide.c, revision 1.6). --- 241 unchanged lines hidden (view full) --- 311 rman_get_start(res) + sc->sc_desc.ports[i].offset, 312 rman_get_start(res) + sc->sc_desc.ports[i].offset 313 + ressz - 1, ressz); 314 rle = resource_list_find(&pdev->resources, type, 0); 315 316 if (sc->barmuxed == 0) { 317 rle->res = sc->sc_bar_mappings[bidx].res; 318 } else { | 62 63/* 64 * PCI "universal" communication card device driver, glues com, lpt, 65 * and similar ports to PCI via bridge chip often much larger than 66 * the devices being glued. 67 * 68 * Author: Christopher G. Demetriou, May 14, 1998 (derived from NetBSD 69 * sys/dev/pci/pciide.c, revision 1.6). --- 241 unchanged lines hidden (view full) --- 311 rman_get_start(res) + sc->sc_desc.ports[i].offset, 312 rman_get_start(res) + sc->sc_desc.ports[i].offset 313 + ressz - 1, ressz); 314 rle = resource_list_find(&pdev->resources, type, 0); 315 316 if (sc->barmuxed == 0) { 317 rle->res = sc->sc_bar_mappings[bidx].res; 318 } else { |
319 rle->res = malloc(sizeof(struct resource), M_DEVBUF, 320 M_WAITOK | M_ZERO); | 319 rle->res = rman_secret_puc_alloc_resource(M_WAITOK); |
321 if (rle->res == NULL) { 322 free(pdev, M_DEVBUF); 323 return (ENOMEM); 324 } 325 326 rman_set_start(rle->res, rman_get_start(res) + 327 sc->sc_desc.ports[i].offset); 328 rman_set_end(rle->res, rman_get_start(rle->res) + --- 18 unchanged lines hidden (view full) --- 347 childunit = puc_find_free_unit(typestr); 348 } 349 sc->sc_ports[i].dev = device_add_child(dev, typestr, 350 childunit); 351 if (sc->sc_ports[i].dev == NULL) { 352 if (sc->barmuxed) { 353 bus_space_unmap(rman_get_bustag(rle->res), 354 rman_get_bushandle(rle->res), ressz); | 320 if (rle->res == NULL) { 321 free(pdev, M_DEVBUF); 322 return (ENOMEM); 323 } 324 325 rman_set_start(rle->res, rman_get_start(res) + 326 sc->sc_desc.ports[i].offset); 327 rman_set_end(rle->res, rman_get_start(rle->res) + --- 18 unchanged lines hidden (view full) --- 346 childunit = puc_find_free_unit(typestr); 347 } 348 sc->sc_ports[i].dev = device_add_child(dev, typestr, 349 childunit); 350 if (sc->sc_ports[i].dev == NULL) { 351 if (sc->barmuxed) { 352 bus_space_unmap(rman_get_bustag(rle->res), 353 rman_get_bushandle(rle->res), ressz); |
355 free(rle->res, M_DEVBUF); | 354 rman_secret_puc_free_resource(rle->res); |
356 free(pdev, M_DEVBUF); 357 } 358 continue; 359 } 360 device_set_ivars(sc->sc_ports[i].dev, pdev); 361 device_set_desc(sc->sc_ports[i].dev, sc->sc_desc.name); 362#ifdef PUC_DEBUG 363 printf("puc: type %d, bar %x, offset %x\n", 364 sc->sc_desc.ports[i].type, 365 sc->sc_desc.ports[i].bar, 366 sc->sc_desc.ports[i].offset); 367 puc_print_resource_list(&pdev->resources); 368#endif 369 device_set_flags(sc->sc_ports[i].dev, 370 sc->sc_desc.ports[i].flags); 371 if (device_probe_and_attach(sc->sc_ports[i].dev) != 0) { 372 if (sc->barmuxed) { 373 bus_space_unmap(rman_get_bustag(rle->res), 374 rman_get_bushandle(rle->res), ressz); | 355 free(pdev, M_DEVBUF); 356 } 357 continue; 358 } 359 device_set_ivars(sc->sc_ports[i].dev, pdev); 360 device_set_desc(sc->sc_ports[i].dev, sc->sc_desc.name); 361#ifdef PUC_DEBUG 362 printf("puc: type %d, bar %x, offset %x\n", 363 sc->sc_desc.ports[i].type, 364 sc->sc_desc.ports[i].bar, 365 sc->sc_desc.ports[i].offset); 366 puc_print_resource_list(&pdev->resources); 367#endif 368 device_set_flags(sc->sc_ports[i].dev, 369 sc->sc_desc.ports[i].flags); 370 if (device_probe_and_attach(sc->sc_ports[i].dev) != 0) { 371 if (sc->barmuxed) { 372 bus_space_unmap(rman_get_bustag(rle->res), 373 rman_get_bushandle(rle->res), ressz); |
375 free(rle->res, M_DEVBUF); | 374 rman_secret_puc_free_resource(rle->res); |
376 free(pdev, M_DEVBUF); 377 } 378 } 379 } 380 381#ifdef PUC_DEBUG 382 bootverbose = 0; 383#endif --- 236 unchanged lines hidden --- | 375 free(pdev, M_DEVBUF); 376 } 377 } 378 } 379 380#ifdef PUC_DEBUG 381 bootverbose = 0; 382#endif --- 236 unchanged lines hidden --- |