Allow storage-space to be passed to the alloc_bus_space_tag() functions. This

permits static tags to be used during early console init.
This commit is contained in:
leo 2000-01-19 13:12:54 +00:00
parent 293e2f2a8c
commit 4911054546
6 changed files with 41 additions and 25 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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
*/

View File

@ -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");

View File

@ -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;

View File

@ -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;