diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-30 21:57:41 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-03-30 21:57:41 +0000 |
commit | c41a3906b3b42cfa3cf0b212e0e63e5a924e91ba (patch) | |
tree | e6122b42aa7c5f708fff5262ecde4e4ffb42e84f | |
parent | 6a9bf51566eb70dd769457a4a146104fe04f9aff (diff) |
o Move register definitions to if_wireg.h
o Rename some register defines to be more useful (adapted from FreeBSD)
o Enable interrupts on PLX chip since some boards don't have this in
the EEPROM (adapted from FreeBSD and Linux).
-rw-r--r-- | sys/dev/ic/if_wireg.h | 16 | ||||
-rw-r--r-- | sys/dev/pci/if_wi_pci.c | 58 |
2 files changed, 47 insertions, 27 deletions
diff --git a/sys/dev/ic/if_wireg.h b/sys/dev/ic/if_wireg.h index 47de3ff7b05..92352b06e50 100644 --- a/sys/dev/ic/if_wireg.h +++ b/sys/dev/ic/if_wireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wireg.h,v 1.15 2002/03/28 20:49:39 mickey Exp $ */ +/* $OpenBSD: if_wireg.h,v 1.16 2002/03/30 21:57:40 millert Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -146,7 +146,7 @@ */ /* - * Size of Hermes I/O space. + * Size of Hermes & Prism2 I/O space. */ #define WI_IOSIZ 0x40 @@ -271,9 +271,16 @@ #define WI_AUX_OFFSET 0x3C #define WI_AUX_DATA 0x3E -#define WI_PLX_COR_OFFSET 0x3E0 -#define WI_PLX_COR_VALUE 0x41 +#define WI_PCI_PLX_LOCALRES 0x14 /* PLX chip's local registers */ +#define WI_PCI_PLX_MEMRES 0x18 /* Prism attribute memory (PLX) */ +#define WI_PCI_PLX_IORES 0x1C /* Prism I/O space (PLX) */ +#define WI_PLX_INTCSR 0x4C /* PLX Interrupt CSR */ +#define WI_PLX_INTEN 0x40 /* Interrupt Enable bit */ +#define WI_PLX_COR_OFFSET 0x3E0 /* COR attribute offset of Prism2 */ +#define WI_PLX_COR_VALUE 0x41 /* Enable with irq in level trigger */ +#define WI_PCI_TMD_LOCALRES 0x14 /* TMD chip's local registers */ +#define WI_PCI_TMD_IORES 0x18 /* Prism I/O space (TMD) */ #define WI_TMD_COR_VALUE 0x45 /* @@ -282,6 +289,7 @@ * has doubled. * About WI_PCI_COR: In this Register, only soft-reset bit implement; Bit(7). */ +#define WI_PCI_CBMA 0x10 #define WI_PCI_COR 0x4C #define WI_PCI_HCR 0x5C #define WI_PCI_MASTER0_ADDRH 0x80 diff --git a/sys/dev/pci/if_wi_pci.c b/sys/dev/pci/if_wi_pci.c index 932fbbba1b2..f535c3613b1 100644 --- a/sys/dev/pci/if_wi_pci.c +++ b/sys/dev/pci/if_wi_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wi_pci.c,v 1.17 2002/03/27 22:01:16 millert Exp $ */ +/* $OpenBSD: if_wi_pci.c,v 1.18 2002/03/30 21:57:40 millert Exp $ */ /* * Copyright (c) 2001, 2002 Todd C. Miller <Todd.Miller@courtesan.com> @@ -86,14 +86,6 @@ #include <dev/ic/if_wi_ieee.h> #include <dev/ic/if_wivar.h> -#define WI_PCI_CBMA 0x10 -#define WI_PCI_PLX_LOMEM 0x10 /* PLX chip membase */ -#define WI_PCI_PLX_LOIO 0x14 /* PLX chip iobase */ -#define WI_PCI_TMD_IO 0x14 /* TMD chip iobase */ -#define WI_PCI_TMD_PRISM_IO 0x18 /* Prism chip iobase behind the TMD */ -#define WI_PCI_LOMEM 0x18 /* ISA membase */ -#define WI_PCI_LOIO 0x1C /* ISA iobase */ - /* Values for pp_type */ #define WI_PCI_PRISM 0x01 /* Intersil Mini-PCI */ #define WI_PCI_PLX 0x02 /* PLX 905x dumb bridge */ @@ -160,10 +152,13 @@ wi_pci_attach(parent, self, aux) struct pci_attach_args *pa = aux; const struct wi_pci_product *pp; pci_intr_handle_t ih; - bus_space_handle_t ioh, memh; + bus_space_handle_t localh, ioh, memh; + bus_space_tag_t localt; bus_space_tag_t iot = pa->pa_iot; bus_space_tag_t memt = pa->pa_memt; + bus_size_t localsize, memsize; pci_chipset_tag_t pc = pa->pa_pc; + u_int32_t command; pcireg_t csr; const char *intrstr; @@ -171,16 +166,21 @@ wi_pci_attach(parent, self, aux) /* Map memory and I/O registers. */ switch (pp->pp_type) { case WI_PCI_PLX: - if (pci_mapreg_map(pa, WI_PCI_LOMEM, PCI_MAPREG_TYPE_MEM, 0, - &memt, &memh, NULL, NULL, 0) != 0) { + if (pci_mapreg_map(pa, WI_PCI_PLX_MEMRES, PCI_MAPREG_TYPE_MEM, 0, + &memt, &memh, NULL, &memsize, 0) != 0) { printf(": can't map mem space\n"); return; } - if (pci_mapreg_map(pa, WI_PCI_LOIO, PCI_MAPREG_TYPE_IO, 0, + if (pci_mapreg_map(pa, WI_PCI_PLX_IORES, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL, 0) != 0) { printf(": can't map I/O space\n"); return; } + if (pci_mapreg_map(pa, WI_PCI_PLX_LOCALRES, PCI_MAPREG_TYPE_IO, 0, + &localt, &localh, NULL, &localsize, 0) != 0) { + printf(": can't map PLX I/O space\n"); + return; + } break; case WI_PCI_PRISM: if (pci_mapreg_map(pa, WI_PCI_CBMA, PCI_MAPREG_TYPE_MEM, @@ -188,20 +188,17 @@ wi_pci_attach(parent, self, aux) printf(": can't map mem space\n"); return; } - - memt = iot; - memh = ioh; sc->sc_pci = 1; break; case WI_PCI_TMD: - if (pci_mapreg_map(pa, WI_PCI_TMD_IO, PCI_MAPREG_TYPE_IO, - 0, &memt, &memh, NULL, NULL, 0) != 0) { + if (pci_mapreg_map(pa, WI_PCI_TMD_LOCALRES, PCI_MAPREG_TYPE_IO, + 0, &localt, &localh, NULL, &localsize, 0) != 0) { printf(": can't map TMD I/O space\n"); return; } - if (pci_mapreg_map(pa, WI_PCI_TMD_PRISM_IO, PCI_MAPREG_TYPE_IO, + if (pci_mapreg_map(pa, WI_PCI_TMD_IORES, PCI_MAPREG_TYPE_IO, 0, &iot, &ioh, NULL, NULL, 0) != 0) { - printf(": can't map Prism2 I/O space\n"); + printf(": can't map I/O space\n"); return; } break; @@ -239,12 +236,24 @@ wi_pci_attach(parent, self, aux) switch (pp->pp_type) { case WI_PCI_PLX: /* + * Tell the PLX chip to enable interrupts. In most cases + * the serial EEPROM has done this for us but some cards + * appear not to. + */ + command = bus_space_read_4(localt, localh, WI_PLX_INTCSR); + command |= WI_PLX_INTEN; + bus_space_write_4(localt, localh, WI_PLX_INTCSR, command); + + /* * Setup the PLX chip for level interrupts and config index 1 - * XXX - should really reset the PLX chip too. */ bus_space_write_1(memt, memh, WI_PLX_COR_OFFSET, WI_PLX_COR_VALUE); + /* Unmap registers we no longer need access to. */ + bus_space_unmap(localt, localh, localsize); + bus_space_unmap(memt, memh, memsize); + wi_attach(sc, 1); break; case WI_PCI_PRISM: @@ -256,12 +265,15 @@ wi_pci_attach(parent, self, aux) wi_attach(sc, 0); break; case WI_PCI_TMD: - bus_space_write_1(memt, memh, 0, WI_TMD_COR_VALUE); + bus_space_write_1(localt, localh, 0, WI_TMD_COR_VALUE); /* XXX - correct delay? */ DELAY(100*1000); /* 100 m sec */ - if (bus_space_read_1(memt, memh, 0) != WI_TMD_COR_VALUE) + if (bus_space_read_1(localt, localh, 0) != WI_TMD_COR_VALUE) printf(": unable to initialize TMD7160 "); + /* Unmap registers we no longer need access to. */ + bus_space_unmap(localt, localh, localsize); + wi_attach(sc, 1); break; } |