Support the 'PCMCIA adapter BOX' for OpenBlockS266.

This commit is contained in:
kiyohara 2005-09-04 15:23:55 +00:00
parent 044ec00fc2
commit db37c957e1
3 changed files with 32 additions and 15 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pchb.c,v 1.3 2004/08/30 15:05:18 drochner Exp $ */
/* $NetBSD: pchb.c,v 1.4 2005/09/04 15:23:55 kiyohara Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.3 2004/08/30 15:05:18 drochner Exp $");
__KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.4 2005/09/04 15:23:55 kiyohara Exp $");
#include "pci.h"
#include "opt_pci.h"
@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: pchb.c,v 1.3 2004/08/30 15:05:18 drochner Exp $");
static int pchbmatch(struct device *, struct cfdata *, void *);
static void pchbattach(struct device *, struct device *, void *);
static int pchbprint(void *, const char *);
static pci_chipset_tag_t alloc_chipset_tag(int);
CFATTACH_DECL(pchb, sizeof(struct device),
pchbmatch, pchbattach, NULL, NULL);
@ -89,7 +90,7 @@ pchbmatch(struct device *parent, struct cfdata *cf, void *aux)
{
struct plb_attach_args *paa = aux;
/* XXX chipset tag unused by walnut, so just pass 0 */
pci_chipset_tag_t pc = 0;
pci_chipset_tag_t pc = alloc_chipset_tag(0);
pcitag_t tag;
int class, id;
@ -126,15 +127,12 @@ pchbattach(struct device *parent, struct device *self, void *aux)
struct plb_attach_args *paa = aux;
struct pcibus_attach_args pba;
char devinfo[256];
#ifdef PCI_NETBSD_CONFIGURE
struct extent *ioext, *memext;
#ifdef PCI_CONFIGURE_VERBOSE
extern int pci_conf_debug;
pci_conf_debug = 1;
#endif
#endif
pci_chipset_tag_t pc = 0;
pci_chipset_tag_t pc = alloc_chipset_tag(0);
pcitag_t tag;
int class, id;
@ -168,14 +166,12 @@ pchbattach(struct device *parent, struct device *self, void *aux)
panic("pchbattach: can't init MEM tag");
#ifdef PCI_NETBSD_CONFIGURE
memext = extent_create("pcimem", IBM405GP_PCI_MEM_START,
pc->memext = extent_create("pcimem", IBM405GP_PCI_MEM_START,
IBM405GP_PCI_MEM_START + 0x1fffffff, M_DEVBUF, NULL, 0,
EX_NOWAIT);
ioext = extent_create("pciio", IBM405GP_PCI_PCI_IO_START,
pc->ioext = extent_create("pciio", IBM405GP_PCI_PCI_IO_START,
IBM405GP_PCI_PCI_IO_START + 0xffff, M_DEVBUF, NULL, 0, EX_NOWAIT);
pci_configure_bus(0, ioext, memext, NULL, 0, 32);
extent_destroy(memext);
extent_destroy(ioext);
pci_configure_bus(pc, pc->ioext, pc->memext, NULL, 0, 32);
#endif /* PCI_NETBSD_CONFIGURE */
#ifdef PCI_CONFIGURE_VERBOSE
@ -187,6 +183,7 @@ pchbattach(struct device *parent, struct device *self, void *aux)
pba.pba_memt = &pchb_mem_tag;
pba.pba_dmat = paa->plb_dmat;
pba.pba_dmat64 = NULL;
pba.pba_pc = pc;
pba.pba_bus = 0;
pba.pba_bridgetag = NULL;
pba.pba_flags = PCI_FLAGS_MEM_ENABLED | PCI_FLAGS_IO_ENABLED;
@ -227,3 +224,16 @@ scan_pci_bus(void)
}
}
#endif
static pci_chipset_tag_t
alloc_chipset_tag(int node)
{
pci_chipset_tag_t npc;
npc = malloc(sizeof *npc, M_DEVBUF, M_NOWAIT);
if (npc == NULL)
panic("could not allocate pci_chipset_tag_t");
npc->rootnode = node;
return (npc);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ibm4xx_intr.h,v 1.6 2003/11/26 03:56:38 simonb Exp $ */
/* $NetBSD: ibm4xx_intr.h,v 1.7 2005/09/04 15:23:55 kiyohara Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -183,6 +183,7 @@ set_sint(pending)
#define spltty() splraise(imask[IPL_TTY])
#define splclock() splraise(imask[IPL_CLOCK])
#define splvm() splraise(imask[IPL_VM])
#define splaudio() splraise(imask[IPL_AUDIO])
#define splserial() splraise(imask[IPL_SERIAL])
#define splstatclock() splclock()
#define spllowersoftclock() spllower(imask[IPL_SOFTCLOCK])

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.h,v 1.2 2004/08/02 18:07:40 tacha Exp $ */
/* $NetBSD: pci_machdep.h,v 1.3 2005/09/04 15:23:55 kiyohara Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -54,10 +54,16 @@ struct pci_attach_args;
/*
* Types provided to machine-independent PCI code
*/
typedef void *pci_chipset_tag_t;
typedef struct ibm4xx_pci_chipset *pci_chipset_tag_t;
typedef int pcitag_t;
typedef int pci_intr_handle_t;
struct ibm4xx_pci_chipset {
int rootnode; /* PCI controller */
struct extent *ioext; /* PCI I/O extent */
struct extent *memext; /* PCI memory extent */
};
/*
* Functions provided to machine-independent PCI code.
*/