Introduce two new tunables from the boot loader.
hw.pcic.irq Globally set the IRQ for all pcic devices' management interrupt (aka card status change or CSC interrupt) This is what used to be known as machdep.pccard.pcic_irq (which has been retained for now for compatibility). hw.pcic.ignore_fuction_1 Ignores function 1 for all PCIC bridges by not attaching to them. Lucent released a huge batch of cards that were imporperly manufactuered (lacking the 0 ohm resister to disable slot 1). This is a big hammer to keep those cards from causing problems (I've had 4 people contact me saying my patches worked great once they added a kludge to always ignore function 1, or until they soldered these resistors in place!). No clue where to document these. They act as both boot loader environment variables, as well as read-only sysctls after boot. At the same time, sort sys/systm.h in its proper order after sys/sysctl.h.
This commit is contained in:
parent
a4806cd1df
commit
d13600a5af
@ -32,9 +32,10 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <pccard/i82365.h>
|
||||
#include <pccard/pcic_pci.h>
|
||||
@ -76,6 +77,9 @@ static struct slot_ctrl pcic_cinfo = {
|
||||
PCIC_IO_WIN
|
||||
};
|
||||
|
||||
/* sysctl vars */
|
||||
SYSCTL_NODE(_hw, OID_AUTO, pcic, CTLFLAG_RD, 0, "PCIC parameters");
|
||||
|
||||
/*
|
||||
* Read a register from the PCIC.
|
||||
*/
|
||||
|
@ -26,9 +26,10 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#include <pccard/i82365.h>
|
||||
#include <pccard/cardinfo.h>
|
||||
@ -78,6 +79,16 @@ static driver_intr_t pcicintr;
|
||||
static int pcicintr1(void *);
|
||||
static timeout_t pcictimeout;
|
||||
|
||||
|
||||
static int pcic_override_irq = 0;
|
||||
TUNABLE_INT("machdep.pccard.pcic_irq", &pcic_override_irq);
|
||||
TUNABLE_INT("hw.pcic.irq", &pcic_override_irq);
|
||||
SYSCTL_DECL(_hw_pcic);
|
||||
SYSCTL_INT(_hw_pcic, OID_AUTO, override_irq, CTLFLAG_RD,
|
||||
&pcic_override_irq, 0,
|
||||
"Override the IRQ configured by the config system for all pcic devices");
|
||||
|
||||
|
||||
/*
|
||||
* Look for an Intel PCIC (or compatible).
|
||||
* For each available slot, allocate a PC-CARD slot.
|
||||
@ -298,11 +309,10 @@ pcic_isa_attach(device_t dev)
|
||||
rid = 0;
|
||||
r = NULL;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1, RF_ACTIVE);
|
||||
if (r == NULL) {
|
||||
/* See if the user has requested a specific IRQ */
|
||||
if (getenv_int("machdep.pccard.pcic_irq", &irq))
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid,
|
||||
irq, irq, 1, RF_ACTIVE);
|
||||
if (r == NULL && pcic_override_irq != 0) {
|
||||
irq = pcic_override_irq;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq, irq, 1,
|
||||
RF_ACTIVE);
|
||||
}
|
||||
if (r && ((1 << (rman_get_start(r))) & PCIC_INT_MASK_ALLOWED) == 0) {
|
||||
device_printf(dev,
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
#if __FreeBSD_version < 500000
|
||||
@ -52,10 +53,19 @@
|
||||
#include <dev/pccard/pccardvar.h>
|
||||
#include "card_if.h"
|
||||
|
||||
#define PRVERB(x) if (bootverbose) device_printf x
|
||||
#define PRVERB(x) do { \
|
||||
if (bootverbose) { device_printf x; } \
|
||||
} while (0)
|
||||
|
||||
static int pcic_pci_get_memory(device_t dev);
|
||||
|
||||
static int pcic_ignore_function_1 = 0;
|
||||
TUNABLE_INT("hw.pcic.ignore_function_1", &pcic_ignore_function_1);
|
||||
SYSCTL_DECL(_hw_pcic);
|
||||
SYSCTL_INT(_hw_pcic, OID_AUTO, ignore_function_1, CTLFLAG_RD,
|
||||
&pcic_ignore_function_1, 0,
|
||||
"When set, driver ignores pci function 1 of the bridge");
|
||||
|
||||
struct pcic_pci_table
|
||||
{
|
||||
u_int32_t devid;
|
||||
@ -430,6 +440,11 @@ pcic_pci_probe(device_t dev)
|
||||
struct resource *res;
|
||||
int rid;
|
||||
|
||||
if (pcic_ignore_function_1 && pci_get_function(dev) == 1) {
|
||||
PRVERB((dev, "Ignoring function 1\n"));
|
||||
return (ENXIO);
|
||||
}
|
||||
|
||||
device_id = pci_get_devid(dev);
|
||||
desc = NULL;
|
||||
itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
|
||||
|
Loading…
Reference in New Issue
Block a user