Support so-called "PLX" bridge for wi(4). From FreeBSD via Simon

Burge. Simon writes,

"Here's the patch that Grant and I have been using on a combinations of
architectures and both NetBSD 1.6 and -current.

"This is based on FreeBSD - look for
        /* We have to do a magic PLX poke to enable interrupts */
in
        http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/wi/if_wi_pci.c
This commit is contained in:
dyoung 2003-03-29 03:25:22 +00:00
parent 1bcb9d76fb
commit 243f751604

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_wi_pci.c,v 1.20 2003/03/28 13:58:40 perry Exp $ */
/* $NetBSD: if_wi_pci.c,v 1.21 2003/03/29 03:25:22 dyoung Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_wi_pci.c,v 1.20 2003/03/28 13:58:40 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_wi_pci.c,v 1.21 2003/03/29 03:25:22 dyoung Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -228,8 +228,8 @@ wi_pci_attach(parent, self, aux)
const char *intrstr;
const struct wi_pci_product *wpp;
pci_intr_handle_t ih;
bus_space_tag_t memt, iot;
bus_space_handle_t memh, ioh;
bus_space_tag_t memt, iot, plxt;
bus_space_handle_t memh, ioh, plxh;
psc->psc_pa = pa;
@ -253,6 +253,12 @@ wi_pci_attach(parent, self, aux)
printf(": can't map I/O space\n");
return;
}
/* Map PLX. */
if (pci_mapreg_map(pa, WI_PCI_PLX_LOIO, PCI_MAPREG_TYPE_IO, 0,
&plxt, &plxh, NULL, NULL) != 0) {
printf(": can't map PLX\n");
return;
}
} else {
if (pci_mapreg_map(pa, WI_PCI_CBMA,
PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT,
@ -286,6 +292,16 @@ wi_pci_attach(parent, self, aux)
CSR_WRITE_2(sc, WI_INT_EN, 0);
CSR_WRITE_2(sc, WI_EVENT_ACK, 0xFFFF);
if (wpp->wpp_plx) {
uint32_t command;
#define WI_LOCAL_INTCSR 0x4c
#define WI_LOCAL_INTEN 0x40 /* poke this into INTCSR */
command = bus_space_read_4(plxt, plxh, WI_LOCAL_INTCSR);
command |= WI_LOCAL_INTEN;
bus_space_write_4(plxt, plxh, WI_LOCAL_INTCSR, command);
}
/* Map and establish the interrupt. */
if (pci_intr_map(pa, &ih)) {
printf("%s: couldn't map interrupt\n", sc->sc_dev.dv_xname);