Switch macepci to use MI pci_configure_bus(9) rather than its own fixup code.

Tested on my O2 with several devices, and ok'ed by sekiya.
This commit is contained in:
tsutsui 2006-04-17 14:01:08 +00:00
parent 8dec918f9f
commit 936c3743c7
4 changed files with 63 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: GENERIC32_IP3x,v 1.49 2006/04/17 12:46:35 tsutsui Exp $
# $NetBSD: GENERIC32_IP3x,v 1.50 2006/04/17 14:01:08 tsutsui Exp $
#
# GENERIC32_IP3x machine description file
#
@ -28,7 +28,7 @@ makeoptions TEXTADDR="0x80069000" # entry point
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
#ident "GENERIC32_IP3x-$Revision: 1.49 $"
#ident "GENERIC32_IP3x-$Revision: 1.50 $"
maxusers 32
@ -185,6 +185,8 @@ crime0 at mainbus0 addr 0x14000000
mace0 at mainbus0 addr 0x1f000000
macepci0 at mace0 offset 0x080000 intr 7
pci0 at macepci0 bus 0
pci* at ppb? bus ?
options PCI_NETBSD_CONFIGURE
# MACE devices
mec0 at mace0 offset 0x280000 intr 3
@ -194,6 +196,9 @@ com0 at mace0 offset 0x390000 intr 4 intrmask 0x03f00000
com1 at mace0 offset 0x398000 intr 4 intrmask 0xfc000000
mcclock0 at mace0 offset 0x3a0000
# PCI bridges
ppb* at pci? dev ? function ? # PCI-PCI bridges
# PCI cryptographic devices
hifn* at pci? dev ? function ? # Hifn 7755/7811/795x
ubsec* at pci? dev ? function ? # Broadcom 5501/5601/580x/582x

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.h,v 1.7 2005/12/11 12:18:53 christos Exp $ */
/* $NetBSD: pci_machdep.h,v 1.8 2006/04/17 14:01:08 tsutsui Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -60,6 +60,9 @@ struct sgimips_pci_chipset {
bus_space_tag_t iot;
bus_space_handle_t ioh;
struct extent *pc_memext; /* PCI memory space extent */
struct extent *pc_ioext; /* PCI I/O space extent */
};
extern struct sgimips_bus_dma_tag pci_bus_dma_tag;
@ -82,3 +85,6 @@ const struct evcnt *pci_intr_evcnt(pci_chipset_tag_t, pci_intr_handle_t);
void *pci_intr_establish(pci_chipset_tag_t, pci_intr_handle_t,
int, int (*)(void *), void *);
void pci_intr_disestablish(pci_chipset_tag_t, void *);
void pci_conf_interrupt(pci_chipset_tag_t, int, int, int, int,
int *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_mace.c,v 1.6 2005/12/11 12:18:54 christos Exp $ */
/* $NetBSD: pci_mace.c,v 1.7 2006/04/17 14:01:08 tsutsui Exp $ */
/*
* Copyright (c) 2001,2003 Christopher Sekiya
@ -34,7 +34,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.6 2005/12/11 12:18:54 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.7 2006/04/17 14:01:08 tsutsui Exp $");
#include "opt_pci.h"
#include "pci.h"
#include <sys/param.h>
#include <sys/device.h>
@ -47,14 +50,23 @@ __KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.6 2005/12/11 12:18:54 christos Exp $"
#include <machine/bus.h>
#include <machine/machtype.h>
#include <mips/cache.h>
#include <dev/pci/pcivar.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcidevs.h>
#ifdef PCI_NETBSD_CONFIGURE
#include <sys/extent.h>
#include <sys/malloc.h>
#include <dev/pci/pciconf.h>
#endif
#include <sgimips/mace/macereg.h>
#include <sgimips/mace/macevar.h>
#include <sgimips/mace/pcireg_mace.h>
#ifndef PCI_NETBSD_CONFIGURE
#include <sgimips/pci/pci_addr_fixup.h>
#define PCIBIOS_PRINTV(arg) \
@ -69,8 +81,7 @@ __KERNEL_RCSID(0, "$NetBSD: pci_mace.c,v 1.6 2005/12/11 12:18:54 christos Exp $"
#define PAGE_ALIGN(x) (((x) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1))
#define MEG_ALIGN(x) (((x) + 0x100000 - 1) & ~(0x100000 - 1))
#include "pci.h"
#endif
struct macepci_softc {
struct device sc_dev;
@ -84,14 +95,14 @@ pcireg_t macepci_conf_read(pci_chipset_tag_t, pcitag_t, int);
void macepci_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
int macepci_intr(void *);
#ifndef PCI_NETBSD_CONFIGURE
struct pciaddr pciaddr;
bus_addr_t pciaddr_ioaddr(u_int32_t val);
int pciaddr_do_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag, int mapreg, void *ctx, int type, bus_addr_t *addr, bus_size_t size);
unsigned int ioaddr_base = 0x1000;
unsigned int memaddr_base = 0x80100000;
#endif
CFATTACH_DECL(macepci, sizeof(struct macepci_softc),
macepci_match, macepci_attach, NULL, NULL);
@ -111,8 +122,11 @@ macepci_attach(struct device *parent, struct device *self, void *aux)
struct mace_attach_args *maa = aux;
struct pcibus_attach_args pba;
u_int32_t control;
int rev;
#ifndef PCI_NETBSD_CONFIGURE
pcitag_t devtag;
int device, rev;
int device;
#endif
if (bus_space_subregion(maa->maa_st, maa->maa_sh,
maa->maa_offset, 0, &pc->ioh) )
@ -145,6 +159,7 @@ macepci_attach(struct device *parent, struct device *self, void *aux)
MACE_PCI_CONTROL_TAR_INT |
MACE_PCI_CONTROL_MAR_INT);
#ifndef PCI_NETBSD_CONFIGURE
/* Must fix up all PCI devices, ahc_pci expects proper i/o mapping */
for (device = 1; device < 4; device++) {
const struct pci_quirkdata *qd;
@ -185,6 +200,7 @@ macepci_attach(struct device *parent, struct device *self, void *aux)
pciaddr_resource_manage(pc, devtag, NULL, NULL);
}
}
#endif
/*
* Enable all MACE PCI interrupts. They will be masked by
@ -195,6 +211,14 @@ macepci_attach(struct device *parent, struct device *self, void *aux)
bus_space_write_4(pc->iot, pc->ioh, MACEPCI_CONTROL, control);
#if NPCI > 0
#ifdef PCI_NETBSD_CONFIGURE
pc->pc_ioext = extent_create("macepciio", 0x00001000, 0x01ffffff,
M_DEVBUF, NULL, 0, EX_NOWAIT);
pc->pc_memext = extent_create("macepcimem", 0x80100000, 0x81ffffff,
M_DEVBUF, NULL, 0, EX_NOWAIT);
pci_configure_bus(pc, pc->pc_ioext, pc->pc_memext, NULL, 0,
mips_dcache_align);
#endif
memset(&pba, 0, sizeof pba);
/*XXX*/ pba.pba_iot = SGIMIPS_BUS_SPACE_IO;
/*XXX*/ pba.pba_memt = SGIMIPS_BUS_SPACE_MEM;
@ -333,6 +357,7 @@ macepci_intr(void *arg)
return 0;
}
#ifndef PCI_NETBSD_CONFIGURE
/* PCI Address fixup routines */
void
@ -531,3 +556,4 @@ pciaddr_print_devid(pci_chipset_tag_t pc, pcitag_t tag)
printf("%03d:%02d:%d 0x%04x 0x%04x ", bus, device, function,
PCI_VENDOR(id), PCI_PRODUCT(id));
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.16 2005/12/11 12:18:58 christos Exp $ */
/* $NetBSD: pci_machdep.c,v 1.17 2006/04/17 14:01:08 tsutsui Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@ -33,7 +33,10 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.16 2005/12/11 12:18:58 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: pci_machdep.c,v 1.17 2006/04/17 14:01:08 tsutsui Exp $");
#include "opt_pci.h"
#include "pci.h"
#include <sys/types.h>
#include <sys/param.h>
@ -88,7 +91,7 @@ pci_bus_maxdevs(pci_chipset_tag_t pc, int busno)
if (busno == 0)
return 5; /* 2 on-board SCSI chips, slots 0, 1 and 2 */
else
return 0; /* XXX */
return 32; /* XXX */
}
pcitag_t
@ -197,3 +200,13 @@ pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
(pc->intr_disestablish)(cookie);
}
#ifdef PCI_NETBSD_CONFIGURE
void
pci_conf_interrupt(pci_chipset_tag_t pc, int bus, int dev, int pin, int swiz,
int *iline)
{
return;
}
#endif