diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-08-11 07:35:40 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2003-08-11 07:35:40 +0000 |
commit | 54ea4fafc286b878b110b3c4c7b87e0d5d313a25 (patch) | |
tree | 98d7fde1a0e9fb1460a62868ba3bcfa21741fa6e /sys/arch/hppa/dev | |
parent | 5204e0e775b2346dd8105c402b610e7f13c718cd (diff) |
during probe there is no need to map the whole hpa space. only rom is needed. also do not map too much of rom
Diffstat (limited to 'sys/arch/hppa/dev')
-rw-r--r-- | sys/arch/hppa/dev/sti_sgc.c | 44 |
1 files changed, 15 insertions, 29 deletions
diff --git a/sys/arch/hppa/dev/sti_sgc.c b/sys/arch/hppa/dev/sti_sgc.c index 0eac66d7a25..b4c4d724862 100644 --- a/sys/arch/hppa/dev/sti_sgc.c +++ b/sys/arch/hppa/dev/sti_sgc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sti_sgc.c,v 1.14 2003/07/16 06:42:06 mickey Exp $ */ +/* $OpenBSD: sti_sgc.c,v 1.15 2003/08/11 07:35:39 mickey Exp $ */ /* * Copyright (c) 2000-2003 Michael Shalayeff @@ -56,7 +56,7 @@ #include <hppa/dev/cpudevs.h> #define STI_MEMSIZE 0x2000000 -#define STI_ROMSIZE 0x30000 +#define STI_ROMSIZE 0x8000 #define STI_ID_FDDI 0x280b31af /* Medusa FDDI ROM id */ #define STI_INEG_REV 0x60 @@ -100,7 +100,7 @@ sti_sgc_probe(parent, match, aux) void *match, *aux; { struct confargs *ca = aux; - bus_space_handle_t ioh, romh; + bus_space_handle_t romh; paddr_t rom; u_int32_t id; u_char devtype; @@ -117,26 +117,13 @@ sti_sgc_probe(parent, match, aux) if (ca->ca_type.iodc_sv_model != HPPA_FIO_SGC) return 0; - if ((rv = bus_space_map(ca->ca_iot, ca->ca_hpa, STI_MEMSIZE, 0, &ioh))) { -#ifdef STIDEBUG - printf("st: cannot map io space (%d)\n", rv); -#endif - return 0; - } - rom = sti_sgc_getrom(ca); #ifdef STIDEBUG printf ("sti: hpa=%x, rom=%x\n", ca->ca_hpa, rom); #endif - if (rom == ca->ca_hpa) { - romh = ioh; - romunmapped++; - } - /* if it does not map, probably part of the lasi space */ - if (rom != ca->ca_hpa && - (rv = bus_space_map(ca->ca_iot, rom, IOMOD_HPASIZE, 0, &romh))) { + if ((rv = bus_space_map(ca->ca_iot, rom, STI_ROMSIZE, 0, &romh))) { #ifdef STIDEBUG printf ("sti: cannot map rom space (%d)\n", rv); #endif @@ -145,13 +132,12 @@ sti_sgc_probe(parent, match, aux) romunmapped++; } else { /* in this case i have no freaking idea */ - bus_space_unmap(ca->ca_iot, ioh, STI_MEMSIZE); return 0; } } #ifdef STIDEBUG - printf("sti: ioh=%x, romh=%x\n", ioh, romh); + printf("sti: romh=%x\n", romh); #endif devtype = bus_space_read_1(ca->ca_iot, romh, 3); @@ -178,16 +164,16 @@ sti_sgc_probe(parent, match, aux) rv = 0; } - if (ca->ca_type.iodc_sv_model == HPPA_FIO_SGC && id == STI_ID_FDDI) { + if (rv && + ca->ca_type.iodc_sv_model == HPPA_FIO_SGC && id == STI_ID_FDDI) { #ifdef STIDEBUG printf("sti: not a graphics device\n"); #endif rv = 0; } - bus_space_unmap(ca->ca_iot, ioh, STI_MEMSIZE); if (!romunmapped) - bus_space_unmap(ca->ca_iot, romh, IOMOD_HPASIZE); + bus_space_unmap(ca->ca_iot, romh, STI_ROMSIZE); return (rv); } @@ -198,13 +184,13 @@ sti_sgc_attach(parent, self, aux) { struct sti_softc *sc = (void *)self; struct confargs *ca = aux; - paddr_t addr; + paddr_t rom; int rv; - addr = sti_sgc_getrom(ca); + rom = sti_sgc_getrom(ca); #ifdef STIDEBUG - printf("sti: hpa=%x, rom=%x\n", ca->ca_hpa, addr); + printf("sti: hpa=%x, rom=%x\n", ca->ca_hpa, rom); #endif sc->memt = sc->iot = ca->ca_iot; @@ -217,11 +203,11 @@ sti_sgc_attach(parent, self, aux) } /* if it does not map, probably part of the lasi space */ - if (addr == ca->ca_hpa) + if (rom == ca->ca_hpa) sc->romh = sc->ioh; - else if ((rv = bus_space_map(ca->ca_iot, addr, STI_ROMSIZE, 0, &sc->romh))) { - if ((addr & HPPA_IOBEGIN) == HPPA_IOBEGIN) - sc->romh = addr; + else if ((rv = bus_space_map(ca->ca_iot, rom, STI_ROMSIZE, 0, &sc->romh))) { + if ((rom & HPPA_IOBEGIN) == HPPA_IOBEGIN) + sc->romh = rom; else { #ifdef STIDEBUG printf (": cannot map rom space (%d)\n", rv); |