Get PCI working with the new bus_space*.
This commit is contained in:
parent
0923e659b7
commit
2db5a5e82f
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: com_ebus.c,v 1.9 2002/03/01 11:51:00 martin Exp $ */
|
||||
/* $NetBSD: com_ebus.c,v 1.10 2002/03/15 07:06:24 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Matthew R. Green
|
||||
|
@ -129,13 +129,10 @@ com_ebus_attach(parent, self, aux)
|
|||
*/
|
||||
if (ea->ea_nvaddrs)
|
||||
sc->sc_ioh = (bus_space_handle_t)ea->ea_vaddrs[0];
|
||||
else if (ebus_bus_map(sc->sc_iot, 0,
|
||||
EBUS_ADDR_FROM_REG(&ea->ea_regs[0]),
|
||||
ea->ea_regs[0].size,
|
||||
BUS_SPACE_MAP_LINEAR,
|
||||
0, &sc->sc_ioh) != 0) {
|
||||
else if (bus_space_map(sc->sc_iot, EBUS_ADDR_FROM_REG(&ea->ea_regs[0]),
|
||||
ea->ea_regs[0].size, 0, &sc->sc_ioh) != 0) {
|
||||
printf(": can't map register space\n");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
sc->sc_hwflags = 0;
|
||||
sc->sc_frequency = BAUD_BASE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ebus.c,v 1.29 2001/10/22 08:09:46 mrg Exp $ */
|
||||
/* $NetBSD: ebus.c,v 1.30 2002/03/15 07:06:24 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000, 2001 Matthew R. Green
|
||||
|
@ -115,9 +115,8 @@ int ebus_find_node __P((struct pci_attach_args *));
|
|||
* here are our bus space and bus dma routines.
|
||||
*/
|
||||
static paddr_t ebus_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t, int, int));
|
||||
static int _ebus_bus_map __P((bus_space_tag_t, bus_type_t, bus_addr_t,
|
||||
bus_size_t, int, vaddr_t,
|
||||
bus_space_handle_t *));
|
||||
static int _ebus_bus_map __P((bus_space_tag_t, bus_addr_t, bus_size_t, int,
|
||||
vaddr_t, bus_space_handle_t *));
|
||||
static void *ebus_intr_establish __P((bus_space_tag_t, int, int, int,
|
||||
int (*) __P((void *)), void *));
|
||||
|
||||
|
@ -411,9 +410,8 @@ ebus_alloc_bus_tag(sc, type)
|
|||
}
|
||||
|
||||
static int
|
||||
_ebus_bus_map(t, btype, offset, size, flags, vaddr, hp)
|
||||
_ebus_bus_map(t, offset, size, flags, vaddr, hp)
|
||||
bus_space_tag_t t;
|
||||
bus_type_t btype;
|
||||
bus_addr_t offset;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
|
@ -465,8 +463,7 @@ _ebus_bus_map(t, btype, offset, size, flags, vaddr, hp)
|
|||
("\n_ebus_bus_map: mapping space %x paddr offset %qx pciaddr %qx\n",
|
||||
ss, (unsigned long long)offset, (unsigned long long)pciaddr));
|
||||
/* pass it onto the psycho */
|
||||
return (bus_space_map2(t, sc->sc_range[i].phys_hi,
|
||||
pciaddr, size, flags, vaddr, hp));
|
||||
return (bus_space_map(t, pciaddr, size, flags, hp));
|
||||
}
|
||||
DPRINTF(EDB_BUSMAP, (": FAILED\n"));
|
||||
return (EINVAL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lpt_ebus.c,v 1.8 2002/03/01 11:51:00 martin Exp $ */
|
||||
/* $NetBSD: lpt_ebus.c,v 1.9 2002/03/15 07:06:24 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Matthew R. Green
|
||||
|
@ -91,11 +91,11 @@ lpt_ebus_attach(parent, self, aux)
|
|||
*/
|
||||
if (ea->ea_nvaddrs)
|
||||
sc->sc_ioh = (bus_space_handle_t)ea->ea_vaddrs[0];
|
||||
else if (ebus_bus_map(sc->sc_iot, 0,
|
||||
else if (bus_space_map(sc->sc_iot,
|
||||
EBUS_ADDR_FROM_REG(&ea->ea_regs[0]),
|
||||
ea->ea_regs[0].size,
|
||||
BUS_SPACE_MAP_LINEAR,
|
||||
0, &sc->sc_ioh) != 0) {
|
||||
&sc->sc_ioh) != 0) {
|
||||
printf(": can't map register space\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: psycho.c,v 1.43 2002/03/08 06:03:50 chs Exp $ */
|
||||
/* $NetBSD: psycho.c,v 1.44 2002/03/15 07:06:24 eeh Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999, 2000 Matthew R. Green
|
||||
|
@ -35,9 +35,6 @@
|
|||
* UltraSPARC IIi and IIe `sabre' PCI controllers.
|
||||
*/
|
||||
|
||||
#undef DEBUG
|
||||
#define DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PDB_PROM 0x01
|
||||
#define PDB_BUSMAP 0x02
|
||||
|
@ -96,10 +93,10 @@ static void psycho_iommu_init __P((struct psycho_softc *, int));
|
|||
* bus space and bus dma support for UltraSPARC `psycho'. note that most
|
||||
* of the bus dma support is provided by the iommu dvma controller.
|
||||
*/
|
||||
static paddr_t psycho_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t, int, int));
|
||||
static int _psycho_bus_map __P((bus_space_tag_t, bus_type_t, bus_addr_t,
|
||||
bus_size_t, int, vaddr_t,
|
||||
bus_space_handle_t *));
|
||||
static paddr_t psycho_bus_mmap __P((bus_space_tag_t, bus_addr_t, off_t,
|
||||
int, int));
|
||||
static int _psycho_bus_map __P((bus_space_tag_t, bus_addr_t, bus_size_t, int,
|
||||
vaddr_t, bus_space_handle_t *));
|
||||
static void *psycho_intr_establish __P((bus_space_tag_t, int, int, int,
|
||||
int (*) __P((void *)), void *));
|
||||
|
||||
|
@ -283,15 +280,15 @@ found:
|
|||
bus_space_handle_t handle;
|
||||
|
||||
/* We need to map this in ourselves. */
|
||||
if (bus_space_map2(sc->sc_bustag, 0,
|
||||
if (bus_space_map(sc->sc_bustag,
|
||||
ma->ma_reg[2].ur_paddr,
|
||||
ma->ma_reg[2].ur_len, 0, NULL, &handle))
|
||||
ma->ma_reg[2].ur_len, 0, &handle))
|
||||
panic("psycho_attach: cannot map regs");
|
||||
sc->sc_regs = (struct psychoreg *)(u_long)handle;
|
||||
|
||||
if (bus_space_map2(sc->sc_bustag, 0,
|
||||
if (bus_space_map(sc->sc_bustag,
|
||||
ma->ma_reg[0].ur_paddr,
|
||||
ma->ma_reg[0].ur_len, 0, NULL, &handle))
|
||||
ma->ma_reg[0].ur_len, 0, &handle))
|
||||
panic("psycho_attach: cannot map ctl");
|
||||
/* XXX -- this is lost but never unmapped */
|
||||
pci_ctl = (struct pci_ctl *)(u_long)handle;
|
||||
|
@ -310,9 +307,9 @@ found:
|
|||
bus_space_handle_t handle;
|
||||
|
||||
/* We need to map this in ourselves. */
|
||||
if (bus_space_map2(sc->sc_bustag, 0,
|
||||
if (bus_space_map(sc->sc_bustag,
|
||||
ma->ma_reg[0].ur_paddr,
|
||||
ma->ma_reg[0].ur_len, 0, NULL, &handle))
|
||||
ma->ma_reg[0].ur_len, 0, &handle))
|
||||
panic("psycho_attach: cannot map regs");
|
||||
sc->sc_regs = (struct psychoreg *)(u_long)handle;
|
||||
pci_ctl = (struct pci_ctl *)&sc->sc_regs->psy_pcictl[0];
|
||||
|
@ -492,14 +489,17 @@ found:
|
|||
psycho_iommu_init(sc, 2);
|
||||
|
||||
sc->sc_configtag = psycho_alloc_config_tag(sc->sc_psycho_this);
|
||||
if (bus_space_map2(sc->sc_bustag,
|
||||
PCI_CONFIG_BUS_SPACE,
|
||||
sc->sc_basepaddr + 0x01000000,
|
||||
0x0100000,
|
||||
0,
|
||||
0,
|
||||
&bh))
|
||||
|
||||
/*
|
||||
* XXX This is a really ugly hack because PCI config space
|
||||
* is explicitly handled with unmapped accesses.
|
||||
*/
|
||||
i = sc->sc_bustag->type;
|
||||
sc->sc_bustag->type = PCI_CONFIG_BUS_SPACE;
|
||||
if (bus_space_map(sc->sc_bustag, sc->sc_basepaddr + 0x01000000,
|
||||
0x0100000, 0, &bh))
|
||||
panic("could not map psycho PCI configuration space");
|
||||
sc->sc_bustag->type = i;
|
||||
sc->sc_configaddr = (off_t)bh;
|
||||
} else {
|
||||
/* Just copy IOMMU state, config tag and address */
|
||||
|
@ -874,21 +874,22 @@ get_childspace(type)
|
|||
}
|
||||
|
||||
static int
|
||||
_psycho_bus_map(t, btype, offset, size, flags, vaddr, hp)
|
||||
_psycho_bus_map(t, offset, size, flags, unused, hp)
|
||||
bus_space_tag_t t;
|
||||
bus_type_t btype;
|
||||
bus_addr_t offset;
|
||||
bus_size_t size;
|
||||
int flags;
|
||||
vaddr_t vaddr;
|
||||
vaddr_t unused;
|
||||
bus_space_handle_t *hp;
|
||||
{
|
||||
struct psycho_pbm *pp = t->cookie;
|
||||
struct psycho_softc *sc = pp->pp_sc;
|
||||
int i, ss;
|
||||
|
||||
DPRINTF(PDB_BUSMAP, ("_psycho_bus_map: type %d off %qx sz %qx flags %d va %p", t->type, (unsigned long long)offset, (unsigned long long)size, flags,
|
||||
(void *)vaddr));
|
||||
DPRINTF(PDB_BUSMAP,
|
||||
("_psycho_bus_map: type %d off %qx sz %qx flags %d",
|
||||
t->type, (unsigned long long)offset,
|
||||
(unsigned long long)size, flags));
|
||||
|
||||
ss = get_childspace(t->type);
|
||||
DPRINTF(PDB_BUSMAP, (" cspace %d", ss));
|
||||
|
@ -904,8 +905,8 @@ _psycho_bus_map(t, btype, offset, size, flags, vaddr, hp)
|
|||
DPRINTF(PDB_BUSMAP, ("\n_psycho_bus_map: mapping paddr space %lx offset %lx paddr %qx\n",
|
||||
(long)ss, (long)offset,
|
||||
(unsigned long long)paddr));
|
||||
return (bus_space_map2(sc->sc_bustag, t->type, paddr,
|
||||
size, flags, vaddr, hp));
|
||||
return ((*sc->sc_bustag->sparc_bus_map)(t, paddr, size,
|
||||
flags, 0, hp));
|
||||
}
|
||||
DPRINTF(PDB_BUSMAP, (" FAILED\n"));
|
||||
return (EINVAL);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: bus.h,v 1.36 2002/03/14 20:46:11 eeh Exp $ */
|
||||
/* $NetBSD: bus.h,v 1.37 2002/03/15 07:06:23 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -321,8 +321,6 @@ void * bus_space_vaddr __P((bus_space_tag_t space, bus_space_handle_t handle));
|
|||
#define BUS_SPACE_MAP_LINEAR 0x0002
|
||||
#define BUS_SPACE_MAP_READONLY 0x0004
|
||||
#define BUS_SPACE_MAP_PREFETCHABLE 0x0008
|
||||
#define BUS_SPACE_MAP_BIG 0x0010 /* Force BE */
|
||||
#define BUS_SPACE_MAP_LITTLE 0x0020 /* Force LE */
|
||||
#define BUS_SPACE_MAP_BUS1 0x0100
|
||||
#define BUS_SPACE_MAP_BUS2 0x0200
|
||||
#define BUS_SPACE_MAP_BUS3 0x0400
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: machdep.c,v 1.116 2002/03/14 20:57:37 eeh Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.117 2002/03/15 07:06:24 eeh Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -1812,6 +1812,12 @@ sparc_bus_map(t, addr, size, flags, unused, hp)
|
|||
*/
|
||||
if (flags & BUS_SPACE_MAP_LINEAR) return (-1);
|
||||
*hp = (bus_space_handle_t)addr;
|
||||
DPRINTF(BSDB_MAP, ("\nsparc_bus_map: type %x flags %x "
|
||||
"addr %016llx size %016llx virt %llx paddr %016llx\n",
|
||||
(int)t->type, (int) flags, (unsigned long long)addr,
|
||||
(unsigned long long)size, (unsigned long long)*hp,
|
||||
(unsigned long long)pa));
|
||||
return (0);
|
||||
/* FALLTHROUGH */
|
||||
case PCI_IO_BUS_SPACE:
|
||||
pm_flags = PMAP_LITTLE;
|
||||
|
@ -1824,14 +1830,6 @@ sparc_bus_map(t, addr, size, flags, unused, hp)
|
|||
break;
|
||||
}
|
||||
|
||||
if (flags & BUS_SPACE_MAP_BIG) pm_flags = 0;
|
||||
if (flags & BUS_SPACE_MAP_LITTLE) pm_flags = 0;
|
||||
#ifdef DIAGNOSTIC
|
||||
if ((flags & (BUS_SPACE_MAP_LITTLE|BUS_SPACE_MAP_BIG)) ==
|
||||
(BUS_SPACE_MAP_LITTLE|BUS_SPACE_MAP_BIG))
|
||||
panic("sparc_bus_map: cannot map both little and big endian");
|
||||
#endif
|
||||
|
||||
if (!(flags & BUS_SPACE_MAP_CACHEABLE)) pm_flags |= PMAP_NC;
|
||||
|
||||
if ((err = extent_alloc(io_space, size, NBPG,
|
||||
|
|
Loading…
Reference in New Issue