From f61bdee8e7d2163e089591bef8590095c55d0ca1 Mon Sep 17 00:00:00 2001 From: pk Date: Mon, 11 Mar 2002 16:00:55 +0000 Subject: [PATCH] Get rid of `bus_type_t' and use BUS_ADDR() (in sbus_bus_map()) to construct a `bus_addr_t' to pass on to bus_space_map(). Drop `va' argument from sbus_bus_map(); it should not be used by MI Sbus drivers. --- sys/dev/sbus/be.c | 31 ++++++++++++---------- sys/dev/sbus/bpp.c | 13 ++++------ sys/dev/sbus/bwtwo_sbus.c | 14 +++++----- sys/dev/sbus/cgsix_sbus.c | 41 ++++++++++++++--------------- sys/dev/sbus/cgthree_sbus.c | 19 ++++++-------- sys/dev/sbus/cs4231_sbus.c | 12 ++++----- sys/dev/sbus/dma_sbus.c | 11 ++++---- sys/dev/sbus/esp_sbus.c | 35 ++++++++++--------------- sys/dev/sbus/if_en.c | 9 ++++--- sys/dev/sbus/if_hme_sbus.c | 34 ++++++++++++------------ sys/dev/sbus/if_le.c | 7 +++-- sys/dev/sbus/if_le_lebuffer.c | 15 +++++------ sys/dev/sbus/if_le_ledma.c | 15 +++++------ sys/dev/sbus/isp_sbus.c | 10 +++---- sys/dev/sbus/lebuffer.c | 11 ++++---- sys/dev/sbus/magma.c | 11 +++----- sys/dev/sbus/p9100.c | 49 +++++++++++++++++------------------ sys/dev/sbus/qe.c | 22 +++++++++------- sys/dev/sbus/qec.c | 31 ++++++++++------------ sys/dev/sbus/sbusvar.h | 14 +++++++--- sys/dev/sbus/sio16.c | 12 ++++----- sys/dev/sbus/stp4020.c | 7 +++-- sys/dev/sbus/tcx.c | 24 +++++++---------- 23 files changed, 213 insertions(+), 234 deletions(-) diff --git a/sys/dev/sbus/be.c b/sys/dev/sbus/be.c index ec2e28fe0baa..809e7104c5ef 100644 --- a/sys/dev/sbus/be.c +++ b/sys/dev/sbus/be.c @@ -1,4 +1,4 @@ -/* $NetBSD: be.c,v 1.29 2001/11/13 06:58:16 lukem Exp $ */ +/* $NetBSD: be.c,v 1.30 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.29 2001/11/13 06:58:16 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.30 2002/03/11 16:00:55 pk Exp $"); #include "opt_ddb.h" #include "opt_inet.h" @@ -257,29 +257,32 @@ beattach(parent, self, aux) return; } - if (bus_space_map2(sa->sa_bustag, - (bus_type_t)sa->sa_reg[0].sbr_slot, - (bus_addr_t)sa->sa_reg[0].sbr_offset, + if (bus_space_map(sa->sa_bustag, + (bus_addr_t)BUS_ADDR( + sa->sa_reg[0].sbr_slot, + sa->sa_reg[0].sbr_offset), (bus_size_t)sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_cr) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_cr) != 0) { printf("beattach: cannot map registers\n"); return; } - if (bus_space_map2(sa->sa_bustag, - (bus_type_t)sa->sa_reg[1].sbr_slot, - (bus_addr_t)sa->sa_reg[1].sbr_offset, + if (bus_space_map(sa->sa_bustag, + (bus_addr_t)BUS_ADDR( + sa->sa_reg[1].sbr_slot, + sa->sa_reg[1].sbr_offset), (bus_size_t)sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_br) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_br) != 0) { printf("beattach: cannot map registers\n"); return; } - if (bus_space_map2(sa->sa_bustag, - (bus_type_t)sa->sa_reg[2].sbr_slot, - (bus_addr_t)sa->sa_reg[2].sbr_offset, + if (bus_space_map(sa->sa_bustag, + (bus_addr_t)BUS_ADDR( + sa->sa_reg[2].sbr_slot, + sa->sa_reg[2].sbr_offset), (bus_size_t)sa->sa_reg[2].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_tr) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_tr) != 0) { printf("beattach: cannot map registers\n"); return; } diff --git a/sys/dev/sbus/bpp.c b/sys/dev/sbus/bpp.c index 95ef5be5ce78..8d3bb785f0b4 100644 --- a/sys/dev/sbus/bpp.c +++ b/sys/dev/sbus/bpp.c @@ -1,4 +1,4 @@ -/* $NetBSD: bpp.c,v 1.10 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: bpp.c,v 1.11 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.10 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bpp.c,v 1.11 2002/03/11 16:00:55 pk Exp $"); #include #include @@ -155,12 +155,9 @@ bppattach(parent, self, aux) node = sa->sa_node; /* Map device registers */ - if (bus_space_map2(sa->sa_bustag, - sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &sc->sc_regs) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &sc->sc_regs) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/bwtwo_sbus.c b/sys/dev/sbus/bwtwo_sbus.c index 2cada2bdaf83..dc2b210129fa 100644 --- a/sys/dev/sbus/bwtwo_sbus.c +++ b/sys/dev/sbus/bwtwo_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: bwtwo_sbus.c,v 1.5 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: bwtwo_sbus.c,v 1.6 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.5 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bwtwo_sbus.c,v 1.6 2002/03/11 16:00:55 pk Exp $"); #include #include @@ -166,7 +166,6 @@ bwtwoattach_sbus(parent, self, args) /* Remember cookies for bwtwo_mmap() */ sc->sc_bustag = sa->sa_bustag; - sc->sc_btype = (bus_type_t)sa->sa_slot; /* Should be deprecated */ sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset); fb->fb_flags = sc->sc_dev.dv_cfdata->cf_flags; @@ -179,11 +178,11 @@ bwtwoattach_sbus(parent, self, args) * registers ourselves. We only need the video RAM if we are * going to print characters via rconsole. */ - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + BWREG_REG, sizeof(struct fbcontrol), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map control registers\n", self->dv_xname); return; } @@ -206,8 +205,7 @@ bwtwoattach_sbus(parent, self, args) if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, sa->sa_offset + sc->sc_pixeloffset, ramsize, - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map pixels\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/cgsix_sbus.c b/sys/dev/sbus/cgsix_sbus.c index ca912bace636..ca4cbffbbc50 100644 --- a/sys/dev/sbus/cgsix_sbus.c +++ b/sys/dev/sbus/cgsix_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgsix_sbus.c,v 1.6 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: cgsix_sbus.c,v 1.7 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.6 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgsix_sbus.c,v 1.7 2002/03/11 16:00:55 pk Exp $"); #include #include @@ -118,7 +118,6 @@ cgsixattach(parent, self, aux) /* Remember cookies for cgsix_mmap() */ sc->sc_bustag = sa->sa_bustag; - sc->sc_btype = (bus_type_t)sa->sa_slot; /* Should be deprecated */ sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset); node = sa->sa_node; @@ -135,51 +134,51 @@ cgsixattach(parent, self, aux) * the video RAM mapped. Just map what we care about for ourselves * (the FHC, THC, and Brooktree registers). */ - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_BT_OFFSET, sizeof(*sc->sc_bt), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map brooktree registers\n", self->dv_xname); return; } sc->sc_bt = (struct bt_regs *)(u_long)bh; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_FHC_OFFSET, sizeof(*sc->sc_fhc), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map FHC registers\n", self->dv_xname); return; } sc->sc_fhc = (int *)(u_long)bh; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_THC_OFFSET, sizeof(*sc->sc_thc), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map THC registers\n", self->dv_xname); return; } sc->sc_thc = (struct cg6_thc *)(u_long)bh; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_TEC_OFFSET, sizeof(*sc->sc_tec), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map TEC registers\n", self->dv_xname); return; } sc->sc_tec = (struct cg6_tec_xxx *)(u_long)bh; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_FBC_OFFSET, sizeof(*sc->sc_fbc), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map FBC registers\n", self->dv_xname); return; } @@ -191,11 +190,11 @@ cgsixattach(parent, self, aux) isconsole = fb_is_console(node); if (isconsole && cgsix_use_rasterconsole) { int ramsize = fb->fb_type.fb_height * fb->fb_linebytes; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CGSIX_RAM_OFFSET, ramsize, - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map pixels\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/cgthree_sbus.c b/sys/dev/sbus/cgthree_sbus.c index 6475ac70c78b..1f83cb3da6d6 100644 --- a/sys/dev/sbus/cgthree_sbus.c +++ b/sys/dev/sbus/cgthree_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cgthree_sbus.c,v 1.5 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: cgthree_sbus.c,v 1.6 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -89,7 +89,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.5 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cgthree_sbus.c,v 1.6 2002/03/11 16:00:55 pk Exp $"); #include #include @@ -163,7 +163,6 @@ cgthreeattach_sbus(parent, self, args) /* Remember cookies for cgthree_mmap() */ sc->sc_bustag = sa->sa_bustag; - sc->sc_btype = (bus_type_t)sa->sa_slot; /* Should be deprecated */ sc->sc_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_slot, sa->sa_offset); fb->fb_device = &sc->sc_dev; @@ -179,12 +178,11 @@ cgthreeattach_sbus(parent, self, args) * registers ourselves. We only need the video RAM if we are * going to print characters via rconsole. */ - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CG3REG_REG, sizeof(struct fbcontrol), - BUS_SPACE_MAP_LINEAR, - 0, - &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map control registers\n", self->dv_xname); return; } @@ -197,12 +195,11 @@ cgthreeattach_sbus(parent, self, args) fb->fb_pixels = (caddr_t)(u_long)sa->sa_promvaddrs[0]; if (isconsole && fb->fb_pixels == NULL) { int ramsize = fb->fb_type.fb_height * fb->fb_linebytes; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset + CG3REG_MEM, ramsize, - BUS_SPACE_MAP_LINEAR, - 0, - &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map pixels\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/cs4231_sbus.c b/sys/dev/sbus/cs4231_sbus.c index 5fb632fb9e57..9606d1b897e4 100644 --- a/sys/dev/sbus/cs4231_sbus.c +++ b/sys/dev/sbus/cs4231_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: cs4231_sbus.c,v 1.16 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: cs4231_sbus.c,v 1.17 2002/03/11 16:00:55 pk Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.16 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cs4231_sbus.c,v 1.17 2002/03/11 16:00:55 pk Exp $"); #include "audio.h" #if NAUDIO > 0 @@ -112,11 +112,9 @@ cs4231_attach_sbus(parent, self, aux) if (sa->sa_npromvaddrs) { bh = (bus_space_handle_t)sa->sa_promvaddrs[0]; } else { - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s @ sbus: cannot map registers\n", self->dv_xname); return; diff --git a/sys/dev/sbus/dma_sbus.c b/sys/dev/sbus/dma_sbus.c index 1dc50fe9a89e..931f37a691d6 100644 --- a/sys/dev/sbus/dma_sbus.c +++ b/sys/dev/sbus/dma_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: dma_sbus.c,v 1.9 2002/01/14 13:32:46 tsutsui Exp $ */ +/* $NetBSD: dma_sbus.c,v 1.10 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dma_sbus.c,v 1.9 2002/01/14 13:32:46 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dma_sbus.c,v 1.10 2002/03/11 16:00:56 pk Exp $"); #include #include @@ -168,10 +168,9 @@ dmaattach_sbus(parent, self, aux) if (sa->sa_npromvaddrs != 0) sc->sc_regs = (bus_space_handle_t)sa->sa_promvaddrs[0]; else { - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, - sa->sa_offset, - sa->sa_size, - 0, 0, &bh) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/esp_sbus.c b/sys/dev/sbus/esp_sbus.c index a51cffdf53b3..832a9bffa871 100644 --- a/sys/dev/sbus/esp_sbus.c +++ b/sys/dev/sbus/esp_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: esp_sbus.c,v 1.18 2001/11/15 09:48:15 lukem Exp $ */ +/* $NetBSD: esp_sbus.c,v 1.19 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.18 2001/11/15 09:48:15 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: esp_sbus.c,v 1.19 2002/03/11 16:00:56 pk Exp $"); #include #include @@ -207,12 +207,11 @@ espattach_sbus(parent, self, aux) sizeof (lsc->sc_dev.dv_xname)); /* Map dma registers */ - if (bus_space_map2(sa->sa_bustag, - sa->sa_reg[0].sbr_slot, - sa->sa_reg[0].sbr_offset, - sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, - 0, &lsc->sc_regs) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_reg[0].sbr_slot, + sa->sa_reg[0].sbr_offset, + sa->sa_reg[0].sbr_size, + BUS_SPACE_MAP_LINEAR, &lsc->sc_regs) != 0) { printf("%s: cannot map dma registers\n", self->dv_xname); return; } @@ -256,8 +255,7 @@ espattach_sbus(parent, self, aux) sa->sa_reg[1].sbr_slot, sa->sa_reg[1].sbr_offset, sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, - 0, &esc->sc_reg) != 0) { + BUS_SPACE_MAP_LINEAR, &esc->sc_reg) != 0) { printf("%s @ sbus: cannot map scsi core registers\n", self->dv_xname); return; @@ -315,11 +313,9 @@ espattach_sbus(parent, self, aux) if (sa->sa_npromvaddrs) esc->sc_reg = (bus_space_handle_t)sa->sa_promvaddrs[0]; else { - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &esc->sc_reg) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &esc->sc_reg) != 0) { printf("%s @ sbus: cannot map registers\n", self->dv_xname); return; @@ -377,12 +373,9 @@ espattach_dma(parent, self, aux) if (sa->sa_npromvaddrs) esc->sc_reg = (bus_space_handle_t)sa->sa_promvaddrs[0]; else { - if (bus_space_map2(sa->sa_bustag, - sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &esc->sc_reg) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &esc->sc_reg) != 0) { printf("%s @ dma: cannot map registers\n", self->dv_xname); return; diff --git a/sys/dev/sbus/if_en.c b/sys/dev/sbus/if_en.c index da0d1bd887c4..6380d190b29e 100644 --- a/sys/dev/sbus/if_en.c +++ b/sys/dev/sbus/if_en.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_en.c,v 1.12 2001/11/15 09:48:15 lukem Exp $ */ +/* $NetBSD: if_en.c,v 1.13 2002/03/11 16:00:56 pk Exp $ */ /* * @@ -43,7 +43,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.12 2001/11/15 09:48:15 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_en.c,v 1.13 2002/03/11 16:00:56 pk Exp $"); #include #include @@ -132,10 +132,11 @@ en_sbus_attach(parent, self, aux) printf("\n"); - if (bus_space_map2(sa->sa_bustag, sa->sa_slot, + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, 4*1024*1024, - 0, 0, &sc->en_base) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->en_base) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/if_hme_sbus.c b/sys/dev/sbus/if_hme_sbus.c index b9183af0fe76..d47eb18dd80a 100644 --- a/sys/dev/sbus/if_hme_sbus.c +++ b/sys/dev/sbus/if_hme_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_hme_sbus.c,v 1.9 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: if_hme_sbus.c,v 1.10 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_hme_sbus.c,v 1.9 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_hme_sbus.c,v 1.10 2002/03/11 16:00:56 pk Exp $"); #include #include @@ -131,42 +131,42 @@ hmeattach_sbus(parent, self, aux) * */ if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sa->sa_reg[0].sbr_slot, - (bus_addr_t)sa->sa_reg[0].sbr_offset, + sa->sa_reg[0].sbr_slot, + sa->sa_reg[0].sbr_offset, (bus_size_t)sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_seb) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_seb) != 0) { printf("%s: cannot map SEB registers\n", self->dv_xname); return; } if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sa->sa_reg[1].sbr_slot, - (bus_addr_t)sa->sa_reg[1].sbr_offset, + sa->sa_reg[1].sbr_slot, + sa->sa_reg[1].sbr_offset, (bus_size_t)sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_etx) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_etx) != 0) { printf("%s: cannot map ETX registers\n", self->dv_xname); return; } if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sa->sa_reg[2].sbr_slot, - (bus_addr_t)sa->sa_reg[2].sbr_offset, + sa->sa_reg[2].sbr_slot, + sa->sa_reg[2].sbr_offset, (bus_size_t)sa->sa_reg[2].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_erx) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_erx) != 0) { printf("%s: cannot map ERX registers\n", self->dv_xname); return; } if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sa->sa_reg[3].sbr_slot, - (bus_addr_t)sa->sa_reg[3].sbr_offset, + sa->sa_reg[3].sbr_slot, + sa->sa_reg[3].sbr_offset, (bus_size_t)sa->sa_reg[3].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_mac) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_mac) != 0) { printf("%s: cannot map MAC registers\n", self->dv_xname); return; } if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sa->sa_reg[4].sbr_slot, - (bus_addr_t)sa->sa_reg[4].sbr_offset, + sa->sa_reg[4].sbr_slot, + sa->sa_reg[4].sbr_offset, (bus_size_t)sa->sa_reg[4].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_mif) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_mif) != 0) { printf("%s: cannot map MIF registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/if_le.c b/sys/dev/sbus/if_le.c index 3a3958a350eb..fcd2b8aa5616 100644 --- a/sys/dev/sbus/if_le.c +++ b/sys/dev/sbus/if_le.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le.c,v 1.19 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: if_le.c,v 1.20 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.19 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.20 2002/03/11 16:00:56 pk Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -184,8 +184,7 @@ leattach_sbus(parent, self, aux) sa->sa_slot, sa->sa_offset, sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &lesc->sc_reg) != 0) { + BUS_SPACE_MAP_LINEAR, &lesc->sc_reg) != 0) { printf("%s @ sbus: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/if_le_lebuffer.c b/sys/dev/sbus/if_le_lebuffer.c index 2ba2e17c597a..10ff43cad19e 100644 --- a/sys/dev/sbus/if_le_lebuffer.c +++ b/sys/dev/sbus/if_le_lebuffer.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_lebuffer.c,v 1.9 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: if_le_lebuffer.c,v 1.10 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.9 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_lebuffer.c,v 1.10 2002/03/11 16:00:56 pk Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -181,12 +181,11 @@ leattach_lebuffer(parent, self, aux) lesc->sc_bustag = sa->sa_bustag; lesc->sc_dmatag = sa->sa_dmatag; - if (bus_space_map2(sa->sa_bustag, - sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &lesc->sc_reg)) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, + sa->sa_offset, + sa->sa_size, + BUS_SPACE_MAP_LINEAR, &lesc->sc_reg)) { printf("%s @ lebuffer: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/if_le_ledma.c b/sys/dev/sbus/if_le_ledma.c index 14b1a3b9efdd..1f14d203faed 100644 --- a/sys/dev/sbus/if_le_ledma.c +++ b/sys/dev/sbus/if_le_ledma.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_le_ledma.c,v 1.15 2001/11/13 06:58:17 lukem Exp $ */ +/* $NetBSD: if_le_ledma.c,v 1.16 2002/03/11 16:00:56 pk Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_le_ledma.c,v 1.15 2001/11/13 06:58:17 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_le_ledma.c,v 1.16 2002/03/11 16:00:56 pk Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -364,12 +364,11 @@ leattach_ledma(parent, self, aux) lesc->sc_dma->sc_client = lesc; /* Map device registers */ - if (bus_space_map2(sa->sa_bustag, - sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &lesc->sc_reg) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, + sa->sa_offset, + sa->sa_size, + BUS_SPACE_MAP_LINEAR, &lesc->sc_reg) != 0) { printf("%s @ ledma: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/isp_sbus.c b/sys/dev/sbus/isp_sbus.c index 5d3db9dbe584..d27059784e7f 100644 --- a/sys/dev/sbus/isp_sbus.c +++ b/sys/dev/sbus/isp_sbus.c @@ -1,4 +1,4 @@ -/* $NetBSD: isp_sbus.c,v 1.49 2002/02/21 22:32:44 mjacob Exp $ */ +/* $NetBSD: isp_sbus.c,v 1.50 2002/03/11 16:00:57 pk Exp $ */ /* * This driver, which is contained in NetBSD in the files: * @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: isp_sbus.c,v 1.49 2002/02/21 22:32:44 mjacob Exp $"); +__KERNEL_RCSID(0, "$NetBSD: isp_sbus.c,v 1.50 2002/03/11 16:00:57 pk Exp $"); #include #include @@ -167,9 +167,9 @@ isp_sbus_attach(struct device *parent, struct device *self, void *aux) if (sa->sa_npromvaddrs != 0) { sbc->sbus_reg = (bus_space_handle_t)sa->sa_promvaddrs[0]; } else { - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, sa->sa_offset, - sa->sa_size, BUS_SPACE_MAP_LINEAR, 0, - &sbc->sbus_reg) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &sbc->sbus_reg) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/lebuffer.c b/sys/dev/sbus/lebuffer.c index b5e17c2247ef..459026d30a53 100644 --- a/sys/dev/sbus/lebuffer.c +++ b/sys/dev/sbus/lebuffer.c @@ -1,4 +1,4 @@ -/* $NetBSD: lebuffer.c,v 1.11 2002/01/14 13:32:47 tsutsui Exp $ */ +/* $NetBSD: lebuffer.c,v 1.12 2002/03/11 16:00:57 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lebuffer.c,v 1.11 2002/01/14 13:32:47 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lebuffer.c,v 1.12 2002/03/11 16:00:57 pk Exp $"); #include #include @@ -105,10 +105,9 @@ lebufattach(parent, self, aux) sc->sc_bustag = sa->sa_bustag; sc->sc_dmatag = sa->sa_dmatag; - if (sbus_bus_map(sa->sa_bustag, sa->sa_slot, - sa->sa_offset, - sa->sa_size, - 0, 0, &bh) != 0) { + if (sbus_bus_map(sa->sa_bustag, + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: attach: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/magma.c b/sys/dev/sbus/magma.c index b5cebbfc6ffe..e60f9d017fd3 100644 --- a/sys/dev/sbus/magma.c +++ b/sys/dev/sbus/magma.c @@ -1,4 +1,4 @@ -/* $NetBSD: magma.c,v 1.13 2002/01/22 16:59:30 pk Exp $ */ +/* $NetBSD: magma.c,v 1.14 2002/03/11 16:00:57 pk Exp $ */ /* * magma.c * @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.13 2002/01/22 16:59:30 pk Exp $"); +__KERNEL_RCSID(0, "$NetBSD: magma.c,v 1.14 2002/03/11 16:00:57 pk Exp $"); #if 0 #define MAGMA_DEBUG @@ -389,11 +389,8 @@ magma_attach(parent, self, aux) sc->ms_ncd1190 = card->mb_ncd1190; if (sbus_bus_map(sa->sa_bustag, - sa->sa_slot, - sa->sa_offset, - sa->sa_size, - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + sa->sa_slot, sa->sa_offset, sa->sa_size, + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s @ sbus: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/p9100.c b/sys/dev/sbus/p9100.c index b29c13922514..a165aa90c32d 100644 --- a/sys/dev/sbus/p9100.c +++ b/sys/dev/sbus/p9100.c @@ -1,4 +1,4 @@ -/* $NetBSD: p9100.c,v 1.7 2001/12/08 19:42:45 cyber Exp $ */ +/* $NetBSD: p9100.c,v 1.8 2002/03/11 16:00:57 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.7 2001/12/08 19:42:45 cyber Exp $"); +__KERNEL_RCSID(0, "$NetBSD: p9100.c,v 1.8 2002/03/11 16:00:57 pk Exp $"); #include #include @@ -84,18 +84,19 @@ struct p9100_softc { struct sbusdev sc_sd; /* sbus device */ struct fbdevice sc_fb; /* frame buffer device */ bus_space_tag_t sc_bustag; - bus_type_t sc_ctl_slot; /* phys address description */ - bus_addr_t sc_ctl_paddr; /* for device mmap() */ + + bus_addr_t sc_ctl_paddr; /* phys address description */ bus_size_t sc_ctl_psize; /* for device mmap() */ bus_space_handle_t sc_ctl_memh; /* bus space handle */ - bus_type_t sc_cmd_slot; /* phys address description */ - bus_addr_t sc_cmd_paddr; /* for device mmap() */ + + bus_addr_t sc_cmd_paddr; /* phys address description */ bus_size_t sc_cmd_psize; /* for device mmap() */ bus_space_handle_t sc_cmd_memh; /* bus space handle */ - bus_type_t sc_fb_slot; /* phys address description */ - bus_addr_t sc_fb_paddr; /* for device mmap() */ + + bus_addr_t sc_fb_paddr; /* phys address description */ bus_size_t sc_fb_psize; /* for device mmap() */ bus_space_handle_t sc_fb_memh; /* bus space handle */ + uint32_t sc_junk; union bt_cmap sc_cmap; /* Brooktree color map */ @@ -175,17 +176,14 @@ p9100_sbus_attach(struct device *parent, struct device *self, void *args) /* Remember cookies for p9100_mmap() */ sc->sc_bustag = sa->sa_bustag; - sc->sc_ctl_slot = (bus_type_t)sa->sa_reg[0].sbr_slot; sc->sc_ctl_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_reg[0].sbr_slot, sa->sa_reg[0].sbr_offset); sc->sc_ctl_psize = (bus_size_t)sa->sa_reg[0].sbr_size; - sc->sc_cmd_slot = (bus_type_t)sa->sa_reg[1].sbr_slot; sc->sc_cmd_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_reg[1].sbr_slot, sa->sa_reg[1].sbr_offset); sc->sc_cmd_psize = (bus_size_t)sa->sa_reg[1].sbr_size; - sc->sc_fb_slot = (bus_type_t)sa->sa_reg[2].sbr_slot; sc->sc_fb_paddr = sbus_bus_addr(sa->sa_bustag, sa->sa_reg[2].sbr_slot, sa->sa_reg[2].sbr_offset); sc->sc_fb_psize = (bus_size_t)sa->sa_reg[2].sbr_size; @@ -209,18 +207,20 @@ p9100_sbus_attach(struct device *parent, struct device *self, void *args) * registers ourselves. We only need the video RAM if we are * going to print characters via rconsole. */ - if (sbus_bus_map(sc->sc_bustag, sc->sc_ctl_slot, - sa->sa_reg[0].sbr_slot + sa->sa_reg[0].sbr_offset, - sc->sc_ctl_psize, BUS_SPACE_MAP_LINEAR, 0, - &sc->sc_ctl_memh) != 0) { + if (sbus_bus_map(sc->sc_bustag, + sa->sa_reg[0].sbr_slot, + sa->sa_reg[0].sbr_offset, + sc->sc_ctl_psize, + BUS_SPACE_MAP_LINEAR, &sc->sc_ctl_memh) != 0) { printf("%s: cannot map control registers\n", self->dv_xname); return; } - if (sbus_bus_map(sc->sc_bustag, sc->sc_cmd_slot, - sa->sa_reg[1].sbr_slot + sa->sa_reg[1].sbr_offset, - sc->sc_cmd_psize, BUS_SPACE_MAP_LINEAR, 0, - &sc->sc_cmd_memh) != 0) { + if (sbus_bus_map(sc->sc_bustag, + sa->sa_reg[1].sbr_slot, + sa->sa_reg[1].sbr_offset, + sc->sc_cmd_psize, + BUS_SPACE_MAP_LINEAR, &sc->sc_cmd_memh) != 0) { printf("%s: cannot map command registers\n", self->dv_xname); return; } @@ -229,12 +229,11 @@ p9100_sbus_attach(struct device *parent, struct device *self, void *args) fb->fb_pixels = (caddr_t)sa->sa_promvaddrs[0]; if (fb->fb_pixels == NULL) { - if (sbus_bus_map(sc->sc_bustag, sc->sc_fb_slot, - sa->sa_reg[2].sbr_slot + - sa->sa_reg[2].sbr_offset, - sc->sc_fb_psize, - BUS_SPACE_MAP_LINEAR, 0, - &sc->sc_fb_memh) != 0) { + if (sbus_bus_map(sc->sc_bustag, + sa->sa_reg[2].sbr_slot, + sa->sa_reg[2].sbr_offset, + sc->sc_fb_psize, + BUS_SPACE_MAP_LINEAR, &sc->sc_fb_memh) != 0) { printf("%s: cannot map framebuffer\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/qe.c b/sys/dev/sbus/qe.c index f098ccef78e4..83e5271e0812 100644 --- a/sys/dev/sbus/qe.c +++ b/sys/dev/sbus/qe.c @@ -1,4 +1,4 @@ -/* $NetBSD: qe.c,v 1.20 2002/03/06 19:10:58 frueauf Exp $ */ +/* $NetBSD: qe.c,v 1.21 2002/03/11 16:00:57 pk Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.20 2002/03/06 19:10:58 frueauf Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.21 2002/03/11 16:00:57 pk Exp $"); #define QEDEBUG @@ -224,20 +224,22 @@ qeattach(parent, self, aux) return; } - if (bus_space_map2(sa->sa_bustag, - (bus_type_t)sa->sa_reg[0].sbr_slot, - (bus_addr_t)sa->sa_reg[0].sbr_offset, + if (bus_space_map(sa->sa_bustag, + (bus_addr_t)BUS_ADDR( + sa->sa_reg[0].sbr_slot, + sa->sa_reg[0].sbr_offset), (bus_size_t)sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_cr) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_cr) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } - if (bus_space_map2(sa->sa_bustag, - (bus_type_t)sa->sa_reg[1].sbr_slot, - (bus_addr_t)sa->sa_reg[1].sbr_offset, + if (bus_space_map(sa->sa_bustag, + (bus_addr_t)BUS_ADDR( + sa->sa_reg[1].sbr_slot, + sa->sa_reg[1].sbr_offset), (bus_size_t)sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_mr) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_mr) != 0) { printf("%s: cannot map registers\n", self->dv_xname); return; } diff --git a/sys/dev/sbus/qec.c b/sys/dev/sbus/qec.c index 9c202da94900..014f0e52109e 100644 --- a/sys/dev/sbus/qec.c +++ b/sys/dev/sbus/qec.c @@ -1,4 +1,4 @@ -/* $NetBSD: qec.c,v 1.17 2002/01/14 13:32:47 tsutsui Exp $ */ +/* $NetBSD: qec.c,v 1.18 2002/03/11 16:00:57 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.17 2002/01/14 13:32:47 tsutsui Exp $"); +__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.18 2002/03/11 16:00:57 pk Exp $"); #include #include @@ -61,8 +61,7 @@ void qec_init __P((struct qec_softc *)); static int qec_bus_map __P(( bus_space_tag_t, - bus_type_t, /*slot*/ - bus_addr_t, /*offset*/ + bus_addr_t, /*coded slot+offset*/ bus_size_t, /*size*/ int, /*flags*/ vaddr_t, /*preferred virtual address */ @@ -135,7 +134,7 @@ qecattach(parent, self, aux) sa->sa_reg[0].sbr_slot, sa->sa_reg[0].sbr_offset, sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &sc->sc_regs) != 0) { + BUS_SPACE_MAP_LINEAR, &sc->sc_regs) != 0) { printf("%s: attach: cannot map registers\n", self->dv_xname); return; } @@ -149,7 +148,7 @@ qecattach(parent, self, aux) sa->sa_reg[1].sbr_slot, sa->sa_reg[1].sbr_offset, sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: attach: cannot map registers\n", self->dv_xname); return; } @@ -232,31 +231,29 @@ qecattach(parent, self, aux) } int -qec_bus_map(t, btype, offset, size, flags, vaddr, hp) +qec_bus_map(t, baddr, size, flags, va, hp) bus_space_tag_t t; - bus_type_t btype; - bus_addr_t offset; + bus_addr_t baddr; bus_size_t size; int flags; - vaddr_t vaddr; + vaddr_t va; /* Ignored */ bus_space_handle_t *hp; { struct qec_softc *sc = t->cookie; - int slot = btype; + int slot = BUS_ADDR_IOSPACE(baddr); int i; for (i = 0; i < sc->sc_nrange; i++) { - bus_addr_t paddr; - bus_type_t iospace; + struct sbus_range *rp = &sc->sc_range[i]; if (sc->sc_range[i].cspace != slot) continue; /* We've found the connection to the parent bus */ - paddr = sc->sc_range[i].poffset + offset; - iospace = sc->sc_range[i].pspace; - return (bus_space_map2(sc->sc_bustag, iospace, paddr, - size, flags, vaddr, hp)); + return (bus_space_map(sc->sc_bustag, + BUS_ADDR(rp->pspace, + rp->poffset + BUS_ADDR_PADDR(baddr)), + size, flags, hp)); } return (EINVAL); diff --git a/sys/dev/sbus/sbusvar.h b/sys/dev/sbus/sbusvar.h index c3822d76b5ab..a97819a62433 100644 --- a/sys/dev/sbus/sbusvar.h +++ b/sys/dev/sbus/sbusvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: sbusvar.h,v 1.13 2002/02/03 05:53:28 darrenr Exp $ */ +/* $NetBSD: sbusvar.h,v 1.14 2002/03/11 16:00:57 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -54,6 +54,8 @@ struct sbusdev { void (*sd_reset) __P((struct device *)); }; +typedef u_int32_t sbus_slot_t; +typedef u_int32_t sbus_offset_t; /* Device register space description */ struct sbus_reg { @@ -118,8 +120,14 @@ int sbus_setup_attach_args __P(( void sbus_destroy_attach_args __P((struct sbus_attach_args *)); -#define sbus_bus_map(t, bt, a, s, f, v, hp) \ - bus_space_map2(t, bt, a, s, f, v, hp) +#if defined(SUN4U) +/* XXX - until sun4u catches up */ +#define sbus_bus_map(t, bt, a, s, f, hp) \ + bus_space_map2(t, bt, a, s, f, 0, hp) +#else +#define sbus_bus_map(tag, slot, offset, sz, flags, hp) \ + bus_space_map(tag, BUS_ADDR(slot,offset), sz, flags, hp) +#endif bus_addr_t sbus_bus_addr __P((bus_space_tag_t, u_int, u_int)); #if notyet diff --git a/sys/dev/sbus/sio16.c b/sys/dev/sbus/sio16.c index faf81f5da375..1e33b027f16d 100644 --- a/sys/dev/sbus/sio16.c +++ b/sys/dev/sbus/sio16.c @@ -1,4 +1,4 @@ -/* $NetBSD: sio16.c,v 1.2 2001/11/13 06:58:18 lukem Exp $ */ +/* $NetBSD: sio16.c,v 1.3 2002/03/11 16:00:57 pk Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.2 2001/11/13 06:58:18 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sio16.c,v 1.3 2002/03/11 16:00:57 pk Exp $"); #include #include @@ -156,7 +156,7 @@ sio16_attach(parent, self, aux) sa->sa_reg[0].sbr_slot, sa->sa_reg[0].sbr_offset, sa->sa_reg[0].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &h) != 0) { + BUS_SPACE_MAP_LINEAR, &h) != 0) { printf("%s at sbus: can not map registers 0\n", self->dv_xname); return; @@ -166,7 +166,7 @@ sio16_attach(parent, self, aux) sa->sa_reg[1].sbr_slot, sa->sa_reg[1].sbr_offset, sa->sa_reg[1].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &h) != 0) { + BUS_SPACE_MAP_LINEAR, &h) != 0) { printf("%s at sbus: can not map registers 1\n", self->dv_xname); return; @@ -176,7 +176,7 @@ sio16_attach(parent, self, aux) sa->sa_reg[2].sbr_slot, sa->sa_reg[2].sbr_offset, sa->sa_reg[2].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &h) != 0) { + BUS_SPACE_MAP_LINEAR, &h) != 0) { printf("%s at sbus: can not map registers 2\n", self->dv_xname); return; @@ -186,7 +186,7 @@ sio16_attach(parent, self, aux) sa->sa_reg[3].sbr_slot, sa->sa_reg[3].sbr_offset, sa->sa_reg[3].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, &h) != 0) { + BUS_SPACE_MAP_LINEAR, &h) != 0) { printf("%s at sbus: can not map registers 3\n", self->dv_xname); return; diff --git a/sys/dev/sbus/stp4020.c b/sys/dev/sbus/stp4020.c index b132a0704cb5..a9c38e7507d4 100644 --- a/sys/dev/sbus/stp4020.c +++ b/sys/dev/sbus/stp4020.c @@ -1,4 +1,4 @@ -/* $NetBSD: stp4020.c,v 1.19 2002/03/10 16:18:44 martin Exp $ */ +/* $NetBSD: stp4020.c,v 1.20 2002/03/11 16:00:58 pk Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.19 2002/03/10 16:18:44 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: stp4020.c,v 1.20 2002/03/11 16:00:58 pk Exp $"); #include #include @@ -327,8 +327,7 @@ stp4020attach(parent, self, aux) sa->sa_reg[i].sbr_slot, sa->sa_reg[i].sbr_offset, sa->sa_reg[i].sbr_size, - BUS_SPACE_MAP_LINEAR, 0, - &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("%s: attach: cannot map registers\n", self->dv_xname); return; diff --git a/sys/dev/sbus/tcx.c b/sys/dev/sbus/tcx.c index dcbf902c36fe..4eefa0e88eb4 100644 --- a/sys/dev/sbus/tcx.c +++ b/sys/dev/sbus/tcx.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcx.c,v 1.4 2001/11/13 06:58:18 lukem Exp $ */ +/* $NetBSD: tcx.c,v 1.5 2002/03/11 16:00:58 pk Exp $ */ /* * Copyright (c) 1996,1998 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.4 2001/11/13 06:58:18 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcx.c,v 1.5 2002/03/11 16:00:58 pk Exp $"); #include #include @@ -186,22 +186,20 @@ tcxattach(parent, self, args) /* Map the register banks we care about */ if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sc->sc_physadr[TCX_REG_THC].sbr_slot, - (bus_addr_t)sc->sc_physadr[TCX_REG_THC].sbr_offset, + sc->sc_physadr[TCX_REG_THC].sbr_slot, + sc->sc_physadr[TCX_REG_THC].sbr_offset, sizeof (struct tcx_thc), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("tcxattach: cannot map thc registers\n"); return; } sc->sc_thc = (volatile struct tcx_thc *)bh; if (sbus_bus_map(sa->sa_bustag, - (bus_type_t)sc->sc_physadr[TCX_REG_CMAP].sbr_slot, - (bus_addr_t)sc->sc_physadr[TCX_REG_CMAP].sbr_offset, + sc->sc_physadr[TCX_REG_CMAP].sbr_slot, + sc->sc_physadr[TCX_REG_CMAP].sbr_offset, sizeof (struct bt_regs), - BUS_SPACE_MAP_LINEAR, - 0, &bh) != 0) { + BUS_SPACE_MAP_LINEAR, &bh) != 0) { printf("tcxattach: cannot map bt registers\n"); return; } @@ -473,11 +471,9 @@ tcxmmap(dev, off, prot) u = off - mo->mo_uaddr; sz = mo->mo_size ? mo->mo_size : sc->sc_fb.fb_type.fb_size; if (u < sz) { - bus_type_t t = (bus_type_t)rr[mo->mo_bank].sbr_slot; - bus_addr_t a = BUS_ADDR(t, rr[mo->mo_bank].sbr_offset); - return (bus_space_mmap(sc->sc_bustag, - a, + BUS_ADDR(rr[mo->mo_bank].sbr_slot, + rr[mo->mo_bank].sbr_offset), u, prot, BUS_SPACE_MAP_LINEAR));