diff options
-rw-r--r-- | drivers/pnp/quirks.c | 66 |
1 files changed, 48 insertions, 18 deletions
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 277df50c89ae..967a8e22b2da 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -107,31 +107,61 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev) | |||
107 | return; | 107 | return; |
108 | } | 108 | } |
109 | 109 | ||
110 | static void quirk_smc_enable(struct pnp_dev *dev) | 110 | static int quirk_smc_fir_enabled(struct pnp_dev *dev) |
111 | { | 111 | { |
112 | unsigned int firbase; | 112 | unsigned long firbase; |
113 | u8 bank, high, low, chip; | ||
114 | |||
115 | if (!pnp_port_valid(dev, 1)) | ||
116 | return 0; | ||
117 | |||
118 | firbase = pnp_port_start(dev, 1); | ||
119 | |||
120 | /* Select register bank 3 */ | ||
121 | bank = inb(firbase + 7); | ||
122 | bank &= 0xf0; | ||
123 | bank |= 3; | ||
124 | outb(bank, firbase + 7); | ||
125 | |||
126 | high = inb(firbase + 0); | ||
127 | low = inb(firbase + 1); | ||
128 | chip = inb(firbase + 2); | ||
129 | |||
130 | /* This corresponds to the check in smsc_ircc_present() */ | ||
131 | if (high == 0x10 && low == 0xb8 && (chip == 0xf1 || chip == 0xf2)) | ||
132 | return 1; | ||
133 | |||
134 | return 0; | ||
135 | } | ||
113 | 136 | ||
114 | if (!dev->active || !pnp_port_valid(dev, 1)) | 137 | static void quirk_smc_enable(struct pnp_dev *dev) |
138 | { | ||
139 | /* | ||
140 | * If the BIOS left the device disabled, or it is enabled and | ||
141 | * responding correctly, we're in good shape. | ||
142 | */ | ||
143 | if (!dev->active || quirk_smc_fir_enabled(dev)) | ||
115 | return; | 144 | return; |
116 | 145 | ||
117 | /* | 146 | /* |
118 | * On the HP/Compaq nw8240 (and probably other similar machines), | 147 | * Sometimes the BIOS claims the device is enabled, but it reports |
119 | * there is an SMCF010 device with two I/O port regions: | 148 | * the wrong FIR resources or doesn't properly configure ISA or LPC |
120 | * | 149 | * bridges on the way to the device. |
121 | * 0x3e8-0x3ef SIR | ||
122 | * 0x100-0x10f FIR | ||
123 | * | 150 | * |
124 | * _STA reports the device is enabled, but in fact, the BIOS | 151 | * HP nc6000 and nc8000/nw8000 laptops have known problems like |
125 | * neglects to enable the FIR range. Fortunately, it does fully | 152 | * this. Fortunately, they do fix things up if we auto-configure |
126 | * enable the device if we call _SRS. | 153 | * the device using its _PRS and _SRS methods. |
127 | */ | 154 | */ |
128 | firbase = pnp_port_start(dev, 1); | 155 | dev_err(&dev->dev, "%s device not responding, auto-configuring " |
129 | if (inb(firbase + 0x7 /* IRCC_MASTER */) == 0xff) { | 156 | "resources\n", dev->id->id); |
130 | pnp_err("%s (%s) enabled but not responding, disabling and " | 157 | |
131 | "re-enabling", dev->dev.bus_id, pnp_dev_name(dev)); | 158 | pnp_disable_dev(dev); |
132 | pnp_disable_dev(dev); | 159 | pnp_init_resource_table(&dev->res); |
133 | pnp_activate_dev(dev); | 160 | pnp_auto_config_dev(dev); |
134 | } | 161 | pnp_activate_dev(dev); |
162 | |||
163 | if (!quirk_smc_fir_enabled(dev)) | ||
164 | dev_err(&dev->dev, "giving up; try \"smsc-ircc2.nopnp\"\n"); | ||
135 | } | 165 | } |
136 | 166 | ||
137 | 167 | ||