diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2013-11-18 22:21:28 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2013-11-18 22:21:28 +0000 |
commit | 718e899522da6d36c07f211c5958593eb5906b1d (patch) | |
tree | eeea43cd8a7432e277546cfdfbbad316d236120f | |
parent | 2ee71438e413e1c90dba9d2bb674f2dd38bfeee0 (diff) |
Enable MSI on the remaining chipsets.
ok naddy@ sthen@
-rw-r--r-- | sys/dev/ic/rtl81x9reg.h | 3 | ||||
-rw-r--r-- | sys/dev/pci/if_re_pci.c | 29 |
2 files changed, 24 insertions, 8 deletions
diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h index c5005ffcda6..beed9c8d3e8 100644 --- a/sys/dev/ic/rtl81x9reg.h +++ b/sys/dev/ic/rtl81x9reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9reg.h,v 1.77 2013/10/11 14:00:18 jsg Exp $ */ +/* $OpenBSD: rtl81x9reg.h,v 1.78 2013/11/18 22:21:27 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -425,6 +425,7 @@ #define RL_CFG2_PCI_66MHZ 0x01 #define RL_CFG2_PCI_64BIT 0x08 #define RL_CFG2_AUXPWR 0x10 +#define RL_CFG2_MSI 0x20 /* * Config 3 register diff --git a/sys/dev/pci/if_re_pci.c b/sys/dev/pci/if_re_pci.c index d213a086f1f..5661a5eab06 100644 --- a/sys/dev/pci/if_re_pci.c +++ b/sys/dev/pci/if_re_pci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_re_pci.c,v 1.39 2013/08/07 01:06:36 bluhm Exp $ */ +/* $OpenBSD: if_re_pci.c,v 1.40 2013/11/18 22:21:27 brad Exp $ */ /* * Copyright (c) 2005 Peter Valchev <pvalchev@openbsd.org> @@ -135,11 +135,6 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) pci_intr_handle_t ih; const char *intrstr = NULL; - /* Only enable MSI on RT810xE for now. */ - if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_REALTEK || - PCI_PRODUCT(pa->pa_id) != PCI_PRODUCT_REALTEK_RT8101E) - pa->pa_flags &= ~PCI_FLAGS_MSI_ENABLED; - pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); #ifndef SMALL_KERNEL @@ -160,7 +155,9 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) } /* Allocate interrupt */ - if (pci_intr_map_msi(pa, &ih) != 0 && pci_intr_map(pa, &ih) != 0) { + if (pci_intr_map_msi(pa, &ih) == 0) + sc->rl_flags |= RL_FLAG_MSI; + else if (pci_intr_map(pa, &ih) != 0) { printf(": couldn't map interrupt\n"); return; } @@ -184,6 +181,24 @@ re_pci_attach(struct device *parent, struct device *self, void *aux) NULL, NULL)) sc->rl_flags |= RL_FLAG_PCIE; + if (!(PCI_VENDOR(pa->pa_id) == PCI_VENDOR_REALTEK && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_REALTEK_RT8139)) { + u_int8_t cfg; + + CSR_WRITE_1(sc, RL_EECMD, RL_EE_MODE); + cfg = CSR_READ_1(sc, RL_CFG2); + if (sc->rl_flags & RL_FLAG_MSI) { + cfg |= RL_CFG2_MSI; + CSR_WRITE_1(sc, RL_CFG2, cfg); + } else { + if ((cfg & RL_CFG2_MSI) != 0) { + cfg &= ~RL_CFG2_MSI; + CSR_WRITE_1(sc, RL_CFG2, cfg); + } + } + CSR_WRITE_1(sc, RL_EECMD, RL_EEMODE_OFF); + } + /* Call bus-independent attach routine */ if (re_attach(sc, intrstr)) { pci_intr_disestablish(pc, psc->sc_ih); |