Date: Sun, 6 Jan 2013 20:50:31 +0000 (UTC) From: Monthadar Al Jaberi <monthadar@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r245112 - head/sys/mips/atheros Message-ID: <201301062050.r06KoVQV043024@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: monthadar Date: Sun Jan 6 20:50:31 2013 New Revision: 245112 URL: http://svnweb.freebsd.org/changeset/base/245112 Log: Mips Atheros AR71XX: make PCI base slot configurable through hints. * Mikrotik RouterBoard 433AH have PCI slot 18 wired to INT0 on the PCI Bus. This is different from e.g. Atheros PB42 and Ubiquiti boards. * Check for hint hint.pcib.0.baseslot=X, where X is number of base slot; * If hint not supplied print a warning and use default AR71XX_PCI_BASE_SLOT; PR: kern/174978 Approved by: adrian (mentor) Modified: head/sys/mips/atheros/ar71xx_pci.c Modified: head/sys/mips/atheros/ar71xx_pci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_pci.c Sun Jan 6 19:27:28 2013 (r245111) +++ head/sys/mips/atheros/ar71xx_pci.c Sun Jan 6 20:50:31 2013 (r245112) @@ -81,6 +81,7 @@ struct ar71xx_pci_softc { device_t sc_dev; int sc_busno; + int sc_baseslot; struct rman sc_mem_rman; struct rman sc_irq_rman; @@ -395,6 +396,16 @@ ar71xx_pci_attach(device_t dev) AR71XX_PCI_IRQ_END) != 0) panic("ar71xx_pci_attach: failed to set up IRQ rman"); + /* + * Check if there is a base slot hint. Otherwise use default value. + */ + if (resource_int_value(device_get_name(dev), + device_get_unit(dev), "baseslot", &sc->sc_baseslot) != 0) { + device_printf(dev, + "%s: missing hint '%s', default to AR71XX_PCI_BASE_SLOT\n", + __func__, "baseslot"); + sc->sc_baseslot = AR71XX_PCI_BASE_SLOT; + } ATH_WRITE_REG(AR71XX_PCI_INTR_STATUS, 0); ATH_WRITE_REG(AR71XX_PCI_INTR_MASK, 0); @@ -648,11 +659,13 @@ ar71xx_pci_maxslots(device_t dev) static int ar71xx_pci_route_interrupt(device_t pcib, device_t device, int pin) { - if (pci_get_slot(device) < AR71XX_PCI_BASE_SLOT) + struct ar71xx_pci_softc *sc = device_get_softc(pcib); + + if (pci_get_slot(device) < sc->sc_baseslot) panic("%s: PCI slot %d is less then AR71XX_PCI_BASE_SLOT", __func__, pci_get_slot(device)); - return (pci_get_slot(device) - AR71XX_PCI_BASE_SLOT); + return (pci_get_slot(device) - sc->sc_baseslot); } static device_method_t ar71xx_pci_methods[] = {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301062050.r06KoVQV043024>