From 243f7516040b16d2d84de72e2387b958ef61f794 Mon Sep 17 00:00:00 2001 From: dyoung Date: Sat, 29 Mar 2003 03:25:22 +0000 Subject: [PATCH] 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 --- sys/dev/pci/if_wi_pci.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/sys/dev/pci/if_wi_pci.c b/sys/dev/pci/if_wi_pci.c index 05d35661eb6f..84cf76c20c66 100644 --- a/sys/dev/pci/if_wi_pci.c +++ b/sys/dev/pci/if_wi_pci.c @@ -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 -__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 #include @@ -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);