diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-07-23 19:35:33 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2009-07-23 19:35:33 +0000 |
commit | ca81712dbfbe6c293caaa74e926ac94f4ca13721 (patch) | |
tree | 3c380a76bb1509e6faea1e99c5d0ac17ff310f99 /sys/dev/pci/if_cas.c | |
parent | 3aa3a7140af850f9a306cf0e49c5f428073747fa (diff) |
Use pci_mapreg_map() to map ROM.
Diffstat (limited to 'sys/dev/pci/if_cas.c')
-rw-r--r-- | sys/dev/pci/if_cas.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/sys/dev/pci/if_cas.c b/sys/dev/pci/if_cas.c index 6baf4d8d563..019c9bc3591 100644 --- a/sys/dev/pci/if_cas.c +++ b/sys/dev/pci/if_cas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_cas.c,v 1.26 2009/06/13 12:18:57 kettenis Exp $ */ +/* $OpenBSD: if_cas.c,v 1.27 2009/07/23 19:35:32 kettenis Exp $ */ /* * @@ -189,25 +189,20 @@ cas_pci_enaddr(struct cas_softc *sc, struct pci_attach_args *pa) struct pci_vpd *vpd; bus_space_handle_t romh; bus_space_tag_t romt; - bus_size_t romsize; + bus_size_t romsize = 0; u_int8_t buf[32], *desc; - pcireg_t address, mask; + pcireg_t address; int dataoff, vpdoff, len; int rv = -1; + if (pci_mapreg_map(pa, PCI_ROM_REG, PCI_MAPREG_TYPE_MEM, 0, + &romt, &romh, 0, &romsize, 0)) + return (-1); + address = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ROM_REG); - pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_ROM_REG, 0xfffffffe); - mask = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_ROM_REG); address |= PCI_ROM_ENABLE; pci_conf_write(pa->pa_pc, pa->pa_tag, PCI_ROM_REG, address); - romt = pa->pa_memt; - romsize = PCI_ROM_SIZE(mask); - if (bus_space_map(romt, PCI_ROM_ADDR(address), romsize, 0, &romh)) { - romsize = 0; - goto fail; - } - bus_space_read_region_1(romt, romh, 0, buf, sizeof(buf)); if (bcmp(buf, cas_promhdr, sizeof(cas_promhdr))) goto fail; |