use pci_map_register().

This commit is contained in:
cgd 1997-04-13 19:47:06 +00:00
parent 2eae910210
commit 02ca6f929d
4 changed files with 24 additions and 45 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bha_pci.c,v 1.10 1997/03/28 23:47:16 mycroft Exp $ */
/* $NetBSD: bha_pci.c,v 1.11 1997/04/13 19:47:06 cgd Exp $ */
/*
* Copyright (c) 1994, 1996, 1997 Charles M. Hannum. All rights reserved.
@ -75,11 +75,9 @@ bha_pci_match(parent, match, aux)
void *aux;
{
struct pci_attach_args *pa = aux;
bus_space_tag_t iot = pa->pa_iot;
bus_addr_t iobase;
bus_size_t iosize;
bus_space_tag_t iot;
bus_space_handle_t ioh;
pci_chipset_tag_t pc = pa->pa_pc;
bus_size_t iosize;
int rv;
if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_BUSLOGIC)
@ -89,9 +87,8 @@ bha_pci_match(parent, match, aux)
PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_BUSLOGIC_MULTIMASTER)
return (0);
if (pci_io_find(pc, pa->pa_tag, PCI_CBIO, &iobase, &iosize))
return (0);
if (bus_space_map(iot, iobase, iosize, 0, &ioh))
if (pci_map_register(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh,
NULL, &iosize))
return (0);
rv = bha_find(iot, ioh, NULL);
@ -111,9 +108,7 @@ bha_pci_attach(parent, self, aux)
{
struct pci_attach_args *pa = aux;
struct bha_softc *sc = (void *)self;
bus_space_tag_t iot = pa->pa_iot;
bus_addr_t iobase;
bus_size_t iosize;
bus_space_tag_t iot;
bus_space_handle_t ioh;
struct bha_probe_data bpd;
pci_chipset_tag_t pc = pa->pa_pc;
@ -129,10 +124,12 @@ bha_pci_attach(parent, self, aux)
model = "unknown model!";
printf(": %s\n", model);
if (pci_io_find(pc, pa->pa_tag, PCI_CBIO, &iobase, &iosize))
panic("bha_pci_attach: pci_io_find failed");
if (bus_space_map(iot, iobase, iosize, 0, &ioh))
panic("bha_pci_attach: bus_space_map failed");
if (pci_map_register(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh,
NULL, NULL)) {
printf("%s: unable to map device registers\n",
sc->sc_dev.dv_xname);
return;
}
sc->sc_iot = iot;
sc->sc_ioh = ioh;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_en_pci.c,v 1.7 1997/03/20 21:30:46 chuck Exp $ */
/* $NetBSD: if_en_pci.c,v 1.8 1997/04/13 19:47:07 cgd Exp $ */
/*
*
@ -199,14 +199,12 @@ void *aux;
struct en_softc *sc = (void *)self;
struct en_pci_softc *scp = (void *)self;
struct pci_attach_args *pa = aux;
bus_addr_t membase;
pci_intr_handle_t ih;
const char *intrstr;
int retval;
printf("\n");
sc->en_memt = pa->pa_memt;
sc->is_adaptec = (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_ADP) ? 1 : 0;
scp->en_pc = pa->pa_pc;
@ -235,17 +233,14 @@ void *aux;
* memory map
*/
retval = pci_mem_find(scp->en_pc, pa->pa_tag, PCI_CBMA,
&membase, &sc->en_obmemsz, NULL);
if (retval == 0)
retval = bus_space_map(sc->en_memt, membase, sc->en_obmemsz, 0,
&sc->en_base);
retval = pci_map_register(pa, PCI_CBMA,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT, 0,
&sc->en_memt, &sc->en_base, NULL, &sc->en_obmemsz);
if (retval) {
printf("%s: couldn't map memory\n", sc->sc_dev.dv_xname);
return;
}
/*
* set up pci bridge
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ep_pci.c,v 1.21 1997/03/30 22:47:09 jonathan Exp $ */
/* $NetBSD: if_ep_pci.c,v 1.22 1997/04/13 19:47:08 cgd Exp $ */
/*
* Copyright (c) 1997 Jonathan Stone <jonathan@NetBSD.org>
@ -137,24 +137,16 @@ ep_pci_attach(parent, self, aux)
struct ep_softc *sc = (void *)self;
struct pci_attach_args *pa = aux;
pci_chipset_tag_t pc = pa->pa_pc;
bus_space_tag_t iot = pa->pa_iot;
bus_addr_t iobase;
bus_size_t iosize;
pci_intr_handle_t ih;
char *model;
const char *intrstr = NULL;
if (pci_io_find(pc, pa->pa_tag, PCI_CBIO, &iobase, &iosize)) {
printf(": can't find i/o space\n");
return;
}
if (bus_space_map(iot, iobase, iosize, 0, &sc->sc_ioh)) {
if (pci_map_register(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
&sc->sc_iot, &sc->sc_ioh, NULL, NULL)) {
printf(": can't map i/o space\n");
return;
}
sc->sc_iot = iot;
sc->bustype = EP_BUS_PCI;
switch (PCI_PRODUCT(pa->pa_id)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_le_pci.c,v 1.16 1997/03/17 03:19:10 thorpej Exp $ */
/* $NetBSD: if_le_pci.c,v 1.17 1997/04/13 19:47:09 cgd Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -162,10 +162,8 @@ le_pci_attach(parent, self, aux)
struct am7990_softc *sc = &lesc->sc_am7990;
struct pci_attach_args *pa = aux;
pci_intr_handle_t ih;
bus_addr_t iobase;
bus_size_t iosize;
bus_space_tag_t iot;
bus_space_handle_t ioh;
bus_space_tag_t iot = pa->pa_iot;
pci_chipset_tag_t pc = pa->pa_pc;
pcireg_t csr;
int i;
@ -184,11 +182,8 @@ le_pci_attach(parent, self, aux)
printf(": %s\n", model);
if (pci_io_find(pc, pa->pa_tag, PCI_CBIO, &iobase, &iosize)) {
printf("%s: can't find I/O base\n", sc->sc_dev.dv_xname);
return;
}
if (bus_space_map(iot, iobase, iosize, 0, &ioh)) {
if (pci_map_register(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
&iot, &ioh, NULL, NULL)) {
printf("%s: can't map I/O space\n", sc->sc_dev.dv_xname);
return;
}