Provide basic bus_space_mmap(). Noted by self and in PR port-powerpc/14873.

This at least allows the compile to complete.  There are still Issues with
vga_pci.c's assumptions about a PC-ish environment.
This commit is contained in:
briggs 2001-12-10 20:30:21 +00:00
parent b5ea4050f9
commit 25e9f1f519
4 changed files with 62 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_space.c,v 1.1 2001/06/06 17:42:29 matt Exp $ */
/* $NetBSD: bus_space.c,v 1.2 2001/12/10 20:30:21 briggs Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -45,6 +45,7 @@
#include <machine/bus.h>
static paddr_t bebox_memio_mmap (bus_space_tag_t, bus_addr_t, off_t, int, int);
static int bebox_memio_map (bus_space_tag_t, bus_addr_t, bus_size_t, int,
bus_space_handle_t *);
static void bebox_memio_unmap (bus_space_tag_t, bus_space_handle_t, bus_size_t);
@ -55,18 +56,22 @@ static void bebox_memio_free (bus_space_tag_t, bus_space_handle_t, bus_size_t);
const struct powerpc_bus_space bebox_io_bs_tag = {
BEBOX_BUS_SPACE_IO, 0x80000000, 0x80000000, 0x3f800000,
bebox_memio_mmap,
bebox_memio_map, bebox_memio_unmap, bebox_memio_alloc, bebox_memio_free
};
const struct powerpc_bus_space bebox_isa_io_bs_tag = {
BEBOX_BUS_SPACE_IO, 0x80000000, 0x80000000, 0x00010000,
bebox_memio_mmap,
bebox_memio_map, bebox_memio_unmap, bebox_memio_alloc, bebox_memio_free
};
const struct powerpc_bus_space bebox_mem_bs_tag = {
BEBOX_BUS_SPACE_MEM, 0xc0000000, 0xc0000000, 0x3f000000,
bebox_memio_mmap,
bebox_memio_map, bebox_memio_unmap, bebox_memio_alloc, bebox_memio_free
};
const struct powerpc_bus_space bebox_isa_mem_bs_tag = {
BEBOX_BUS_SPACE_MEM, 0xc0000000, 0xc0000000, 0x01000000,
bebox_memio_mmap,
bebox_memio_map, bebox_memio_unmap, bebox_memio_alloc, bebox_memio_free
};
static long ioport_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
@ -100,6 +105,16 @@ bebox_bus_space_mallocok()
ioport_malloc_safe = 1;
}
static paddr_t
bebox_memio_mmap(t, bpa, offset, prot, flags)
bus_space_tag_t t;
bus_addr_t bpa;
off_t offset;
int prot, flags;
{
return ((bpa + offset) >> PGSHIFT);
}
static int
bebox_memio_map(t, bpa, size, flags, bshp)
bus_space_tag_t t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.2 2001/07/19 15:32:17 thorpej Exp $ */
/* $NetBSD: bus.h,v 1.3 2001/12/10 20:30:21 briggs Exp $ */
/* $OpenBSD: bus.h,v 1.1 1997/10/13 10:53:42 pefo Exp $ */
/*-
@ -119,6 +119,7 @@ struct powerpc_bus_space {
bus_addr_t pbs_offset;
bus_addr_t pbs_base;
bus_addr_t pbs_limit;
paddr_t (*pbs_mmap) __P((bus_space_tag_t, bus_addr_t, off_t, int, int));
int (*pbs_map) __P((bus_space_tag_t, bus_addr_t, bus_size_t, int,
bus_space_handle_t *));
void (*pbs_unmap) __P((bus_space_tag_t, bus_space_handle_t,
@ -147,6 +148,16 @@ struct powerpc_bus_space {
#define __BUS_SPACE_HAS_STREAM_METHODS
/*
* paddr_t bus_space_mmap __P((bus_space_tag_t t, bus_addr_t addr,
* off_t offset, int prot, int flags));
*
* Mmap a region of bus space.
*/
#define bus_space_mmap(t, b, o, p, f) \
((*(t)->pbs_mmap)((t), (b), (o), (p), (f)))
/*
* int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr,
* bus_size_t size, int flags, bus_space_handle_t *bshp));

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_space.c,v 1.4 2001/06/15 15:50:05 nonaka Exp $ */
/* $NetBSD: bus_space.c,v 1.5 2001/12/10 20:30:21 briggs Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -45,6 +45,7 @@
#include <machine/bus.h>
static paddr_t prep_memio_mmap (bus_space_tag_t, bus_addr_t, off_t, int, int);
static int prep_memio_map(bus_space_tag_t, bus_addr_t, bus_size_t, int,
bus_space_handle_t *);
static void prep_memio_unmap(bus_space_tag_t, bus_space_handle_t, bus_size_t);
@ -55,18 +56,22 @@ static void prep_memio_free(bus_space_tag_t, bus_space_handle_t, bus_size_t);
const struct powerpc_bus_space prep_io_space_tag = {
PREP_BUS_SPACE_IO, 0x80000000, 0x80000000, 0x3f800000,
prep_memio_mmap,
prep_memio_map, prep_memio_unmap, prep_memio_alloc, prep_memio_free
};
const struct powerpc_bus_space prep_isa_io_space_tag = {
PREP_BUS_SPACE_IO, 0x80000000, 0x80000000, 0x00010000,
prep_memio_mmap,
prep_memio_map, prep_memio_unmap, prep_memio_alloc, prep_memio_free
};
const struct powerpc_bus_space prep_mem_space_tag = {
PREP_BUS_SPACE_MEM, 0xC0000000, 0xC0000000, 0x3f000000,
prep_memio_mmap,
prep_memio_map, prep_memio_unmap, prep_memio_alloc, prep_memio_free
};
const struct powerpc_bus_space prep_isa_mem_space_tag = {
PREP_BUS_SPACE_MEM, 0xC0000000, 0xC0000000, 0x01000000,
prep_memio_mmap,
prep_memio_map, prep_memio_unmap, prep_memio_alloc, prep_memio_free
};
static long ioport_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
@ -100,6 +105,17 @@ prep_bus_space_mallocok()
ioport_malloc_safe = 1;
}
static paddr_t
prep_memio_mmap(t, bpa, offset, prot, flags)
bus_space_tag_t t;
bus_addr_t bpa;
off_t offset;
int prot, flags;
{
return ((bpa + offset) >> PGSHIFT);
}
static int
prep_memio_map(t, bpa, size, flags, bshp)
bus_space_tag_t t;

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus_space.c,v 1.1 2001/06/10 03:16:31 briggs Exp $ */
/* $NetBSD: bus_space.c,v 1.2 2001/12/10 20:30:21 briggs Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -45,6 +45,8 @@
#include <machine/bus.h>
static paddr_t sandpoint_memio_mmap (bus_space_tag_t, bus_addr_t, off_t, int,
int);
static int sandpoint_memio_map (bus_space_tag_t, bus_addr_t, bus_size_t, int,
bus_space_handle_t *);
static void sandpoint_memio_unmap (bus_space_tag_t, bus_space_handle_t, bus_size_t);
@ -55,21 +57,25 @@ static void sandpoint_memio_free (bus_space_tag_t, bus_space_handle_t, bus_size_
const struct powerpc_bus_space sandpoint_io_bs_tag = {
SANDPOINT_BUS_SPACE_IO, 0xfe000000, 0x00000000, 0xfec00000,
sandpoint_memio_mmap,
sandpoint_memio_map, sandpoint_memio_unmap, sandpoint_memio_alloc,
sandpoint_memio_free
};
const struct powerpc_bus_space sandpoint_isa_io_bs_tag = {
SANDPOINT_BUS_SPACE_IO, 0xfe000000, 0x00000000, 0xfe010000,
sandpoint_memio_mmap,
sandpoint_memio_map, sandpoint_memio_unmap, sandpoint_memio_alloc,
sandpoint_memio_free
};
const struct powerpc_bus_space sandpoint_mem_bs_tag = {
SANDPOINT_BUS_SPACE_MEM, 0x00000000, 0x80000000, 0xfe000000,
sandpoint_memio_mmap,
sandpoint_memio_map, sandpoint_memio_unmap, sandpoint_memio_alloc,
sandpoint_memio_free
};
const struct powerpc_bus_space sandpoint_isa_mem_bs_tag = {
SANDPOINT_BUS_SPACE_MEM, 0x00000000, 0xfd000000, 0xfe000000,
sandpoint_memio_mmap,
sandpoint_memio_map, sandpoint_memio_unmap, sandpoint_memio_alloc,
sandpoint_memio_free
};
@ -104,6 +110,16 @@ sandpoint_bus_space_mallocok(void)
ioport_malloc_safe = 1;
}
static paddr_t
sandpoint_memio_mmap(t, bpa, offset, prot, flags)
bus_space_tag_t t;
bus_addr_t bpa;
off_t offset;
int prot, flags;
{
return ((bpa + offset) >> PGSHIFT);
}
static int
sandpoint_memio_map(t, bpa, size, flags, bshp)
bus_space_tag_t t;