aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-10-25 23:40:09 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-25 23:40:09 -0400
commit6693e74a16ef563960764bd963f1048392135c3c (patch)
tree3ac1062a4b91270c0ea70eda6b802d1a2c74c2bf
parent5ed688a7162ff8d28d7cf98b34a1f825e4c2c2ac (diff)
PCI: be more verbose about resource quirks
When reserving an PCI quirk, note that in the kernel bootup messages. Also, parse the strange PIIX4 device resources - they should get their own PCI resource quirks, but for now just print out what it finds to verify that the code does the right thing. Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/pci/quirks.c101
1 files changed, 88 insertions, 13 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index a6a630a950d0..7992bc8cc6a4 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -241,7 +241,8 @@ static void __devinit quirk_s3_64M(struct pci_dev *dev)
241DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M ); 241DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_868, quirk_s3_64M );
242DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M ); 242DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_S3, PCI_DEVICE_ID_S3_968, quirk_s3_64M );
243 243
244static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsigned size, int nr) 244static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region,
245 unsigned size, int nr, const char *name)
245{ 246{
246 region &= ~(size-1); 247 region &= ~(size-1);
247 if (region) { 248 if (region) {
@@ -259,6 +260,7 @@ static void __devinit quirk_io_region(struct pci_dev *dev, unsigned region, unsi
259 pcibios_bus_to_resource(dev, res, &bus_region); 260 pcibios_bus_to_resource(dev, res, &bus_region);
260 261
261 pci_claim_resource(dev, nr); 262 pci_claim_resource(dev, nr);
263 printk("PCI quirk: region %04x-%04x claimed by %s\n", region, region + size - 1, name);
262 } 264 }
263} 265}
264 266
@@ -291,25 +293,98 @@ static void __devinit quirk_ali7101_acpi(struct pci_dev *dev)
291 u16 region; 293 u16 region;
292 294
293 pci_read_config_word(dev, 0xE0, &region); 295 pci_read_config_word(dev, 0xE0, &region);
294 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); 296 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "ali7101 ACPI");
295 pci_read_config_word(dev, 0xE2, &region); 297 pci_read_config_word(dev, 0xE2, &region);
296 quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); 298 quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "ali7101 SMB");
297} 299}
298DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi ); 300DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, quirk_ali7101_acpi );
299 301
302static void piix4_io_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
303{
304 u32 devres;
305 u32 mask, size, base;
306
307 pci_read_config_dword(dev, port, &devres);
308 if ((devres & enable) != enable)
309 return;
310 mask = (devres >> 16) & 15;
311 base = devres & 0xffff;
312 size = 16;
313 for (;;) {
314 unsigned bit = size >> 1;
315 if ((bit & mask) == bit)
316 break;
317 size = bit;
318 }
319 /*
320 * For now we only print it out. Eventually we'll want to
321 * reserve it (at least if it's in the 0x1000+ range), but
322 * let's get enough confirmation reports first.
323 */
324 base &= -size;
325 printk("%s PIO at %04x-%04x\n", name, base, base + size - 1);
326}
327
328static void piix4_mem_quirk(struct pci_dev *dev, const char *name, unsigned int port, unsigned int enable)
329{
330 u32 devres;
331 u32 mask, size, base;
332
333 pci_read_config_dword(dev, port, &devres);
334 if ((devres & enable) != enable)
335 return;
336 base = devres & 0xffff0000;
337 mask = (devres & 0x3f) << 16;
338 size = 128 << 16;
339 for (;;) {
340 unsigned bit = size >> 1;
341 if ((bit & mask) == bit)
342 break;
343 size = bit;
344 }
345 /*
346 * For now we only print it out. Eventually we'll want to
347 * reserve it, but let's get enough confirmation reports first.
348 */
349 base &= -size;
350 printk("%s MMIO at %04x-%04x\n", name, base, base + size - 1);
351}
352
300/* 353/*
301 * PIIX4 ACPI: Two IO regions pointed to by longwords at 354 * PIIX4 ACPI: Two IO regions pointed to by longwords at
302 * 0x40 (64 bytes of ACPI registers) 355 * 0x40 (64 bytes of ACPI registers)
303 * 0x90 (32 bytes of SMB registers) 356 * 0x90 (32 bytes of SMB registers)
357 * and a few strange programmable PIIX4 device resources.
304 */ 358 */
305static void __devinit quirk_piix4_acpi(struct pci_dev *dev) 359static void __devinit quirk_piix4_acpi(struct pci_dev *dev)
306{ 360{
307 u32 region; 361 u32 region, res_a;
308 362
309 pci_read_config_dword(dev, 0x40, &region); 363 pci_read_config_dword(dev, 0x40, &region);
310 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES); 364 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES, "PIIX4 ACPI");
311 pci_read_config_dword(dev, 0x90, &region); 365 pci_read_config_dword(dev, 0x90, &region);
312 quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1); 366 quirk_io_region(dev, region, 32, PCI_BRIDGE_RESOURCES+1, "PIIX4 SMB");
367
368 /* Device resource A has enables for some of the other ones */
369 pci_read_config_dword(dev, 0x5c, &res_a);
370
371 piix4_io_quirk(dev, "PIIX4 devres B", 0x60, 3 << 21);
372 piix4_io_quirk(dev, "PIIX4 devres C", 0x64, 3 << 21);
373
374 /* Device resource D is just bitfields for static resources */
375
376 /* Device 12 enabled? */
377 if (res_a & (1 << 29)) {
378 piix4_io_quirk(dev, "PIIX4 devres E", 0x68, 1 << 20);
379 piix4_mem_quirk(dev, "PIIX4 devres F", 0x6c, 1 << 7);
380 }
381 /* Device 13 enabled? */
382 if (res_a & (1 << 30)) {
383 piix4_io_quirk(dev, "PIIX4 devres G", 0x70, 1 << 20);
384 piix4_mem_quirk(dev, "PIIX4 devres H", 0x74, 1 << 7);
385 }
386 piix4_io_quirk(dev, "PIIX4 devres I", 0x78, 1 << 20);
387 piix4_io_quirk(dev, "PIIX4 devres J", 0x7c, 1 << 20);
313} 388}
314DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi ); 389DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, quirk_piix4_acpi );
315 390
@@ -323,10 +398,10 @@ static void __devinit quirk_ich4_lpc_acpi(struct pci_dev *dev)
323 u32 region; 398 u32 region;
324 399
325 pci_read_config_dword(dev, 0x40, &region); 400 pci_read_config_dword(dev, 0x40, &region);
326 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES); 401 quirk_io_region(dev, region, 128, PCI_BRIDGE_RESOURCES, "ICH4 ACPI/GPIO/TCO");
327 402
328 pci_read_config_dword(dev, 0x58, &region); 403 pci_read_config_dword(dev, 0x58, &region);
329 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1); 404 quirk_io_region(dev, region, 64, PCI_BRIDGE_RESOURCES+1, "ICH4 GPIO");
330} 405}
331DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi ); 406DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, quirk_ich4_lpc_acpi );
332DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi ); 407DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, quirk_ich4_lpc_acpi );
@@ -352,7 +427,7 @@ static void __devinit quirk_vt82c586_acpi(struct pci_dev *dev)
352 if (rev & 0x10) { 427 if (rev & 0x10) {
353 pci_read_config_dword(dev, 0x48, &region); 428 pci_read_config_dword(dev, 0x48, &region);
354 region &= PCI_BASE_ADDRESS_IO_MASK; 429 region &= PCI_BASE_ADDRESS_IO_MASK;
355 quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES); 430 quirk_io_region(dev, region, 256, PCI_BRIDGE_RESOURCES, "vt82c586 ACPI");
356 } 431 }
357} 432}
358DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi ); 433DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C586_3, quirk_vt82c586_acpi );
@@ -372,11 +447,11 @@ static void __devinit quirk_vt82c686_acpi(struct pci_dev *dev)
372 447
373 pci_read_config_word(dev, 0x70, &hm); 448 pci_read_config_word(dev, 0x70, &hm);
374 hm &= PCI_BASE_ADDRESS_IO_MASK; 449 hm &= PCI_BASE_ADDRESS_IO_MASK;
375 quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1); 450 quirk_io_region(dev, hm, 128, PCI_BRIDGE_RESOURCES + 1, "vt82c868 HW-mon");
376 451
377 pci_read_config_dword(dev, 0x90, &smb); 452 pci_read_config_dword(dev, 0x90, &smb);
378 smb &= PCI_BASE_ADDRESS_IO_MASK; 453 smb &= PCI_BASE_ADDRESS_IO_MASK;
379 quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2); 454 quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 2, "vt82c868 SMB");
380} 455}
381DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi ); 456DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4, quirk_vt82c686_acpi );
382 457
@@ -391,11 +466,11 @@ static void __devinit quirk_vt8235_acpi(struct pci_dev *dev)
391 466
392 pci_read_config_word(dev, 0x88, &pm); 467 pci_read_config_word(dev, 0x88, &pm);
393 pm &= PCI_BASE_ADDRESS_IO_MASK; 468 pm &= PCI_BASE_ADDRESS_IO_MASK;
394 quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES); 469 quirk_io_region(dev, pm, 128, PCI_BRIDGE_RESOURCES, "vt8235 PM");
395 470
396 pci_read_config_word(dev, 0xd0, &smb); 471 pci_read_config_word(dev, 0xd0, &smb);
397 smb &= PCI_BASE_ADDRESS_IO_MASK; 472 smb &= PCI_BASE_ADDRESS_IO_MASK;
398 quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1); 473 quirk_io_region(dev, smb, 16, PCI_BRIDGE_RESOURCES + 1, "vt8235 SMB");
399} 474}
400DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi); 475DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235, quirk_vt8235_acpi);
401 476