diff --git a/sys/arch/atari/atari/be_bus.c b/sys/arch/atari/atari/be_bus.c index a8a64d77ccdd..e2c71ac3ad2b 100644 --- a/sys/arch/atari/atari/be_bus.c +++ b/sys/arch/atari/atari/be_bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: be_bus.c,v 1.3 1998/05/25 09:08:08 leo Exp $ */ +/* $NetBSD: be_bus.c,v 1.4 2000/01/19 13:12:54 leo Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -161,8 +161,6 @@ static void beb_bus_space_set_region_8 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t, bus_size_t)); -bus_space_tag_t beb_alloc_bus_space_tag __P((void)); - /* * Don't force a function call overhead on these primitives... */ @@ -177,12 +175,21 @@ bus_space_tag_t beb_alloc_bus_space_tag __P((void)); #define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = (v) bus_space_tag_t -beb_alloc_bus_space_tag() +beb_alloc_bus_space_tag(storage) +bus_space_tag_t storage; { bus_space_tag_t beb_t; - if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL) + /* + * Allow the caller to specify storage space for the tag. This + * is used during console config (when malloc() can't be used). + */ + if (storage != NULL) + beb_t = storage; + else { + if ((beb_t = malloc(sizeof(*beb_t), M_TEMP, M_NOWAIT)) == NULL) return(NULL); + } bzero(beb_t, sizeof(*beb_t)); beb_t->abs_p_1 = beb_bus_space_peek_1; diff --git a/sys/arch/atari/atari/le_bus.c b/sys/arch/atari/atari/le_bus.c index cc72e41eb2e1..5534265f9eb2 100644 --- a/sys/arch/atari/atari/le_bus.c +++ b/sys/arch/atari/atari/le_bus.c @@ -1,4 +1,4 @@ -/* $NetBSD: le_bus.c,v 1.4 1999/02/19 20:57:03 leo Exp $ */ +/* $NetBSD: le_bus.c,v 1.5 2000/01/19 13:12:55 leo Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -222,8 +222,6 @@ static void leb_bus_space_set_region_8 __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, u_int64_t, bus_size_t)); -bus_space_tag_t leb_alloc_bus_space_tag __P((void)); - /* * Define these inline, to avoid function call overhead. * XXX: Maybe move to an m68k include file? @@ -259,12 +257,21 @@ static __inline__ u_int32_t swap32(u_int32_t v) #define __write_8(h, o, v) *((u_int64_t *)((h) + (o))) = bswap64(v) bus_space_tag_t -leb_alloc_bus_space_tag() +leb_alloc_bus_space_tag(storage) +bus_space_tag_t storage; { - bus_space_tag_t leb_t; + bus_space_tag_t leb_t; - if ((leb_t = malloc(sizeof(*leb_t), M_TEMP, M_NOWAIT)) == NULL) + /* + * Allow the caller to specify storage space for the tag. This + * is used during console config (when malloc() can't be used). + */ + if (storage != NULL) + leb_t = storage; + else { + if ((leb_t = malloc(sizeof(*leb_t), M_TEMP, M_NOWAIT)) == NULL) return(NULL); + } bzero(leb_t, sizeof(*leb_t)); leb_t->abs_p_1 = leb_bus_space_peek_1; diff --git a/sys/arch/atari/include/bus.h b/sys/arch/atari/include/bus.h index 1a0d4bcf6d99..297fe8c87fc3 100644 --- a/sys/arch/atari/include/bus.h +++ b/sys/arch/atari/include/bus.h @@ -1,4 +1,4 @@ -/* $NetBSD: bus.h,v 1.19 1999/12/13 15:40:28 leo Exp $ */ +/* $NetBSD: bus.h,v 1.20 2000/01/19 13:13:07 leo Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -100,6 +100,12 @@ void bus_space_unmap __P((bus_space_tag_t, bus_space_handle_t, int bus_space_subregion __P((bus_space_tag_t, bus_space_handle_t, bus_size_t, bus_size_t, bus_space_handle_t *)); +/* + * Tag allocation + */ +bus_space_tag_t beb_alloc_bus_space_tag __P((bus_space_tag_t)); +bus_space_tag_t leb_alloc_bus_space_tag __P((bus_space_tag_t)); + /* * XXX */ diff --git a/sys/arch/atari/isa/isa_machdep.c b/sys/arch/atari/isa/isa_machdep.c index 7fbaf90315eb..7fa8f8a1a9b9 100644 --- a/sys/arch/atari/isa/isa_machdep.c +++ b/sys/arch/atari/isa/isa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: isa_machdep.c,v 1.15 1999/11/23 14:48:58 leo Exp $ */ +/* $NetBSD: isa_machdep.c,v 1.16 2000/01/19 13:13:14 leo Exp $ */ /* * Copyright (c) 1997 Leo Weppelman. All rights reserved. @@ -85,12 +85,11 @@ void *auxp; { struct isabus_softc *sc = (struct isabus_softc *)dp; struct isabus_attach_args iba; - bus_space_tag_t leb_alloc_bus_space_tag __P((void)); iba.iba_busname = "isa"; iba.iba_dmat = BUS_ISA_DMA_TAG; - iba.iba_iot = leb_alloc_bus_space_tag(); - iba.iba_memt = leb_alloc_bus_space_tag(); + iba.iba_iot = leb_alloc_bus_space_tag(NULL); + iba.iba_memt = leb_alloc_bus_space_tag(NULL); iba.iba_ic = &sc->sc_chipset; if ((iba.iba_iot == NULL) || (iba.iba_memt == NULL)) { printf("leb_alloc_bus_space_tag failed!\n"); diff --git a/sys/arch/atari/pci/pci_machdep.c b/sys/arch/atari/pci/pci_machdep.c index d32b2725db4b..ebcd04cb0883 100644 --- a/sys/arch/atari/pci/pci_machdep.c +++ b/sys/arch/atari/pci/pci_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.c,v 1.20 1999/11/07 22:23:05 thomas Exp $ */ +/* $NetBSD: pci_machdep.c,v 1.21 2000/01/19 13:13:16 leo Exp $ */ /* * Copyright (c) 1996 Leo Weppelman. All rights reserved. @@ -126,8 +126,6 @@ struct device *pdp, *dp; void *auxp; { struct pcibus_attach_args pba; - bus_space_tag_t leb_alloc_bus_space_tag __P((void)); - enable_pci_devices(); @@ -136,8 +134,8 @@ void *auxp; pba.pba_bus = 0; pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED; pba.pba_dmat = BUS_PCI_DMA_TAG; - pba.pba_iot = leb_alloc_bus_space_tag(); - pba.pba_memt = leb_alloc_bus_space_tag(); + pba.pba_iot = leb_alloc_bus_space_tag(NULL); + pba.pba_memt = leb_alloc_bus_space_tag(NULL); if ((pba.pba_iot == NULL) || (pba.pba_memt == NULL)) { printf("leb_alloc_bus_space_tag failed!\n"); return; diff --git a/sys/arch/atari/vme/vme_machdep.c b/sys/arch/atari/vme/vme_machdep.c index 30d5140050ac..5d61f1f24c31 100644 --- a/sys/arch/atari/vme/vme_machdep.c +++ b/sys/arch/atari/vme/vme_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vme_machdep.c,v 1.6 1998/09/15 10:45:11 leo Exp $ */ +/* $NetBSD: vme_machdep.c,v 1.7 2000/01/19 13:13:18 leo Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -78,11 +78,10 @@ struct device *pdp, *dp; void *auxp; { struct vmebus_attach_args vba; - bus_space_tag_t beb_alloc_bus_space_tag __P((void)); vba.vba_busname = "vme"; - vba.vba_iot = beb_alloc_bus_space_tag(); - vba.vba_memt = beb_alloc_bus_space_tag(); + vba.vba_iot = beb_alloc_bus_space_tag(NULL); + vba.vba_memt = beb_alloc_bus_space_tag(NULL); if ((vba.vba_iot == NULL) || (vba.vba_memt == NULL)) { printf("beb_alloc_bus_space_tag failed!\n"); return;