aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/quirks.c
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:43:54 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-10-13 09:43:54 -0400
commitb160292cc216a50fd0cd386b0bda2cd48352c73b (patch)
treeef07cf98f91353ee4c9ec1e1ca7a2a5d9d4b538a /drivers/pnp/quirks.c
parentb37bde147890c8fea8369a5a4e230dabdea4ebfb (diff)
parentbbf25010f1a6b761914430f5fca081ec8c7accd1 (diff)
Merge Linux 2.6.23
Diffstat (limited to 'drivers/pnp/quirks.c')
-rw-r--r--drivers/pnp/quirks.c103
1 files changed, 0 insertions, 103 deletions
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c
index 90755d4cdb9f..6b0cf0c2a088 100644
--- a/drivers/pnp/quirks.c
+++ b/drivers/pnp/quirks.c
@@ -107,108 +107,6 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
107 "pnp: SB audio device quirk - increasing port range\n"); 107 "pnp: SB audio device quirk - increasing port range\n");
108} 108}
109 109
110static int quirk_smc_fir_enabled(struct pnp_dev *dev)
111{
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}
136
137static void quirk_smc_enable(struct pnp_dev *dev)
138{
139 struct resource fir, sir, irq;
140
141 pnp_activate_dev(dev);
142 if (quirk_smc_fir_enabled(dev))
143 return;
144
145 /*
146 * Sometimes the BIOS claims the device is enabled, but it reports
147 * the wrong FIR resources or doesn't properly configure ISA or LPC
148 * bridges on the way to the device.
149 *
150 * HP nc6000 and nc8000/nw8000 laptops have known problems like
151 * this. Fortunately, they do fix things up if we auto-configure
152 * the device using its _PRS and _SRS methods.
153 */
154 dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; "
155 "auto-configuring\n", dev->id->id,
156 (unsigned long)pnp_port_start(dev, 0),
157 (unsigned long)pnp_port_start(dev, 1));
158
159 pnp_disable_dev(dev);
160 pnp_init_resource_table(&dev->res);
161 pnp_auto_config_dev(dev);
162 pnp_activate_dev(dev);
163 if (quirk_smc_fir_enabled(dev)) {
164 dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
165 (unsigned long)pnp_port_start(dev, 0),
166 (unsigned long)pnp_port_start(dev, 1));
167 return;
168 }
169
170 /*
171 * The Toshiba Portege 4000 _CRS reports the FIR region first,
172 * followed by the SIR region. The BIOS will configure the bridge,
173 * but only if we call _SRS with SIR first, then FIR. It also
174 * reports the IRQ as active high, when it is really active low.
175 */
176 dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; "
177 "swapping SIR/FIR and reconfiguring\n",
178 (unsigned long)pnp_port_start(dev, 0),
179 (unsigned long)pnp_port_start(dev, 1));
180
181 /*
182 * Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign
183 * these resources any more.
184 */
185 fir = dev->res.port_resource[0];
186 sir = dev->res.port_resource[1];
187 fir.flags &= ~IORESOURCE_AUTO;
188 sir.flags &= ~IORESOURCE_AUTO;
189
190 irq = dev->res.irq_resource[0];
191 irq.flags &= ~IORESOURCE_AUTO;
192 irq.flags &= ~IORESOURCE_BITS;
193 irq.flags |= IORESOURCE_IRQ_LOWEDGE;
194
195 pnp_disable_dev(dev);
196 dev->res.port_resource[0] = sir;
197 dev->res.port_resource[1] = fir;
198 dev->res.irq_resource[0] = irq;
199 pnp_activate_dev(dev);
200
201 if (quirk_smc_fir_enabled(dev)) {
202 dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
203 (unsigned long)pnp_port_start(dev, 0),
204 (unsigned long)pnp_port_start(dev, 1));
205 return;
206 }
207
208 dev_err(&dev->dev, "giving up; try \"smsc-ircc2.nopnp\" and "
209 "email bjorn.helgaas@hp.com\n");
210}
211
212/* 110/*
213 * PnP Quirks 111 * PnP Quirks
214 * Cards or devices that need some tweaking due to incomplete resource info 112 * Cards or devices that need some tweaking due to incomplete resource info
@@ -229,7 +127,6 @@ static struct pnp_fixup pnp_fixups[] = {
229 {"CTL0043", quirk_sb16audio_resources}, 127 {"CTL0043", quirk_sb16audio_resources},
230 {"CTL0044", quirk_sb16audio_resources}, 128 {"CTL0044", quirk_sb16audio_resources},
231 {"CTL0045", quirk_sb16audio_resources}, 129 {"CTL0045", quirk_sb16audio_resources},
232 {"SMCf010", quirk_smc_enable},
233 {""} 130 {""}
234}; 131};
235 132