/proc/pci cleanup

Martin Mares (mj@mj.gts.cz)
Sun, 28 Dec 1997 13:39:01 +0100


Hi,

I tried to finally clean up the whole /proc/pci mess. The whole proc
interface got replaced by /proc/bus/pci containing a textual summary file
and per-device files to access PCI config registers (PCI config space
access now available for user-mode programs on all architectures which
was impossible before). /proc/pci remains as an optional compatibility
glue (unfortunately, few programs try to parse it). No more kernel bloat
with large device name tables (saving more than 16K).

This patch requires the BITS_PER_LONG patch sent some minutes ago.

For human-readable PCI device listing, use the 'lspci' utility from
the Linux PCI Utilities package (now available at ftp://atrey.karlin.mff.cuni.cz/
pub/local/mj/linux/pciutils-0.9.tar.gz, soon to appear at Sunsite, too).
It shows much more information than the original /proc/pci, including
a device tree diagram :-)

Happy New Year

-- 
Martin `MJ' Mares   <mj@gts.cz>   http://atrey.karlin.mff.cuni.cz/~mj/
Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth
"And don't forget to feed your computer virus..."

diff -ruN /usr/src/linux-2.1/drivers/pci/Makefile drivers/pci/Makefile --- /usr/src/linux-2.1/drivers/pci/Makefile Mon Dec 22 10:36:27 1997 +++ drivers/pci/Makefile Mon Dec 22 21:46:21 1997 @@ -12,7 +12,14 @@ L_OBJS := pci.o L_TARGET := pci.a -ifeq ($(CONFIG_PCI_OPTIMIZE),y) +ifdef CONFIG_PROC_FS +L_OBJS += proc.o +ifdef CONFIG_PCI_OLD_PROC +L_OBJS += oldproc.o +endif +endif + +ifdef CONFIG_PCI_OPTIMIZE L_OBJS += quirks.o endif diff -ruN /usr/src/linux-2.1/drivers/pci/oldproc.c drivers/pci/oldproc.c --- /usr/src/linux-2.1/drivers/pci/oldproc.c Thu Jan 1 01:00:00 1970 +++ drivers/pci/oldproc.c Sat Dec 27 14:56:32 1997 @@ -0,0 +1,871 @@ +/* + * $Id: oldproc.c,v 1.3 1997/12/27 13:55:12 mj Exp $ + * + * Backward-compatible procfs interface for PCI. + * + * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter, + * David Mosberger-Tang, Martin Mares + */ + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/bios32.h> +#include <linux/pci.h> +#include <linux/string.h> +#include <linux/sched.h> +#include <asm/page.h> + +#ifdef CONFIG_PROC_FS + +struct pci_dev_info { + unsigned short vendor; /* vendor id */ + unsigned short device; /* device id */ + + const char *name; /* device name */ +}; + +#define DEVICE(vid,did,name) \ + {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name)} + +/* + * Sorted in ascending order by vendor and device. + * Use binary search for lookup. If you add a device make sure + * it is sequential by both vendor and device id. + */ +struct pci_dev_info dev_info[] = { + DEVICE( COMPAQ, COMPAQ_1280, "QVision 1280/p"), + DEVICE( COMPAQ, COMPAQ_SMART2P, "Smart-2/P RAID Controller"), + DEVICE( COMPAQ, COMPAQ_NETEL100,"Netelligent 10/100"), + DEVICE( COMPAQ, COMPAQ_NETEL10, "Netelligent 10"), + DEVICE( COMPAQ, COMPAQ_NETFLEX3I,"NetFlex 3"), + DEVICE( COMPAQ, COMPAQ_NETEL100D,"Netelligent 10/100 Dual"), + DEVICE( COMPAQ, COMPAQ_NETEL100PI,"Netelligent 10/100 ProLiant"), + DEVICE( COMPAQ, COMPAQ_NETEL100I,"Netelligent 10/100 Integrated"), + DEVICE( COMPAQ, COMPAQ_THUNDER, "ThunderLAN"), + DEVICE( COMPAQ, COMPAQ_NETFLEX3B,"NetFlex 3 BNC"), + DEVICE( NCR, NCR_53C810, "53c810"), + DEVICE( NCR, NCR_53C820, "53c820"), + DEVICE( NCR, NCR_53C825, "53c825"), + DEVICE( NCR, NCR_53C815, "53c815"), + DEVICE( NCR, NCR_53C860, "53c860"), + DEVICE( NCR, NCR_53C896, "53c896"), + DEVICE( NCR, NCR_53C895, "53c895"), + DEVICE( NCR, NCR_53C885, "53c885"), + DEVICE( NCR, NCR_53C875, "53c875"), + DEVICE( NCR, NCR_53C875J, "53c875J"), + DEVICE( ATI, ATI_68800, "68800AX"), + DEVICE( ATI, ATI_215CT222, "215CT222"), + DEVICE( ATI, ATI_210888CX, "210888CX"), + DEVICE( ATI, ATI_215GB, "Mach64 GB"), + DEVICE( ATI, ATI_215GD, "Mach64 GD (Rage Pro)"), + DEVICE( ATI, ATI_215GP, "Mach64 GP (Rage Pro)"), + DEVICE( ATI, ATI_215GT, "Mach64 GT (Rage II)"), + DEVICE( ATI, ATI_215GTB, "Mach64 GT (Rage II)"), + DEVICE( ATI, ATI_210888GX, "210888GX"), + DEVICE( ATI, ATI_264VT, "Mach64 VT"), + DEVICE( VLSI, VLSI_82C592, "82C592-FC1"), + DEVICE( VLSI, VLSI_82C593, "82C593-FC1"), + DEVICE( VLSI, VLSI_82C594, "82C594-AFC2"), + DEVICE( VLSI, VLSI_82C597, "82C597-AFC2"), + DEVICE( VLSI, VLSI_82C541, "82C541 Lynx"), + DEVICE( VLSI, VLSI_82C543, "82C543 Lynx ISA"), + DEVICE( VLSI, VLSI_VAS96011, "VAS96011 (Golden Gate II)"), + DEVICE( ADL, ADL_2301, "2301"), + DEVICE( NS, NS_87415, "87415"), + DEVICE( NS, NS_87410, "87410"), + DEVICE( TSENG, TSENG_W32P_2, "ET4000W32P"), + DEVICE( TSENG, TSENG_W32P_b, "ET4000W32P rev B"), + DEVICE( TSENG, TSENG_W32P_c, "ET4000W32P rev C"), + DEVICE( TSENG, TSENG_W32P_d, "ET4000W32P rev D"), + DEVICE( TSENG, TSENG_ET6000, "ET6000"), + DEVICE( WEITEK, WEITEK_P9000, "P9000"), + DEVICE( WEITEK, WEITEK_P9100, "P9100"), + DEVICE( DEC, DEC_BRD, "DC21050"), + DEVICE( DEC, DEC_TULIP, "DC21040"), + DEVICE( DEC, DEC_TGA, "TGA"), + DEVICE( DEC, DEC_TULIP_FAST, "DC21140"), + DEVICE( DEC, DEC_TGA2, "TGA2"), + DEVICE( DEC, DEC_FDDI, "DEFPA"), + DEVICE( DEC, DEC_TULIP_PLUS, "DC21041"), + DEVICE( DEC, DEC_21142, "DC21142"), + DEVICE( DEC, DEC_21052, "DC21052"), + DEVICE( DEC, DEC_21152, "DC21152"), + DEVICE( CIRRUS, CIRRUS_7548, "GD 7548"), + DEVICE( CIRRUS, CIRRUS_5430, "GD 5430"), + DEVICE( CIRRUS, CIRRUS_5434_4, "GD 5434"), + DEVICE( CIRRUS, CIRRUS_5434_8, "GD 5434"), + DEVICE( CIRRUS, CIRRUS_5436, "GD 5436"), + DEVICE( CIRRUS, CIRRUS_5446, "GD 5446"), + DEVICE( CIRRUS, CIRRUS_5480, "GD 5480"), + DEVICE( CIRRUS, CIRRUS_5464, "GD 5464"), + DEVICE( CIRRUS, CIRRUS_5465, "GD 5465"), + DEVICE( CIRRUS, CIRRUS_6729, "CL 6729"), + DEVICE( CIRRUS, CIRRUS_6832, "PD 6832"), + DEVICE( CIRRUS, CIRRUS_7542, "CL 7542"), + DEVICE( CIRRUS, CIRRUS_7543, "CL 7543"), + DEVICE( CIRRUS, CIRRUS_7541, "CL 7541"), + DEVICE( IBM, IBM_FIRE_CORAL, "Fire Coral"), + DEVICE( IBM, IBM_TR, "Token Ring"), + DEVICE( IBM, IBM_82G2675, "82G2675"), + DEVICE( IBM, IBM_82351, "82351"), + DEVICE( WD, WD_7197, "WD 7197"), + DEVICE( AMD, AMD_LANCE, "79C970"), + DEVICE( AMD, AMD_SCSI, "53C974"), + DEVICE( TRIDENT, TRIDENT_9420, "TG 9420"), + DEVICE( TRIDENT, TRIDENT_9440, "TG 9440"), + DEVICE( TRIDENT, TRIDENT_9660, "TG 9660 / Cyber9385"), + DEVICE( TRIDENT, TRIDENT_9750, "Image 975"), + DEVICE( AI, AI_M1435, "M1435"), + DEVICE( MATROX, MATROX_MGA_2, "Atlas PX2085"), + DEVICE( MATROX, MATROX_MIL, "Millennium"), + DEVICE( MATROX, MATROX_MYS, "Mystique"), + DEVICE( MATROX, MATROX_MIL_2, "Millennium II"), + DEVICE( MATROX, MATROX_MGA_IMP, "MGA Impression"), + DEVICE( CT, CT_65545, "65545"), + DEVICE( CT, CT_65548, "65548"), + DEVICE( CT, CT_65550, "65550"), + DEVICE( CT, CT_65554, "65554"), + DEVICE( MIRO, MIRO_36050, "ZR36050"), + DEVICE( NEC, NEC_PCX2, "PowerVR PCX2"), + DEVICE( FD, FD_36C70, "TMC-18C30"), + DEVICE( SI, SI_6201, "6201"), + DEVICE( SI, SI_6202, "6202"), + DEVICE( SI, SI_503, "85C503"), + DEVICE( SI, SI_6205, "6205"), + DEVICE( SI, SI_501, "85C501"), + DEVICE( SI, SI_496, "85C496"), + DEVICE( SI, SI_601, "85C601"), + DEVICE( SI, SI_5107, "5107"), + DEVICE( SI, SI_5511, "85C5511"), + DEVICE( SI, SI_5513, "85C5513"), + DEVICE( SI, SI_5571, "5571"), + DEVICE( SI, SI_5597, "5597"), + DEVICE( SI, SI_7001, "7001"), + DEVICE( HP, HP_J2585A, "J2585A"), + DEVICE( HP, HP_J2585B, "J2585B (Lassen)"), + DEVICE( PCTECH, PCTECH_RZ1000, "RZ1000 (buggy)"), + DEVICE( PCTECH, PCTECH_RZ1001, "RZ1001 (buggy?)"), + DEVICE( DPT, DPT, "SmartCache/Raid"), + DEVICE( OPTI, OPTI_92C178, "92C178"), + DEVICE( OPTI, OPTI_82C557, "82C557"), + DEVICE( OPTI, OPTI_82C558, "82C558"), + DEVICE( OPTI, OPTI_82C621, "82C621"), + DEVICE( OPTI, OPTI_82C700, "82C700"), + DEVICE( OPTI, OPTI_82C701, "82C701 FireStar Plus"), + DEVICE( OPTI, OPTI_82C814, "82C814 Firebridge 1"), + DEVICE( OPTI, OPTI_82C822, "82C822"), + DEVICE( SGS, SGS_2000, "STG 2000X"), + DEVICE( SGS, SGS_1764, "STG 1764X"), + DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER_NC, "MultiMaster NC"), + DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER, "MultiMaster"), + DEVICE( BUSLOGIC, BUSLOGIC_FLASHPOINT, "FlashPoint"), + DEVICE( TI, TI_TVP4010, "TVP4010 Permedia"), + DEVICE( TI, TI_TVP4020, "TVP4020 Permedia 2"), + DEVICE( TI, TI_PCI1130, "PCI1130"), + DEVICE( TI, TI_PCI1131, "PCI1131"), + DEVICE( OAK, OAK_OTI107, "OTI107"), + DEVICE( WINBOND2, WINBOND2_89C940,"NE2000-PCI"), + DEVICE( MOTOROLA, MOTOROLA_MPC105,"MPC105 Eagle"), + DEVICE( MOTOROLA, MOTOROLA_MPC106,"MPC106 Grackle"), + DEVICE( MOTOROLA, MOTOROLA_RAVEN, "Raven"), + DEVICE( PROMISE, PROMISE_20246, "IDE UltraDMA/33"), + DEVICE( PROMISE, PROMISE_5300, "DC5030"), + DEVICE( N9, N9_I128, "Imagine 128"), + DEVICE( N9, N9_I128_2, "Imagine 128v2"), + DEVICE( UMC, UMC_UM8673F, "UM8673F"), + DEVICE( UMC, UMC_UM8891A, "UM8891A"), + DEVICE( UMC, UMC_UM8886BF, "UM8886BF"), + DEVICE( UMC, UMC_UM8886A, "UM8886A"), + DEVICE( UMC, UMC_UM8881F, "UM8881F"), + DEVICE( UMC, UMC_UM8886F, "UM8886F"), + DEVICE( UMC, UMC_UM9017F, "UM9017F"), + DEVICE( UMC, UMC_UM8886N, "UM8886N"), + DEVICE( UMC, UMC_UM8891N, "UM8891N"), + DEVICE( X, X_AGX016, "ITT AGX016"), + DEVICE( PICOP, PICOP_PT86C52X, "PT86C52x Vesuvius"), + DEVICE( APPLE, APPLE_BANDIT, "Bandit"), + DEVICE( APPLE, APPLE_GC, "Grand Central"), + DEVICE( APPLE, APPLE_HYDRA, "Hydra"), + DEVICE( NEXGEN, NEXGEN_82C501, "82C501"), + DEVICE( QLOGIC, QLOGIC_ISP1020, "ISP1020"), + DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"), + DEVICE( CYRIX, CYRIX_5510, "5510"), + DEVICE( CYRIX, CYRIX_PCI_MASTER,"PCI Master"), + DEVICE( CYRIX, CYRIX_5520, "5520"), + DEVICE( CYRIX, CYRIX_5530_LEGACY,"5530 Kahlua Legacy"), + DEVICE( CYRIX, CYRIX_5530_SMI, "5530 Kahlua SMI"), + DEVICE( CYRIX, CYRIX_5530_IDE, "5530 Kahlua IDE"), + DEVICE( CYRIX, CYRIX_5530_AUDIO,"5530 Kahlua Audio"), + DEVICE( CYRIX, CYRIX_5530_VIDEO,"5530 Kahlua Video"), + DEVICE( LEADTEK, LEADTEK_805, "S3 805"), + DEVICE( CONTAQ, CONTAQ_82C599, "82C599"), + DEVICE( OLICOM, OLICOM_OC3136, "OC-3136/3137"), + DEVICE( OLICOM, OLICOM_OC2315, "OC-2315"), + DEVICE( OLICOM, OLICOM_OC2325, "OC-2325"), + DEVICE( OLICOM, OLICOM_OC2183, "OC-2183/2185"), + DEVICE( OLICOM, OLICOM_OC2326, "OC-2326"), + DEVICE( OLICOM, OLICOM_OC6151, "OC-6151/6152"), + DEVICE( SUN, SUN_EBUS, "EBUS"), + DEVICE( SUN, SUN_HAPPYMEAL, "Happy Meal"), + DEVICE( SUN, SUN_PBM, "PCI Bus Module"), + DEVICE( CMD, CMD_640, "640 (buggy)"), + DEVICE( CMD, CMD_643, "643"), + DEVICE( CMD, CMD_646, "646"), + DEVICE( CMD, CMD_670, "670"), + DEVICE( VISION, VISION_QD8500, "QD-8500"), + DEVICE( VISION, VISION_QD8580, "QD-8580"), + DEVICE( BROOKTREE, BROOKTREE_848, "Bt848"), + DEVICE( SIERRA, SIERRA_STB, "STB Horizon 64"), + DEVICE( ACC, ACC_2056, "2056"), + DEVICE( WINBOND, WINBOND_83769, "W83769F"), + DEVICE( WINBOND, WINBOND_82C105, "SL82C105"), + DEVICE( WINBOND, WINBOND_83C553, "W83C553"), + DEVICE( DATABOOK, DATABOOK_87144, "DB87144"), + DEVICE( 3COM, 3COM_3C590, "3C590 10bT"), + DEVICE( 3COM, 3COM_3C595TX, "3C595 100bTX"), + DEVICE( 3COM, 3COM_3C595T4, "3C595 100bT4"), + DEVICE( 3COM, 3COM_3C595MII, "3C595 100b-MII"), + DEVICE( 3COM, 3COM_3C900TPO, "3C900 10bTPO"), + DEVICE( 3COM, 3COM_3C900COMBO,"3C900 10b Combo"), + DEVICE( 3COM, 3COM_3C905TX, "3C905 100bTX"), + DEVICE( SMC, SMC_EPIC100, "9432 TX"), + DEVICE( AL, AL_M1445, "M1445"), + DEVICE( AL, AL_M1449, "M1449"), + DEVICE( AL, AL_M1451, "M1451"), + DEVICE( AL, AL_M1461, "M1461"), + DEVICE( AL, AL_M1489, "M1489"), + DEVICE( AL, AL_M1511, "M1511"), + DEVICE( AL, AL_M1513, "M1513"), + DEVICE( AL, AL_M1521, "M1521"), + DEVICE( AL, AL_M1523, "M1523"), + DEVICE( AL, AL_M1531, "M1531 Aladdin IV"), + DEVICE( AL, AL_M1533, "M1533 Aladdin IV"), + DEVICE( AL, AL_M4803, "M4803"), + DEVICE( AL, AL_M5219, "M5219"), + DEVICE( AL, AL_M5229, "M5229 TXpro"), + DEVICE( SURECOM, SURECOM_NE34, "NE-34PCI LAN"), + DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2070, "Magicgraph NM2070"), + DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128V, "MagicGraph 128V"), + DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128ZV, "MagicGraph 128ZV"), + DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2160, "MagicGraph NM2160"), + DEVICE( ASP, ASP_ABP940, "ABP940"), + DEVICE( ASP, ASP_ABP940U, "ABP940U"), + DEVICE( CERN, CERN_SPSB_PMC, "STAR/RD24 SCI-PCI (PMC)"), + DEVICE( CERN, CERN_SPSB_PCI, "STAR/RD24 SCI-PCI (PMC)"), + DEVICE( IMS, IMS_8849, "8849"), + DEVICE( TEKRAM2, TEKRAM2_690c, "DC690c"), + DEVICE( TUNDRA, TUNDRA_CA91C042,"CA91C042 Universe"), + DEVICE( AMCC, AMCC_MYRINET, "Myrinet PCI (M2-PCI-32)"), + DEVICE( AMCC, AMCC_S5933, "S5933 PCI44"), + DEVICE( AMCC, AMCC_S5933_HEPC3,"S5933 Traquair HEPC3"), + DEVICE( INTERG, INTERG_1680, "IGA-1680"), + DEVICE( INTERG, INTERG_1682, "IGA-1682"), + DEVICE( REALTEK, REALTEK_8029, "8029"), + DEVICE( REALTEK, REALTEK_8129, "8129"), + DEVICE( TRUEVISION, TRUEVISION_T1000,"TARGA 1000"), + DEVICE( INIT, INIT_320P, "320 P"), + DEVICE( VIA, VIA_82C505, "VT 82C505"), + DEVICE( VIA, VIA_82C561, "VT 82C561"), + DEVICE( VIA, VIA_82C586_1, "VT 82C586 Apollo IDE"), + DEVICE( VIA, VIA_82C576, "VT 82C576 3V"), + DEVICE( VIA, VIA_82C585, "VT 82C585 Apollo VP1/VPX"), + DEVICE( VIA, VIA_82C586_0, "VT 82C586 Apollo ISA"), + DEVICE( VIA, VIA_82C595, "VT 82C595 Apollo VP2"), + DEVICE( VIA, VIA_82C926, "VT 82C926 Amazon"), + DEVICE( VIA, VIA_82C416, "VT 82C416MV"), + DEVICE( VIA, VIA_82C595_97, "VT 82C595 Apollo VP2/97"), + DEVICE( VIA, VIA_82C586_2, "VT 82C586 Apollo USB"), + DEVICE( VIA, VIA_82C586_3, "VT 82C586B Apollo ACPI"), + DEVICE( VORTEX, VORTEX_GDT60x0, "GDT 60x0"), + DEVICE( VORTEX, VORTEX_GDT6000B,"GDT 6000b"), + DEVICE( VORTEX, VORTEX_GDT6x10, "GDT 6110/6510"), + DEVICE( VORTEX, VORTEX_GDT6x20, "GDT 6120/6520"), + DEVICE( VORTEX, VORTEX_GDT6530, "GDT 6530"), + DEVICE( VORTEX, VORTEX_GDT6550, "GDT 6550"), + DEVICE( VORTEX, VORTEX_GDT6x17, "GDT 6117/6517"), + DEVICE( VORTEX, VORTEX_GDT6x27, "GDT 6127/6527"), + DEVICE( VORTEX, VORTEX_GDT6537, "GDT 6537"), + DEVICE( VORTEX, VORTEX_GDT6557, "GDT 6557"), + DEVICE( VORTEX, VORTEX_GDT6x15, "GDT 6115/6515"), + DEVICE( VORTEX, VORTEX_GDT6x25, "GDT 6125/6525"), + DEVICE( VORTEX, VORTEX_GDT6535, "GDT 6535"), + DEVICE( VORTEX, VORTEX_GDT6555, "GDT 6555"), + DEVICE( VORTEX, VORTEX_GDT6x17RP,"GDT 6117RP/6517RP"), + DEVICE( VORTEX, VORTEX_GDT6x27RP,"GDT 6127RP/6527RP"), + DEVICE( VORTEX, VORTEX_GDT6537RP,"GDT 6537RP"), + DEVICE( VORTEX, VORTEX_GDT6557RP,"GDT 6557RP"), + DEVICE( VORTEX, VORTEX_GDT6x11RP,"GDT 6111RP/6511RP"), + DEVICE( VORTEX, VORTEX_GDT6x21RP,"GDT 6121RP/6521RP"), + DEVICE( VORTEX, VORTEX_GDT6x17RP1,"GDT 6117RP1/6517RP1"), + DEVICE( VORTEX, VORTEX_GDT6x27RP1,"GDT 6127RP1/6527RP1"), + DEVICE( VORTEX, VORTEX_GDT6537RP1,"GDT 6537RP1"), + DEVICE( VORTEX, VORTEX_GDT6557RP1,"GDT 6557RP1"), + DEVICE( VORTEX, VORTEX_GDT6x11RP1,"GDT 6111RP1/6511RP1"), + DEVICE( VORTEX, VORTEX_GDT6x21RP1,"GDT 6121RP1/6521RP1"), + DEVICE( VORTEX, VORTEX_GDT6x17RP2,"GDT 6117RP2/6517RP2"), + DEVICE( VORTEX, VORTEX_GDT6x27RP2,"GDT 6127RP2/6527RP2"), + DEVICE( VORTEX, VORTEX_GDT6537RP2,"GDT 6537RP2"), + DEVICE( VORTEX, VORTEX_GDT6557RP2,"GDT 6557RP2"), + DEVICE( VORTEX, VORTEX_GDT6x11RP2,"GDT 6111RP2/6511RP2"), + DEVICE( VORTEX, VORTEX_GDT6x21RP2,"GDT 6121RP2/6521RP2"), + DEVICE( EF, EF_ATM_FPGA, "155P-MF1 (FPGA)"), + DEVICE( EF, EF_ATM_ASIC, "155P-MF1 (ASIC)"), + DEVICE( FORE, FORE_PCA200PC, "PCA-200PC"), + DEVICE( FORE, FORE_PCA200E, "PCA-200E"), + DEVICE( IMAGINGTECH, IMAGINGTECH_ICPCI, "MVC IC-PCI"), + DEVICE( PHILIPS, PHILIPS_SAA7146,"SAA7146"), + DEVICE( PLX, PLX_9060, "PCI9060 i960 bridge"), + DEVICE( ALLIANCE, ALLIANCE_PROMOTIO, "Promotion-6410"), + DEVICE( ALLIANCE, ALLIANCE_PROVIDEO, "Provideo"), + DEVICE( ALLIANCE, ALLIANCE_AT24, "AT24"), + DEVICE( ALLIANCE, ALLIANCE_AT3D, "AT3D"), + DEVICE( VMIC, VMIC_VME, "VMIVME-7587"), + DEVICE( DIGI, DIGI_RIGHTSWITCH, "RightSwitch SE-6"), + DEVICE( MUTECH, MUTECH_MV1000, "MV-1000"), + DEVICE( RENDITION, RENDITION_VERITE,"Verite 1000"), + DEVICE( RENDITION, RENDITION_VERITE2100,"Verite 2100"), + DEVICE( TOSHIBA, TOSHIBA_601, "Laptop"), + DEVICE( RICOH, RICOH_RL5C466, "RL5C466"), + DEVICE( ZEITNET, ZEITNET_1221, "1221"), + DEVICE( ZEITNET, ZEITNET_1225, "1225"), + DEVICE( OMEGA, OMEGA_82C092G, "82C092G"), + DEVICE( LITEON, LITEON_LNE100TX,"LNE100TX"), + DEVICE( NP, NP_PCI_FDDI, "NP-PCI"), + DEVICE( SPECIALIX, SPECIALIX_XIO, "XIO/SIO host"), + DEVICE( SPECIALIX, SPECIALIX_RIO, "RIO host"), + DEVICE( AURAVISION, AURAVISION_VXP524,"VXP524"), + DEVICE( IKON, IKON_10115, "10115 Greensheet"), + DEVICE( IKON, IKON_10117, "10117 Greensheet"), + DEVICE( ZORAN, ZORAN_36057, "ZR36057"), + DEVICE( ZORAN, ZORAN_36120, "ZR36120"), + DEVICE( COMPEX, COMPEX_ENET100VG4, "Readylink ENET100-VG4"), + DEVICE( COMPEX, COMPEX_RL2000, "ReadyLink 2000"), + DEVICE( RP, RP8OCTA, "RocketPort 8 Oct"), + DEVICE( RP, RP8INTF, "RocketPort 8 Intf"), + DEVICE( RP, RP16INTF, "RocketPort 16 Intf"), + DEVICE( RP, RP32INTF, "RocketPort 32 Intf"), + DEVICE( CYCLADES, CYCLOM_Y_Lo, "Cyclom-Y below 1Mbyte"), + DEVICE( CYCLADES, CYCLOM_Y_Hi, "Cyclom-Y above 1Mbyte"), + DEVICE( CYCLADES, CYCLOM_Z_Lo, "Cyclom-Z below 1Mbyte"), + DEVICE( CYCLADES, CYCLOM_Z_Hi, "Cyclom-Z above 1Mbyte"), + DEVICE( 3DFX, 3DFX_VOODOO, "Voodoo"), + DEVICE( STALLION, STALLION_ECHPCI832,"EasyConnection 8/32"), + DEVICE( STALLION, STALLION_ECHPCI864,"EasyConnection 8/64"), + DEVICE( STALLION, STALLION_EIOPCI,"EasyIO"), + DEVICE( SIGMADES, SIGMADES_6425, "REALmagic64/GX"), + DEVICE( OPTIBASE, OPTIBASE_FORGE, "MPEG Forge"), + DEVICE( OPTIBASE, OPTIBASE_FUSION,"MPEG Fusion"), + DEVICE( OPTIBASE, OPTIBASE_VPLEX, "VideoPlex"), + DEVICE( OPTIBASE, OPTIBASE_VPLEXCC,"VideoPlex CC"), + DEVICE( OPTIBASE, OPTIBASE_VQUEST,"VideoQuest"), + DEVICE( ENSONIQ, ENSONIQ_AUDIOPCI,"AudioPCI"), + DEVICE( PICTUREL, PICTUREL_PCIVST,"PCIVST"), + DEVICE( NVIDIA_SGS, NVIDIA_SGS_RIVA128, "Riva 128"), + DEVICE( SYMPHONY, SYMPHONY_101, "82C101"), + DEVICE( TEKRAM, TEKRAM_DC290, "DC-290"), + DEVICE( 3DLABS, 3DLABS_300SX, "GLINT 300SX"), + DEVICE( 3DLABS, 3DLABS_500TX, "GLINT 500TX"), + DEVICE( 3DLABS, 3DLABS_DELTA, "GLINT Delta"), + DEVICE( 3DLABS, 3DLABS_PERMEDIA,"PERMEDIA"), + DEVICE( AVANCE, AVANCE_ALG2064, "ALG2064i"), + DEVICE( AVANCE, AVANCE_2302, "ALG-2302"), + DEVICE( NETVIN, NETVIN_NV5000SC,"NV5000"), + DEVICE( S3, S3_PLATO_PXS, "PLATO/PX (system)"), + DEVICE( S3, S3_ViRGE, "ViRGE"), + DEVICE( S3, S3_TRIO, "Trio32/Trio64"), + DEVICE( S3, S3_AURORA64VP, "Aurora64V+"), + DEVICE( S3, S3_TRIO64UVP, "Trio64UV+"), + DEVICE( S3, S3_ViRGE_VX, "ViRGE/VX"), + DEVICE( S3, S3_868, "Vision 868"), + DEVICE( S3, S3_928, "Vision 928-P"), + DEVICE( S3, S3_864_1, "Vision 864-P"), + DEVICE( S3, S3_864_2, "Vision 864-P"), + DEVICE( S3, S3_964_1, "Vision 964-P"), + DEVICE( S3, S3_964_2, "Vision 964-P"), + DEVICE( S3, S3_968, "Vision 968"), + DEVICE( S3, S3_TRIO64V2, "Trio64V2/DX or /GX"), + DEVICE( S3, S3_PLATO_PXG, "PLATO/PX (graphics)"), + DEVICE( S3, S3_ViRGE_DXGX, "ViRGE/DX or /GX"), + DEVICE( S3, S3_ViRGE_GX2, "ViRGE/GX2"), + DEVICE( S3, S3_ViRGE_MX, "ViRGE/MX"), + DEVICE( S3, S3_ViRGE_MXP, "ViRGE/MX+"), + DEVICE( S3, S3_ViRGE_MXPMV, "ViRGE/MX+MV"), + DEVICE( INTEL, INTEL_82375, "82375EB"), + DEVICE( INTEL, INTEL_82424, "82424ZX Saturn"), + DEVICE( INTEL, INTEL_82378, "82378IB"), + DEVICE( INTEL, INTEL_82430, "82430ZX Aries"), + DEVICE( INTEL, INTEL_82434, "82434LX Mercury/Neptune"), + DEVICE( INTEL, INTEL_82092AA_0,"82092AA PCMCIA bridge"), + DEVICE( INTEL, INTEL_82092AA_1,"82092AA EIDE"), + DEVICE( INTEL, INTEL_7116, "SAA7116"), + DEVICE( INTEL, INTEL_82596, "82596"), + DEVICE( INTEL, INTEL_82865, "82865"), + DEVICE( INTEL, INTEL_82557, "82557"), + DEVICE( INTEL, INTEL_82437, "82437"), + DEVICE( INTEL, INTEL_82371_0, "82371 Triton PIIX"), + DEVICE( INTEL, INTEL_82371_1, "82371 Triton PIIX"), + DEVICE( INTEL, INTEL_82371MX, "430MX - 82371MX MPIIX"), + DEVICE( INTEL, INTEL_82437MX, "430MX - 82437MX MTSC"), + DEVICE( INTEL, INTEL_82441, "82441FX Natoma"), + DEVICE( INTEL, INTEL_82439, "82439HX Triton II"), + DEVICE( INTEL, INTEL_82371SB_0,"82371SB Natoma/Triton II PIIX3"), + DEVICE( INTEL, INTEL_82371SB_1,"82371SB Natoma/Triton II PIIX3"), + DEVICE( INTEL, INTEL_82371SB_2,"82371SB Natoma/Triton II PIIX3"), + DEVICE( INTEL, INTEL_82437VX, "82437VX Triton II"), + DEVICE( INTEL, INTEL_82439TX, "82439TX"), + DEVICE( INTEL, INTEL_82371AB_0,"82371AB PIIX4 ISA"), + DEVICE( INTEL, INTEL_82371AB, "82371AB PIIX4 IDE"), + DEVICE( INTEL, INTEL_82371AB_2,"82371AB PIIX4 USB"), + DEVICE( INTEL, INTEL_82371AB_3,"82371AB PIIX4 ACPI"), + DEVICE( INTEL, INTEL_82443LX_0,"440LX - 82443LX PAC Host"), + DEVICE( INTEL, INTEL_82443LX_1,"440LX - 82443LX PAC AGP"), + DEVICE( INTEL, INTEL_P6, "Orion P6"), + DEVICE( INTEL, INTEL_82450GX, "82450GX Orion P6"), + DEVICE( KTI, KTI_ET32P2, "ET32P2"), + DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"), + DEVICE( ADAPTEC, ADAPTEC_7855, "AIC-7855"), + DEVICE( ADAPTEC, ADAPTEC_5800, "AIC-5800"), + DEVICE( ADAPTEC, ADAPTEC_7860, "AIC-7860"), + DEVICE( ADAPTEC, ADAPTEC_7861, "AIC-7861"), + DEVICE( ADAPTEC, ADAPTEC_7870, "AIC-7870"), + DEVICE( ADAPTEC, ADAPTEC_7871, "AIC-7871"), + DEVICE( ADAPTEC, ADAPTEC_7872, "AIC-7872"), + DEVICE( ADAPTEC, ADAPTEC_7873, "AIC-7873"), + DEVICE( ADAPTEC, ADAPTEC_7874, "AIC-7874"), + DEVICE( ADAPTEC, ADAPTEC_7895, "AIC-7895U"), + DEVICE( ADAPTEC, ADAPTEC_7880, "AIC-7880U"), + DEVICE( ADAPTEC, ADAPTEC_7881, "AIC-7881U"), + DEVICE( ADAPTEC, ADAPTEC_7882, "AIC-7882U"), + DEVICE( ADAPTEC, ADAPTEC_7883, "AIC-7883U"), + DEVICE( ADAPTEC, ADAPTEC_7884, "AIC-7884U"), + DEVICE( ATRONICS, ATRONICS_2015, "IDE-2015PL"), + DEVICE( ARK, ARK_STING, "Stingray"), + DEVICE( ARK, ARK_STINGARK, "Stingray ARK 2000PV"), + DEVICE( ARK, ARK_2000MT, "2000MT") +}; + + +/* + * device_info[] is sorted so we can use binary search + */ +static struct pci_dev_info *pci_lookup_dev(unsigned int vendor, unsigned int dev) +{ + int min = 0, + max = sizeof(dev_info)/sizeof(dev_info[0]) - 1; + + for ( ; ; ) + { + int i = (min + max) >> 1; + long order; + + order = dev_info[i].vendor - (long) vendor; + if (!order) + order = dev_info[i].device - (long) dev; + + if (order < 0) + { + min = i + 1; + if ( min > max ) + return 0; + continue; + } + + if (order > 0) + { + max = i - 1; + if ( min > max ) + return 0; + continue; + } + + return & dev_info[ i ]; + } +} + +static const char *pci_strclass (unsigned int class) +{ + switch (class >> 8) { + case PCI_CLASS_NOT_DEFINED: return "Non-VGA device"; + case PCI_CLASS_NOT_DEFINED_VGA: return "VGA compatible device"; + + case PCI_CLASS_STORAGE_SCSI: return "SCSI storage controller"; + case PCI_CLASS_STORAGE_IDE: return "IDE interface"; + case PCI_CLASS_STORAGE_FLOPPY: return "Floppy disk controller"; + case PCI_CLASS_STORAGE_IPI: return "IPI bus controller"; + case PCI_CLASS_STORAGE_RAID: return "RAID bus controller"; + case PCI_CLASS_STORAGE_OTHER: return "Unknown mass storage controller"; + + case PCI_CLASS_NETWORK_ETHERNET: return "Ethernet controller"; + case PCI_CLASS_NETWORK_TOKEN_RING: return "Token ring network controller"; + case PCI_CLASS_NETWORK_FDDI: return "FDDI network controller"; + case PCI_CLASS_NETWORK_ATM: return "ATM network controller"; + case PCI_CLASS_NETWORK_OTHER: return "Network controller"; + + case PCI_CLASS_DISPLAY_VGA: return "VGA compatible controller"; + case PCI_CLASS_DISPLAY_XGA: return "XGA compatible controller"; + case PCI_CLASS_DISPLAY_OTHER: return "Display controller"; + + case PCI_CLASS_MULTIMEDIA_VIDEO: return "Multimedia video controller"; + case PCI_CLASS_MULTIMEDIA_AUDIO: return "Multimedia audio controller"; + case PCI_CLASS_MULTIMEDIA_OTHER: return "Multimedia controller"; + + case PCI_CLASS_MEMORY_RAM: return "RAM memory"; + case PCI_CLASS_MEMORY_FLASH: return "FLASH memory"; + case PCI_CLASS_MEMORY_OTHER: return "Memory"; + + case PCI_CLASS_BRIDGE_HOST: return "Host bridge"; + case PCI_CLASS_BRIDGE_ISA: return "ISA bridge"; + case PCI_CLASS_BRIDGE_EISA: return "EISA bridge"; + case PCI_CLASS_BRIDGE_MC: return "MicroChannel bridge"; + case PCI_CLASS_BRIDGE_PCI: return "PCI bridge"; + case PCI_CLASS_BRIDGE_PCMCIA: return "PCMCIA bridge"; + case PCI_CLASS_BRIDGE_NUBUS: return "NuBus bridge"; + case PCI_CLASS_BRIDGE_CARDBUS: return "CardBus bridge"; + case PCI_CLASS_BRIDGE_OTHER: return "Bridge"; + + case PCI_CLASS_COMMUNICATION_SERIAL: return "Serial controller"; + case PCI_CLASS_COMMUNICATION_PARALLEL: return "Parallel controller"; + case PCI_CLASS_COMMUNICATION_OTHER: return "Communication controller"; + + case PCI_CLASS_SYSTEM_PIC: return "PIC"; + case PCI_CLASS_SYSTEM_DMA: return "DMA controller"; + case PCI_CLASS_SYSTEM_TIMER: return "Timer"; + case PCI_CLASS_SYSTEM_RTC: return "RTC"; + case PCI_CLASS_SYSTEM_OTHER: return "System peripheral"; + + case PCI_CLASS_INPUT_KEYBOARD: return "Keyboard controller"; + case PCI_CLASS_INPUT_PEN: return "Digitizer Pen"; + case PCI_CLASS_INPUT_MOUSE: return "Mouse controller"; + case PCI_CLASS_INPUT_OTHER: return "Input device controller"; + + case PCI_CLASS_DOCKING_GENERIC: return "Generic Docking Station"; + case PCI_CLASS_DOCKING_OTHER: return "Docking Station"; + + case PCI_CLASS_PROCESSOR_386: return "386"; + case PCI_CLASS_PROCESSOR_486: return "486"; + case PCI_CLASS_PROCESSOR_PENTIUM: return "Pentium"; + case PCI_CLASS_PROCESSOR_ALPHA: return "Alpha"; + case PCI_CLASS_PROCESSOR_POWERPC: return "Power PC"; + case PCI_CLASS_PROCESSOR_CO: return "Co-processor"; + + case PCI_CLASS_SERIAL_FIREWIRE: return "FireWire (IEEE 1394)"; + case PCI_CLASS_SERIAL_ACCESS: return "ACCESS Bus"; + case PCI_CLASS_SERIAL_SSA: return "SSA"; + case PCI_CLASS_SERIAL_USB: return "USB Controller"; + case PCI_CLASS_SERIAL_FIBER: return "Fiber Channel"; + + default: return "Unknown class"; + } +} + + +static const char *pci_strvendor(unsigned int vendor) +{ + switch (vendor) { + case PCI_VENDOR_ID_COMPAQ: return "Compaq"; + case PCI_VENDOR_ID_NCR: return "NCR"; + case PCI_VENDOR_ID_ATI: return "ATI"; + case PCI_VENDOR_ID_VLSI: return "VLSI"; + case PCI_VENDOR_ID_ADL: return "Avance Logic"; + case PCI_VENDOR_ID_NS: return "NS"; + case PCI_VENDOR_ID_TSENG: return "Tseng'Lab"; + case PCI_VENDOR_ID_WEITEK: return "Weitek"; + case PCI_VENDOR_ID_DEC: return "DEC"; + case PCI_VENDOR_ID_CIRRUS: return "Cirrus Logic"; + case PCI_VENDOR_ID_IBM: return "IBM"; + case PCI_VENDOR_ID_WD: return "Western Digital"; + case PCI_VENDOR_ID_AMD: return "AMD"; + case PCI_VENDOR_ID_TRIDENT: return "Trident"; + case PCI_VENDOR_ID_AI: return "Acer Incorporated"; + case PCI_VENDOR_ID_MATROX: return "Matrox"; + case PCI_VENDOR_ID_CT: return "Chips & Technologies"; + case PCI_VENDOR_ID_MIRO: return "Miro"; + case PCI_VENDOR_ID_NEC: return "NEC"; + case PCI_VENDOR_ID_FD: return "Future Domain"; + case PCI_VENDOR_ID_SI: return "Silicon Integrated Systems"; + case PCI_VENDOR_ID_HP: return "Hewlett Packard"; + case PCI_VENDOR_ID_PCTECH: return "PCTECH"; + case PCI_VENDOR_ID_DPT: return "DPT"; + case PCI_VENDOR_ID_OPTI: return "OPTi"; + case PCI_VENDOR_ID_SGS: return "SGS Thomson"; + case PCI_VENDOR_ID_BUSLOGIC: return "BusLogic"; + case PCI_VENDOR_ID_TI: return "Texas Instruments"; + case PCI_VENDOR_ID_OAK: return "OAK"; + case PCI_VENDOR_ID_WINBOND2: return "Winbond"; + case PCI_VENDOR_ID_MOTOROLA: return "Motorola"; + case PCI_VENDOR_ID_PROMISE: return "Promise Technology"; + case PCI_VENDOR_ID_N9: return "Number Nine"; + case PCI_VENDOR_ID_UMC: return "UMC"; + case PCI_VENDOR_ID_X: return "X TECHNOLOGY"; + case PCI_VENDOR_ID_PICOP: return "PicoPower"; + case PCI_VENDOR_ID_APPLE: return "Apple"; + case PCI_VENDOR_ID_NEXGEN: return "Nexgen"; + case PCI_VENDOR_ID_QLOGIC: return "Q Logic"; + case PCI_VENDOR_ID_CYRIX: return "Cyrix"; + case PCI_VENDOR_ID_LEADTEK: return "Leadtek Research"; + case PCI_VENDOR_ID_CONTAQ: return "Contaq"; + case PCI_VENDOR_ID_FOREX: return "Forex"; + case PCI_VENDOR_ID_OLICOM: return "Olicom"; + case PCI_VENDOR_ID_SUN: return "Sun Microsystems"; + case PCI_VENDOR_ID_CMD: return "CMD"; + case PCI_VENDOR_ID_VISION: return "Vision"; + case PCI_VENDOR_ID_BROOKTREE: return "Brooktree"; + case PCI_VENDOR_ID_SIERRA: return "Sierra"; + case PCI_VENDOR_ID_ACC: return "ACC MICROELECTRONICS"; + case PCI_VENDOR_ID_WINBOND: return "Winbond"; + case PCI_VENDOR_ID_DATABOOK: return "Databook"; + case PCI_VENDOR_ID_3COM: return "3Com"; + case PCI_VENDOR_ID_SMC: return "SMC"; + case PCI_VENDOR_ID_AL: return "Acer Labs"; + case PCI_VENDOR_ID_MITSUBISHI: return "Mitsubishi"; + case PCI_VENDOR_ID_SURECOM: return "Surecom"; + case PCI_VENDOR_ID_NEOMAGIC: return "Neomagic"; + case PCI_VENDOR_ID_ASP: return "Advanced System Products"; + case PCI_VENDOR_ID_CERN: return "CERN"; + case PCI_VENDOR_ID_NVIDIA: return "NVidia"; + case PCI_VENDOR_ID_IMS: return "IMS"; + case PCI_VENDOR_ID_TEKRAM2: return "Tekram"; + case PCI_VENDOR_ID_TUNDRA: return "Tundra"; + case PCI_VENDOR_ID_AMCC: return "AMCC"; + case PCI_VENDOR_ID_INTERG: return "Intergraphics"; + case PCI_VENDOR_ID_REALTEK: return "Realtek"; + case PCI_VENDOR_ID_TRUEVISION: return "Truevision"; + case PCI_VENDOR_ID_INIT: return "Initio Corp"; + case PCI_VENDOR_ID_VIA: return "VIA Technologies"; + case PCI_VENDOR_ID_VORTEX: return "VORTEX"; + case PCI_VENDOR_ID_EF: return "Efficient Networks"; + case PCI_VENDOR_ID_FORE: return "Fore Systems"; + case PCI_VENDOR_ID_IMAGINGTECH: return "Imaging Technology"; + case PCI_VENDOR_ID_PHILIPS: return "Philips"; + case PCI_VENDOR_ID_PLX: return "PLX"; + case PCI_VENDOR_ID_ALLIANCE: return "Alliance"; + case PCI_VENDOR_ID_VMIC: return "VMIC"; + case PCI_VENDOR_ID_DIGI: return "Digi Intl."; + case PCI_VENDOR_ID_MUTECH: return "Mutech"; + case PCI_VENDOR_ID_RENDITION: return "Rendition"; + case PCI_VENDOR_ID_TOSHIBA: return "Toshiba"; + case PCI_VENDOR_ID_RICOH: return "Ricoh"; + case PCI_VENDOR_ID_ZEITNET: return "ZeitNet"; + case PCI_VENDOR_ID_OMEGA: return "Omega Micro"; + case PCI_VENDOR_ID_LITEON: return "LiteOn"; + case PCI_VENDOR_ID_NP: return "Network Peripherals"; + case PCI_VENDOR_ID_SPECIALIX: return "Specialix"; + case PCI_VENDOR_ID_AURAVISION: return "Auravision"; + case PCI_VENDOR_ID_IKON: return "Ikon"; + case PCI_VENDOR_ID_ZORAN: return "Zoran"; + case PCI_VENDOR_ID_COMPEX: return "Compex"; + case PCI_VENDOR_ID_RP: return "Comtrol"; + case PCI_VENDOR_ID_CYCLADES: return "Cyclades"; + case PCI_VENDOR_ID_3DFX: return "3Dfx"; + case PCI_VENDOR_ID_STALLION: return "Stallion Technologies"; + case PCI_VENDOR_ID_SIGMADES: return "Sigma Designs"; + case PCI_VENDOR_ID_OPTIBASE: return "Optibase"; + case PCI_VENDOR_ID_ENSONIQ: return "Ensoniq"; + case PCI_VENDOR_ID_PICTUREL: return "Picture Elements"; + case PCI_VENDOR_ID_NVIDIA_SGS: return "NVidia/SGS Thomson"; + case PCI_VENDOR_ID_SYMPHONY: return "Symphony"; + case PCI_VENDOR_ID_TEKRAM: return "Tekram"; + case PCI_VENDOR_ID_3DLABS: return "3Dlabs"; + case PCI_VENDOR_ID_AVANCE: return "Avance"; + case PCI_VENDOR_ID_NETVIN: return "NetVin"; + case PCI_VENDOR_ID_S3: return "S3 Inc."; + case PCI_VENDOR_ID_INTEL: return "Intel"; + case PCI_VENDOR_ID_KTI: return "KTI"; + case PCI_VENDOR_ID_ADAPTEC: return "Adaptec"; + case PCI_VENDOR_ID_ATRONICS: return "Atronics"; + case PCI_VENDOR_ID_ARK: return "ARK Logic"; + default: return "Unknown vendor"; + } +} + + +static const char *pci_strdev(unsigned int vendor, unsigned int device) +{ + struct pci_dev_info *info; + + info = pci_lookup_dev(vendor, device); + return info ? info->name : "Unknown device"; +} + + +/* + * Convert some of the configuration space registers of the device at + * address (bus,devfn) into a string (possibly several lines each). + * The configuration string is stored starting at buf[len]. If the + * string would exceed the size of the buffer (SIZE), 0 is returned. + */ +static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) +{ + unsigned long base; + unsigned int l, class_rev, bus, devfn; + unsigned short vendor, device, status; + unsigned char bist, latency, min_gnt, max_lat; + int reg, len = 0; + const char *str; + + bus = dev->bus->number; + devfn = dev->devfn; + + pcibios_read_config_dword(bus, devfn, PCI_CLASS_REVISION, &class_rev); + pcibios_read_config_word (bus, devfn, PCI_VENDOR_ID, &vendor); + pcibios_read_config_word (bus, devfn, PCI_DEVICE_ID, &device); + pcibios_read_config_word (bus, devfn, PCI_STATUS, &status); + pcibios_read_config_byte (bus, devfn, PCI_BIST, &bist); + pcibios_read_config_byte (bus, devfn, PCI_LATENCY_TIMER, &latency); + pcibios_read_config_byte (bus, devfn, PCI_MIN_GNT, &min_gnt); + pcibios_read_config_byte (bus, devfn, PCI_MAX_LAT, &max_lat); + if (len + 80 > size) { + return -1; + } + len += sprintf(buf + len, " Bus %2d, device %3d, function %2d:\n", + bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); + + if (len + 80 > size) { + return -1; + } + len += sprintf(buf + len, " %s: %s %s (rev %d).\n ", + pci_strclass(class_rev >> 8), pci_strvendor(vendor), + pci_strdev(vendor, device), class_rev & 0xff); + + if (!pci_lookup_dev(vendor, device)) { + len += sprintf(buf + len, + "Vendor id=%x. Device id=%x.\n ", + vendor, device); + } + + str = 0; /* to keep gcc shut... */ + switch (status & PCI_STATUS_DEVSEL_MASK) { + case PCI_STATUS_DEVSEL_FAST: str = "Fast devsel. "; break; + case PCI_STATUS_DEVSEL_MEDIUM: str = "Medium devsel. "; break; + case PCI_STATUS_DEVSEL_SLOW: str = "Slow devsel. "; break; + } + if (len + strlen(str) > size) { + return -1; + } + len += sprintf(buf + len, str); + + if (status & PCI_STATUS_FAST_BACK) { +# define fast_b2b_capable "Fast back-to-back capable. " + if (len + strlen(fast_b2b_capable) > size) { + return -1; + } + len += sprintf(buf + len, fast_b2b_capable); +# undef fast_b2b_capable + } + + if (bist & PCI_BIST_CAPABLE) { +# define BIST_capable "BIST capable. " + if (len + strlen(BIST_capable) > size) { + return -1; + } + len += sprintf(buf + len, BIST_capable); +# undef BIST_capable + } + + if (dev->irq) { + if (len + 40 > size) { + return -1; + } + len += sprintf(buf + len, "IRQ %x. ", dev->irq); + } + + if (dev->master) { + if (len + 80 > size) { + return -1; + } + len += sprintf(buf + len, "Master Capable. "); + if (latency) + len += sprintf(buf + len, "Latency=%d. ", latency); + else + len += sprintf(buf + len, "No bursts. "); + if (min_gnt) + len += sprintf(buf + len, "Min Gnt=%d.", min_gnt); + if (max_lat) + len += sprintf(buf + len, "Max Lat=%d.", max_lat); + } + + for (reg = 0; reg < 6; reg++) { + if (len + 40 > size) { + return -1; + } + pcibios_read_config_dword(bus, devfn, + PCI_BASE_ADDRESS_0 + (reg << 2), &l); + if (l == 0xffffffff) + base = 0; + else + base = l; + if (!base) + continue; + + if (base & PCI_BASE_ADDRESS_SPACE_IO) { + len += sprintf(buf + len, + "\n I/O at 0x%lx [0x%lx].", + base & PCI_BASE_ADDRESS_IO_MASK, + dev->base_address[reg]); + } else { + const char *pref, *type = "unknown"; + + if (base & PCI_BASE_ADDRESS_MEM_PREFETCH) { + pref = "P"; + } else { + pref = "Non-p"; + } + switch (base & PCI_BASE_ADDRESS_MEM_TYPE_MASK) { + case PCI_BASE_ADDRESS_MEM_TYPE_32: + type = "32 bit"; break; + case PCI_BASE_ADDRESS_MEM_TYPE_1M: + type = "20 bit"; break; + case PCI_BASE_ADDRESS_MEM_TYPE_64: + type = "64 bit"; + /* read top 32 bit address of base addr: */ + reg += 4; + pcibios_read_config_dword(bus, devfn, reg, &l); + base |= ((u64) l) << 32; + break; + } + len += sprintf(buf + len, + "\n %srefetchable %s memory at " + "0x%lx [0x%lx].", pref, type, + base & PCI_BASE_ADDRESS_MEM_MASK, + dev->base_address[reg]); + } + } + + len += sprintf(buf + len, "\n"); + return len; +} + + +/* + * Return list of PCI devices as a character string for /proc/pci. + * BUF is a buffer that is PAGE_SIZE bytes long. + */ +int get_pci_list(char *buf) +{ + int nprinted, len, size; + struct pci_dev *dev; + static int complained = 0; +# define MSG "\nwarning: page-size limit reached!\n" + + if (!complained) { + complained++; + printk(KERN_INFO "%s uses obsolete /proc/pci interface\n", + current->comm); + } + + /* reserve same for truncation warning message: */ + size = PAGE_SIZE - (strlen(MSG) + 1); + len = sprintf(buf, "PCI devices found:\n"); + + for (dev = pci_devices; dev; dev = dev->next) { + nprinted = sprint_dev_config(dev, buf + len, size - len); + if (nprinted < 0) { + return len + sprintf(buf + len, MSG); + } + len += nprinted; + } + return len; +} + +#endif diff -ruN /usr/src/linux-2.1/drivers/pci/pci.c drivers/pci/pci.c --- /usr/src/linux-2.1/drivers/pci/pci.c Thu Dec 25 22:44:56 1997 +++ drivers/pci/pci.c Sat Dec 27 13:19:07 1997 @@ -1,13 +1,13 @@ /* - * $Id: pci.c,v 1.51 1997/12/03 06:18:11 davem Exp $ + * $Id: pci.c,v 1.55 1997/12/27 12:17:54 mj Exp $ * - * PCI services that are built on top of the BIOS32 service. + * PCI services that are built on top of the BIOS32 service. * - * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter, + * Copyright 1993, 1994, 1995, 1997 Drew Eckhardt, Frederic Potter, * David Mosberger-Tang, Martin Mares */ + #include <linux/config.h> -#include <linux/ptrace.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/bios32.h> @@ -22,667 +22,18 @@ #undef DEBUG -#define DEVICE(vid,did,name) \ - {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name)} - /* - * Sorted in ascending order by vendor and device. - * Use binary search for lookup. If you add a device make sure - * it is sequential by both vendor and device id. - */ -struct pci_dev_info dev_info[] = { - DEVICE( COMPAQ, COMPAQ_1280, "QVision 1280/p"), - DEVICE( COMPAQ, COMPAQ_SMART2P, "Smart-2/P RAID Controller"), - DEVICE( COMPAQ, COMPAQ_NETEL100,"Netelligent 10/100"), - DEVICE( COMPAQ, COMPAQ_NETEL10, "Netelligent 10"), - DEVICE( COMPAQ, COMPAQ_NETFLEX3I,"NetFlex 3"), - DEVICE( COMPAQ, COMPAQ_NETEL100D,"Netelligent 10/100 Dual"), - DEVICE( COMPAQ, COMPAQ_NETEL100PI,"Netelligent 10/100 ProLiant"), - DEVICE( COMPAQ, COMPAQ_NETEL100I,"Netelligent 10/100 Integrated"), - DEVICE( COMPAQ, COMPAQ_THUNDER, "ThunderLAN"), - DEVICE( COMPAQ, COMPAQ_NETFLEX3B,"NetFlex 3 BNC"), - DEVICE( NCR, NCR_53C810, "53c810"), - DEVICE( NCR, NCR_53C820, "53c820"), - DEVICE( NCR, NCR_53C825, "53c825"), - DEVICE( NCR, NCR_53C815, "53c815"), - DEVICE( NCR, NCR_53C860, "53c860"), - DEVICE( NCR, NCR_53C896, "53c896"), - DEVICE( NCR, NCR_53C895, "53c895"), - DEVICE( NCR, NCR_53C885, "53c885"), - DEVICE( NCR, NCR_53C875, "53c875"), - DEVICE( NCR, NCR_53C875J, "53c875J"), - DEVICE( ATI, ATI_68800, "68800AX"), - DEVICE( ATI, ATI_215CT222, "215CT222"), - DEVICE( ATI, ATI_210888CX, "210888CX"), - DEVICE( ATI, ATI_215GB, "Mach64 GB"), - DEVICE( ATI, ATI_215GD, "Mach64 GD (Rage Pro)"), - DEVICE( ATI, ATI_215GP, "Mach64 GP (Rage Pro)"), - DEVICE( ATI, ATI_215GT, "Mach64 GT (Rage II)"), - DEVICE( ATI, ATI_215GTB, "Mach64 GT (Rage II)"), - DEVICE( ATI, ATI_210888GX, "210888GX"), - DEVICE( ATI, ATI_264VT, "Mach64 VT"), - DEVICE( VLSI, VLSI_82C592, "82C592-FC1"), - DEVICE( VLSI, VLSI_82C593, "82C593-FC1"), - DEVICE( VLSI, VLSI_82C594, "82C594-AFC2"), - DEVICE( VLSI, VLSI_82C597, "82C597-AFC2"), - DEVICE( VLSI, VLSI_82C541, "82C541 Lynx"), - DEVICE( VLSI, VLSI_82C543, "82C543 Lynx ISA"), - DEVICE( VLSI, VLSI_VAS96011, "VAS96011 (Golden Gate II)"), - DEVICE( ADL, ADL_2301, "2301"), - DEVICE( NS, NS_87415, "87415"), - DEVICE( NS, NS_87410, "87410"), - DEVICE( TSENG, TSENG_W32P_2, "ET4000W32P"), - DEVICE( TSENG, TSENG_W32P_b, "ET4000W32P rev B"), - DEVICE( TSENG, TSENG_W32P_c, "ET4000W32P rev C"), - DEVICE( TSENG, TSENG_W32P_d, "ET4000W32P rev D"), - DEVICE( TSENG, TSENG_ET6000, "ET6000"), - DEVICE( WEITEK, WEITEK_P9000, "P9000"), - DEVICE( WEITEK, WEITEK_P9100, "P9100"), - DEVICE( DEC, DEC_BRD, "DC21050"), - DEVICE( DEC, DEC_TULIP, "DC21040"), - DEVICE( DEC, DEC_TGA, "TGA"), - DEVICE( DEC, DEC_TULIP_FAST, "DC21140"), - DEVICE( DEC, DEC_TGA2, "TGA2"), - DEVICE( DEC, DEC_FDDI, "DEFPA"), - DEVICE( DEC, DEC_TULIP_PLUS, "DC21041"), - DEVICE( DEC, DEC_21142, "DC21142"), - DEVICE( DEC, DEC_21052, "DC21052"), - DEVICE( DEC, DEC_21152, "DC21152"), - DEVICE( CIRRUS, CIRRUS_7548, "GD 7548"), - DEVICE( CIRRUS, CIRRUS_5430, "GD 5430"), - DEVICE( CIRRUS, CIRRUS_5434_4, "GD 5434"), - DEVICE( CIRRUS, CIRRUS_5434_8, "GD 5434"), - DEVICE( CIRRUS, CIRRUS_5436, "GD 5436"), - DEVICE( CIRRUS, CIRRUS_5446, "GD 5446"), - DEVICE( CIRRUS, CIRRUS_5480, "GD 5480"), - DEVICE( CIRRUS, CIRRUS_5464, "GD 5464"), - DEVICE( CIRRUS, CIRRUS_5465, "GD 5465"), - DEVICE( CIRRUS, CIRRUS_6729, "CL 6729"), - DEVICE( CIRRUS, CIRRUS_6832, "PD 6832"), - DEVICE( CIRRUS, CIRRUS_7542, "CL 7542"), - DEVICE( CIRRUS, CIRRUS_7543, "CL 7543"), - DEVICE( CIRRUS, CIRRUS_7541, "CL 7541"), - DEVICE( IBM, IBM_FIRE_CORAL, "Fire Coral"), - DEVICE( IBM, IBM_TR, "Token Ring"), - DEVICE( IBM, IBM_82G2675, "82G2675"), - DEVICE( IBM, IBM_82351, "82351"), - DEVICE( WD, WD_7197, "WD 7197"), - DEVICE( AMD, AMD_LANCE, "79C970"), - DEVICE( AMD, AMD_SCSI, "53C974"), - DEVICE( TRIDENT, TRIDENT_9420, "TG 9420"), - DEVICE( TRIDENT, TRIDENT_9440, "TG 9440"), - DEVICE( TRIDENT, TRIDENT_9660, "TG 9660 / Cyber9385"), - DEVICE( TRIDENT, TRIDENT_9750, "Image 975"), - DEVICE( AI, AI_M1435, "M1435"), - DEVICE( MATROX, MATROX_MGA_2, "Atlas PX2085"), - DEVICE( MATROX, MATROX_MIL, "Millennium"), - DEVICE( MATROX, MATROX_MYS, "Mystique"), - DEVICE( MATROX, MATROX_MIL_2, "Millennium II"), - DEVICE( MATROX, MATROX_MGA_IMP, "MGA Impression"), - DEVICE( CT, CT_65545, "65545"), - DEVICE( CT, CT_65548, "65548"), - DEVICE( CT, CT_65550, "65550"), - DEVICE( CT, CT_65554, "65554"), - DEVICE( MIRO, MIRO_36050, "ZR36050"), - DEVICE( NEC, NEC_PCX2, "PowerVR PCX2"), - DEVICE( FD, FD_36C70, "TMC-18C30"), - DEVICE( SI, SI_6201, "6201"), - DEVICE( SI, SI_6202, "6202"), - DEVICE( SI, SI_503, "85C503"), - DEVICE( SI, SI_6205, "6205"), - DEVICE( SI, SI_501, "85C501"), - DEVICE( SI, SI_496, "85C496"), - DEVICE( SI, SI_601, "85C601"), - DEVICE( SI, SI_5107, "5107"), - DEVICE( SI, SI_5511, "85C5511"), - DEVICE( SI, SI_5513, "85C5513"), - DEVICE( SI, SI_5571, "5571"), - DEVICE( SI, SI_5597, "5597"), - DEVICE( SI, SI_7001, "7001"), - DEVICE( HP, HP_J2585A, "J2585A"), - DEVICE( HP, HP_J2585B, "J2585B (Lassen)"), - DEVICE( PCTECH, PCTECH_RZ1000, "RZ1000 (buggy)"), - DEVICE( PCTECH, PCTECH_RZ1001, "RZ1001 (buggy?)"), - DEVICE( DPT, DPT, "SmartCache/Raid"), - DEVICE( OPTI, OPTI_92C178, "92C178"), - DEVICE( OPTI, OPTI_82C557, "82C557 Viper-M"), - DEVICE( OPTI, OPTI_82C558, "82C558 Viper-M ISA+IDE"), - DEVICE( OPTI, OPTI_82C621, "82C621"), - DEVICE( OPTI, OPTI_82C700, "82C700"), - DEVICE( OPTI, OPTI_82C701, "82C701 FireStar Plus"), - DEVICE( OPTI, OPTI_82C814, "82C814 Firebridge 1"), - DEVICE( OPTI, OPTI_82C822, "82C822"), - DEVICE( SGS, SGS_2000, "STG 2000X"), - DEVICE( SGS, SGS_1764, "STG 1764X"), - DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER_NC, "MultiMaster NC"), - DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER, "MultiMaster"), - DEVICE( BUSLOGIC, BUSLOGIC_FLASHPOINT, "FlashPoint"), - DEVICE( TI, TI_TVP4010, "TVP4010 Permedia"), - DEVICE( TI, TI_TVP4020, "TVP4020 Permedia 2"), - DEVICE( TI, TI_PCI1130, "PCI1130"), - DEVICE( TI, TI_PCI1131, "PCI1131"), - DEVICE( OAK, OAK_OTI107, "OTI107"), - DEVICE( WINBOND2, WINBOND2_89C940,"NE2000-PCI"), - DEVICE( MOTOROLA, MOTOROLA_MPC105,"MPC105 Eagle"), - DEVICE( MOTOROLA, MOTOROLA_MPC106,"MPC106 Grackle"), - DEVICE( MOTOROLA, MOTOROLA_RAVEN, "Raven"), - DEVICE( PROMISE, PROMISE_20246, "IDE UltraDMA/33"), - DEVICE( PROMISE, PROMISE_5300, "DC5030"), - DEVICE( N9, N9_I128, "Imagine 128"), - DEVICE( N9, N9_I128_2, "Imagine 128v2"), - DEVICE( UMC, UMC_UM8673F, "UM8673F"), - DEVICE( UMC, UMC_UM8891A, "UM8891A"), - DEVICE( UMC, UMC_UM8886BF, "UM8886BF"), - DEVICE( UMC, UMC_UM8886A, "UM8886A"), - DEVICE( UMC, UMC_UM8881F, "UM8881F"), - DEVICE( UMC, UMC_UM8886F, "UM8886F"), - DEVICE( UMC, UMC_UM9017F, "UM9017F"), - DEVICE( UMC, UMC_UM8886N, "UM8886N"), - DEVICE( UMC, UMC_UM8891N, "UM8891N"), - DEVICE( X, X_AGX016, "ITT AGX016"), - DEVICE( PICOP, PICOP_PT86C52X, "PT86C52x Vesuvius"), - DEVICE( APPLE, APPLE_BANDIT, "Bandit"), - DEVICE( APPLE, APPLE_GC, "Grand Central"), - DEVICE( APPLE, APPLE_HYDRA, "Hydra"), - DEVICE( NEXGEN, NEXGEN_82C501, "82C501"), - DEVICE( QLOGIC, QLOGIC_ISP1020, "ISP1020"), - DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"), - DEVICE( CYRIX, CYRIX_5510, "5510"), - DEVICE( CYRIX, CYRIX_PCI_MASTER,"PCI Master"), - DEVICE( CYRIX, CYRIX_5520, "5520"), - DEVICE( CYRIX, CYRIX_5530_LEGACY,"5530 Kahlua Legacy"), - DEVICE( CYRIX, CYRIX_5530_SMI, "5530 Kahlua SMI"), - DEVICE( CYRIX, CYRIX_5530_IDE, "5530 Kahlua IDE"), - DEVICE( CYRIX, CYRIX_5530_AUDIO,"5530 Kahlua Audio"), - DEVICE( CYRIX, CYRIX_5530_VIDEO,"5530 Kahlua Video"), - DEVICE( LEADTEK, LEADTEK_805, "S3 805"), - DEVICE( CONTAQ, CONTAQ_82C599, "82C599"), - DEVICE( OLICOM, OLICOM_OC3136, "OC-3136/3137"), - DEVICE( OLICOM, OLICOM_OC2315, "OC-2315"), - DEVICE( OLICOM, OLICOM_OC2325, "OC-2325"), - DEVICE( OLICOM, OLICOM_OC2183, "OC-2183/2185"), - DEVICE( OLICOM, OLICOM_OC2326, "OC-2326"), - DEVICE( OLICOM, OLICOM_OC6151, "OC-6151/6152"), - DEVICE( SUN, SUN_EBUS, "EBUS"), - DEVICE( SUN, SUN_HAPPYMEAL, "Happy Meal"), - DEVICE( SUN, SUN_PBM, "PCI Bus Module"), - DEVICE( CMD, CMD_640, "640 (buggy)"), - DEVICE( CMD, CMD_643, "643"), - DEVICE( CMD, CMD_646, "646"), - DEVICE( CMD, CMD_670, "670"), - DEVICE( VISION, VISION_QD8500, "QD-8500"), - DEVICE( VISION, VISION_QD8580, "QD-8580"), - DEVICE( BROOKTREE, BROOKTREE_848, "Bt848"), - DEVICE( SIERRA, SIERRA_STB, "STB Horizon 64"), - DEVICE( ACC, ACC_2056, "2056"), - DEVICE( WINBOND, WINBOND_83769, "W83769F"), - DEVICE( WINBOND, WINBOND_82C105, "SL82C105"), - DEVICE( WINBOND, WINBOND_83C553, "W83C553"), - DEVICE( DATABOOK, DATABOOK_87144, "DB87144"), - DEVICE( 3COM, 3COM_3C590, "3C590 10bT"), - DEVICE( 3COM, 3COM_3C595TX, "3C595 100bTX"), - DEVICE( 3COM, 3COM_3C595T4, "3C595 100bT4"), - DEVICE( 3COM, 3COM_3C595MII, "3C595 100b-MII"), - DEVICE( 3COM, 3COM_3C900TPO, "3C900 10bTPO"), - DEVICE( 3COM, 3COM_3C900COMBO,"3C900 10b Combo"), - DEVICE( 3COM, 3COM_3C905TX, "3C905 100bTX"), - DEVICE( SMC, SMC_EPIC100, "9432 TX"), - DEVICE( AL, AL_M1445, "M1445"), - DEVICE( AL, AL_M1449, "M1449"), - DEVICE( AL, AL_M1451, "M1451"), - DEVICE( AL, AL_M1461, "M1461"), - DEVICE( AL, AL_M1489, "M1489"), - DEVICE( AL, AL_M1511, "M1511"), - DEVICE( AL, AL_M1513, "M1513"), - DEVICE( AL, AL_M1521, "M1521"), - DEVICE( AL, AL_M1523, "M1523"), - DEVICE( AL, AL_M1531, "M1531 Aladdin IV"), - DEVICE( AL, AL_M1533, "M1533 Aladdin IV"), - DEVICE( AL, AL_M4803, "M4803"), - DEVICE( AL, AL_M5219, "M5219"), - DEVICE( AL, AL_M5229, "M5229 TXpro"), - DEVICE( SURECOM, SURECOM_NE34, "NE-34PCI LAN"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2070, "Magicgraph NM2070"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128V, "MagicGraph 128V"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128ZV, "MagicGraph 128ZV"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2160, "MagicGraph NM2160"), - DEVICE( ASP, ASP_ABP940, "ABP940"), - DEVICE( ASP, ASP_ABP940U, "ABP940U"), - DEVICE( CERN, CERN_SPSB_PMC, "STAR/RD24 SCI-PCI (PMC)"), - DEVICE( CERN, CERN_SPSB_PCI, "STAR/RD24 SCI-PCI (PMC)"), - DEVICE( IMS, IMS_8849, "8849"), - DEVICE( TEKRAM2, TEKRAM2_690c, "DC690c"), - DEVICE( TUNDRA, TUNDRA_CA91C042,"CA91C042 Universe"), - DEVICE( AMCC, AMCC_MYRINET, "Myrinet PCI (M2-PCI-32)"), - DEVICE( AMCC, AMCC_S5933, "S5933 PCI44"), - DEVICE( AMCC, AMCC_S5933_HEPC3,"S5933 Traquair HEPC3"), - DEVICE( INTERG, INTERG_1680, "IGA-1680"), - DEVICE( INTERG, INTERG_1682, "IGA-1682"), - DEVICE( REALTEK, REALTEK_8029, "8029"), - DEVICE( REALTEK, REALTEK_8129, "8129"), - DEVICE( TRUEVISION, TRUEVISION_T1000,"TARGA 1000"), - DEVICE( INIT, INIT_320P, "320 P"), - DEVICE( VIA, VIA_82C505, "VT 82C505"), - DEVICE( VIA, VIA_82C561, "VT 82C561"), - DEVICE( VIA, VIA_82C586_1, "VT 82C586 Apollo IDE"), - DEVICE( VIA, VIA_82C576, "VT 82C576 3V"), - DEVICE( VIA, VIA_82C585, "VT 82C585 Apollo VP1/VPX"), - DEVICE( VIA, VIA_82C586_0, "VT 82C586 Apollo ISA"), - DEVICE( VIA, VIA_82C595, "VT 82C595 Apollo VP2"), - DEVICE( VIA, VIA_82C926, "VT 82C926 Amazon"), - DEVICE( VIA, VIA_82C416, "VT 82C416MV"), - DEVICE( VIA, VIA_82C595_97, "VT 82C595 Apollo VP2/97"), - DEVICE( VIA, VIA_82C586_2, "VT 82C586 Apollo USB"), - DEVICE( VIA, VIA_82C586_3, "VT 82C586B Apollo ACPI"), - DEVICE( VORTEX, VORTEX_GDT60x0, "GDT 60x0"), - DEVICE( VORTEX, VORTEX_GDT6000B,"GDT 6000b"), - DEVICE( VORTEX, VORTEX_GDT6x10, "GDT 6110/6510"), - DEVICE( VORTEX, VORTEX_GDT6x20, "GDT 6120/6520"), - DEVICE( VORTEX, VORTEX_GDT6530, "GDT 6530"), - DEVICE( VORTEX, VORTEX_GDT6550, "GDT 6550"), - DEVICE( VORTEX, VORTEX_GDT6x17, "GDT 6117/6517"), - DEVICE( VORTEX, VORTEX_GDT6x27, "GDT 6127/6527"), - DEVICE( VORTEX, VORTEX_GDT6537, "GDT 6537"), - DEVICE( VORTEX, VORTEX_GDT6557, "GDT 6557"), - DEVICE( VORTEX, VORTEX_GDT6x15, "GDT 6115/6515"), - DEVICE( VORTEX, VORTEX_GDT6x25, "GDT 6125/6525"), - DEVICE( VORTEX, VORTEX_GDT6535, "GDT 6535"), - DEVICE( VORTEX, VORTEX_GDT6555, "GDT 6555"), - DEVICE( VORTEX, VORTEX_GDT6x17RP,"GDT 6117RP/6517RP"), - DEVICE( VORTEX, VORTEX_GDT6x27RP,"GDT 6127RP/6527RP"), - DEVICE( VORTEX, VORTEX_GDT6537RP,"GDT 6537RP"), - DEVICE( VORTEX, VORTEX_GDT6557RP,"GDT 6557RP"), - DEVICE( VORTEX, VORTEX_GDT6x11RP,"GDT 6111RP/6511RP"), - DEVICE( VORTEX, VORTEX_GDT6x21RP,"GDT 6121RP/6521RP"), - DEVICE( VORTEX, VORTEX_GDT6x17RP1,"GDT 6117RP1/6517RP1"), - DEVICE( VORTEX, VORTEX_GDT6x27RP1,"GDT 6127RP1/6527RP1"), - DEVICE( VORTEX, VORTEX_GDT6537RP1,"GDT 6537RP1"), - DEVICE( VORTEX, VORTEX_GDT6557RP1,"GDT 6557RP1"), - DEVICE( VORTEX, VORTEX_GDT6x11RP1,"GDT 6111RP1/6511RP1"), - DEVICE( VORTEX, VORTEX_GDT6x21RP1,"GDT 6121RP1/6521RP1"), - DEVICE( VORTEX, VORTEX_GDT6x17RP2,"GDT 6117RP2/6517RP2"), - DEVICE( VORTEX, VORTEX_GDT6x27RP2,"GDT 6127RP2/6527RP2"), - DEVICE( VORTEX, VORTEX_GDT6537RP2,"GDT 6537RP2"), - DEVICE( VORTEX, VORTEX_GDT6557RP2,"GDT 6557RP2"), - DEVICE( VORTEX, VORTEX_GDT6x11RP2,"GDT 6111RP2/6511RP2"), - DEVICE( VORTEX, VORTEX_GDT6x21RP2,"GDT 6121RP2/6521RP2"), - DEVICE( EF, EF_ATM_FPGA, "155P-MF1 (FPGA)"), - DEVICE( EF, EF_ATM_ASIC, "155P-MF1 (ASIC)"), - DEVICE( FORE, FORE_PCA200PC, "PCA-200PC"), - DEVICE( FORE, FORE_PCA200E, "PCA-200E"), - DEVICE( IMAGINGTECH, IMAGINGTECH_ICPCI, "MVC IC-PCI"), - DEVICE( PHILIPS, PHILIPS_SAA7146,"SAA7146"), - DEVICE( PLX, PLX_9060, "PCI9060 i960 bridge"), - DEVICE( ALLIANCE, ALLIANCE_PROMOTIO, "Promotion-6410"), - DEVICE( ALLIANCE, ALLIANCE_PROVIDEO, "Provideo"), - DEVICE( ALLIANCE, ALLIANCE_AT24, "AT24"), - DEVICE( ALLIANCE, ALLIANCE_AT3D, "AT3D"), - DEVICE( VMIC, VMIC_VME, "VMIVME-7587"), - DEVICE( DIGI, DIGI_RIGHTSWITCH, "RightSwitch SE-6"), - DEVICE( MUTECH, MUTECH_MV1000, "MV-1000"), - DEVICE( RENDITION, RENDITION_VERITE,"Verite 1000"), - DEVICE( RENDITION, RENDITION_VERITE2100,"Verite 2100"), - DEVICE( TOSHIBA, TOSHIBA_601, "Laptop"), - DEVICE( RICOH, RICOH_RL5C466, "RL5C466"), - DEVICE( ZEITNET, ZEITNET_1221, "1221"), - DEVICE( ZEITNET, ZEITNET_1225, "1225"), - DEVICE( OMEGA, OMEGA_82C092G, "82C092G"), - DEVICE( LITEON, LITEON_LNE100TX,"LNE100TX"), - DEVICE( NP, NP_PCI_FDDI, "NP-PCI"), - DEVICE( SPECIALIX, SPECIALIX_XIO, "XIO/SIO host"), - DEVICE( SPECIALIX, SPECIALIX_RIO, "RIO host"), - DEVICE( AURAVISION, AURAVISION_VXP524,"VXP524"), - DEVICE( IKON, IKON_10115, "10115 Greensheet"), - DEVICE( IKON, IKON_10117, "10117 Greensheet"), - DEVICE( ZORAN, ZORAN_36057, "ZR36057"), - DEVICE( ZORAN, ZORAN_36120, "ZR36120"), - DEVICE( COMPEX, COMPEX_ENET100VG4, "Readylink ENET100-VG4"), - DEVICE( COMPEX, COMPEX_RL2000, "ReadyLink 2000"), - DEVICE( RP, RP8OCTA, "RocketPort 8 Oct"), - DEVICE( RP, RP8INTF, "RocketPort 8 Intf"), - DEVICE( RP, RP16INTF, "RocketPort 16 Intf"), - DEVICE( RP, RP32INTF, "RocketPort 32 Intf"), - DEVICE( CYCLADES, CYCLOM_Y_Lo, "Cyclom-Y below 1Mbyte"), - DEVICE( CYCLADES, CYCLOM_Y_Hi, "Cyclom-Y above 1Mbyte"), - DEVICE( CYCLADES, CYCLOM_Z_Lo, "Cyclom-Z below 1Mbyte"), - DEVICE( CYCLADES, CYCLOM_Z_Hi, "Cyclom-Z above 1Mbyte"), - DEVICE( 3DFX, 3DFX_VOODOO, "Voodoo"), - DEVICE( STALLION, STALLION_ECHPCI832,"EasyConnection 8/32"), - DEVICE( STALLION, STALLION_ECHPCI864,"EasyConnection 8/64"), - DEVICE( STALLION, STALLION_EIOPCI,"EasyIO"), - DEVICE( SIGMADES, SIGMADES_6425, "REALmagic64/GX"), - DEVICE( OPTIBASE, OPTIBASE_FORGE, "MPEG Forge"), - DEVICE( OPTIBASE, OPTIBASE_FUSION,"MPEG Fusion"), - DEVICE( OPTIBASE, OPTIBASE_VPLEX, "VideoPlex"), - DEVICE( OPTIBASE, OPTIBASE_VPLEXCC,"VideoPlex CC"), - DEVICE( OPTIBASE, OPTIBASE_VQUEST,"VideoQuest"), - DEVICE( ENSONIQ, ENSONIQ_AUDIOPCI,"AudioPCI"), - DEVICE( PICTUREL, PICTUREL_PCIVST,"PCIVST"), - DEVICE( NVIDIA_SGS, NVIDIA_SGS_RIVA128, "Riva 128"), - DEVICE( SYMPHONY, SYMPHONY_101, "82C101"), - DEVICE( TEKRAM, TEKRAM_DC290, "DC-290"), - DEVICE( 3DLABS, 3DLABS_300SX, "GLINT 300SX"), - DEVICE( 3DLABS, 3DLABS_500TX, "GLINT 500TX"), - DEVICE( 3DLABS, 3DLABS_DELTA, "GLINT Delta"), - DEVICE( 3DLABS, 3DLABS_PERMEDIA,"PERMEDIA"), - DEVICE( AVANCE, AVANCE_ALG2064, "ALG2064i"), - DEVICE( AVANCE, AVANCE_2302, "ALG-2302"), - DEVICE( NETVIN, NETVIN_NV5000SC,"NV5000"), - DEVICE( S3, S3_PLATO_PXS, "PLATO/PX (system)"), - DEVICE( S3, S3_ViRGE, "ViRGE"), - DEVICE( S3, S3_TRIO, "Trio32/Trio64"), - DEVICE( S3, S3_AURORA64VP, "Aurora64V+"), - DEVICE( S3, S3_TRIO64UVP, "Trio64UV+"), - DEVICE( S3, S3_ViRGE_VX, "ViRGE/VX"), - DEVICE( S3, S3_868, "Vision 868"), - DEVICE( S3, S3_928, "Vision 928-P"), - DEVICE( S3, S3_864_1, "Vision 864-P"), - DEVICE( S3, S3_864_2, "Vision 864-P"), - DEVICE( S3, S3_964_1, "Vision 964-P"), - DEVICE( S3, S3_964_2, "Vision 964-P"), - DEVICE( S3, S3_968, "Vision 968"), - DEVICE( S3, S3_TRIO64V2, "Trio64V2/DX or /GX"), - DEVICE( S3, S3_PLATO_PXG, "PLATO/PX (graphics)"), - DEVICE( S3, S3_ViRGE_DXGX, "ViRGE/DX or /GX"), - DEVICE( S3, S3_ViRGE_GX2, "ViRGE/GX2"), - DEVICE( S3, S3_ViRGE_MX, "ViRGE/MX"), - DEVICE( S3, S3_ViRGE_MXP, "ViRGE/MX+"), - DEVICE( S3, S3_ViRGE_MXPMV, "ViRGE/MX+MV"), - DEVICE( INTEL, INTEL_82375, "82375EB"), - DEVICE( INTEL, INTEL_82424, "82424ZX Saturn"), - DEVICE( INTEL, INTEL_82378, "82378IB"), - DEVICE( INTEL, INTEL_82430, "82430ZX Aries"), - DEVICE( INTEL, INTEL_82434, "82434LX Mercury/Neptune"), - DEVICE( INTEL, INTEL_82092AA_0,"82092AA PCMCIA bridge"), - DEVICE( INTEL, INTEL_82092AA_1,"82092AA EIDE"), - DEVICE( INTEL, INTEL_7116, "SAA7116"), - DEVICE( INTEL, INTEL_82596, "82596"), - DEVICE( INTEL, INTEL_82865, "82865"), - DEVICE( INTEL, INTEL_82557, "82557"), - DEVICE( INTEL, INTEL_82437, "82437"), - DEVICE( INTEL, INTEL_82371FB_0,"82371FB PIIX ISA"), - DEVICE( INTEL, INTEL_82371FB_1,"82371FB PIIX IDE"), - DEVICE( INTEL, INTEL_82371MX, "430MX - 82371MX MPIIX"), - DEVICE( INTEL, INTEL_82437MX, "430MX - 82437MX MTSC"), - DEVICE( INTEL, INTEL_82441, "82441FX Natoma"), - DEVICE( INTEL, INTEL_82439, "82439HX Triton II"), - DEVICE( INTEL, INTEL_82371SB_0,"82371SB PIIX3 ISA"), - DEVICE( INTEL, INTEL_82371SB_1,"82371SB PIIX3 IDE"), - DEVICE( INTEL, INTEL_82371SB_2,"82371SB PIIX3 USB"), - DEVICE( INTEL, INTEL_82437VX, "82437VX Triton II"), - DEVICE( INTEL, INTEL_82439TX, "82439TX"), - DEVICE( INTEL, INTEL_82371AB_0,"82371AB PIIX4 ISA"), - DEVICE( INTEL, INTEL_82371AB, "82371AB PIIX4 IDE"), - DEVICE( INTEL, INTEL_82371AB_2,"82371AB PIIX4 USB"), - DEVICE( INTEL, INTEL_82371AB_3,"82371AB PIIX4 ACPI"), - DEVICE( INTEL, INTEL_82443LX_0,"440LX - 82443LX PAC Host"), - DEVICE( INTEL, INTEL_82443LX_1,"440LX - 82443LX PAC AGP"), - DEVICE( INTEL, INTEL_P6, "Orion P6"), - DEVICE( INTEL, INTEL_82450GX, "82450GX Orion P6"), - DEVICE( KTI, KTI_ET32P2, "ET32P2"), - DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"), - DEVICE( ADAPTEC, ADAPTEC_7855, "AIC-7855"), - DEVICE( ADAPTEC, ADAPTEC_5800, "AIC-5800"), - DEVICE( ADAPTEC, ADAPTEC_7860, "AIC-7860"), - DEVICE( ADAPTEC, ADAPTEC_7861, "AIC-7861"), - DEVICE( ADAPTEC, ADAPTEC_7870, "AIC-7870"), - DEVICE( ADAPTEC, ADAPTEC_7871, "AIC-7871"), - DEVICE( ADAPTEC, ADAPTEC_7872, "AIC-7872"), - DEVICE( ADAPTEC, ADAPTEC_7873, "AIC-7873"), - DEVICE( ADAPTEC, ADAPTEC_7874, "AIC-7874"), - DEVICE( ADAPTEC, ADAPTEC_7895, "AIC-7895U"), - DEVICE( ADAPTEC, ADAPTEC_7880, "AIC-7880U"), - DEVICE( ADAPTEC, ADAPTEC_7881, "AIC-7881U"), - DEVICE( ADAPTEC, ADAPTEC_7882, "AIC-7882U"), - DEVICE( ADAPTEC, ADAPTEC_7883, "AIC-7883U"), - DEVICE( ADAPTEC, ADAPTEC_7884, "AIC-7884U"), - DEVICE( ATRONICS, ATRONICS_2015, "IDE-2015PL"), - DEVICE( ARK, ARK_STING, "Stingray"), - DEVICE( ARK, ARK_STINGARK, "Stingray ARK 2000PV"), - DEVICE( ARK, ARK_2000MT, "2000MT") -}; - - -/* - * device_info[] is sorted so we can use binary search + * pci_malloc() returns initialized memory of size SIZE. Can be + * used only while pci_init() is active. */ -struct pci_dev_info *pci_lookup_dev(unsigned int vendor, unsigned int dev) -{ - int min = 0, - max = sizeof(dev_info)/sizeof(dev_info[0]) - 1; - - for ( ; ; ) - { - int i = (min + max) >> 1; - long order; - - order = dev_info[i].vendor - (long) vendor; - if (!order) - order = dev_info[i].device - (long) dev; - - if (order < 0) - { - min = i + 1; - if ( min > max ) - return 0; - continue; - } - - if (order > 0) - { - max = i - 1; - if ( min > max ) - return 0; - continue; - } - - return & dev_info[ i ]; - } -} - -const char *pci_strclass (unsigned int class) -{ - switch (class >> 8) { - case PCI_CLASS_NOT_DEFINED: return "Non-VGA device"; - case PCI_CLASS_NOT_DEFINED_VGA: return "VGA compatible device"; - - case PCI_CLASS_STORAGE_SCSI: return "SCSI bus controller"; - case PCI_CLASS_STORAGE_IDE: return "IDE controller"; - case PCI_CLASS_STORAGE_FLOPPY: return "Floppy disk controller"; - case PCI_CLASS_STORAGE_IPI: return "IPI bus controller"; - case PCI_CLASS_STORAGE_RAID: return "RAID controller"; - case PCI_CLASS_STORAGE_OTHER: return "Unknown mass storage controller"; - - case PCI_CLASS_NETWORK_ETHERNET: return "Ethernet controller"; - case PCI_CLASS_NETWORK_TOKEN_RING: return "Token ring network controller"; - case PCI_CLASS_NETWORK_FDDI: return "FDDI network controller"; - case PCI_CLASS_NETWORK_ATM: return "ATM network controller"; - case PCI_CLASS_NETWORK_OTHER: return "Network controller"; - - case PCI_CLASS_DISPLAY_VGA: return "VGA compatible controller"; - case PCI_CLASS_DISPLAY_XGA: return "XGA compatible controller"; - case PCI_CLASS_DISPLAY_OTHER: return "Display controller"; - - case PCI_CLASS_MULTIMEDIA_VIDEO: return "Multimedia video controller"; - case PCI_CLASS_MULTIMEDIA_AUDIO: return "Multimedia audio controller"; - case PCI_CLASS_MULTIMEDIA_OTHER: return "Multimedia controller"; - - case PCI_CLASS_MEMORY_RAM: return "RAM memory"; - case PCI_CLASS_MEMORY_FLASH: return "FLASH memory"; - case PCI_CLASS_MEMORY_OTHER: return "Memory"; - - case PCI_CLASS_BRIDGE_HOST: return "Host bridge"; - case PCI_CLASS_BRIDGE_ISA: return "ISA bridge"; - case PCI_CLASS_BRIDGE_EISA: return "EISA bridge"; - case PCI_CLASS_BRIDGE_MC: return "MicroChannel bridge"; - case PCI_CLASS_BRIDGE_PCI: return "PCI bridge"; - case PCI_CLASS_BRIDGE_PCMCIA: return "PCMCIA bridge"; - case PCI_CLASS_BRIDGE_NUBUS: return "NuBus bridge"; - case PCI_CLASS_BRIDGE_CARDBUS: return "CardBus bridge"; - case PCI_CLASS_BRIDGE_OTHER: return "Bridge"; - - case PCI_CLASS_COMMUNICATION_SERIAL: return "Serial controller"; - case PCI_CLASS_COMMUNICATION_PARALLEL: return "Parallel controller"; - case PCI_CLASS_COMMUNICATION_OTHER: return "Communication controller"; - - case PCI_CLASS_SYSTEM_PIC: return "PIC"; - case PCI_CLASS_SYSTEM_DMA: return "DMA controller"; - case PCI_CLASS_SYSTEM_TIMER: return "Timer"; - case PCI_CLASS_SYSTEM_RTC: return "RTC"; - case PCI_CLASS_SYSTEM_OTHER: return "System peripheral"; - - case PCI_CLASS_INPUT_KEYBOARD: return "Keyboard controller"; - case PCI_CLASS_INPUT_PEN: return "Digitizer Pen"; - case PCI_CLASS_INPUT_MOUSE: return "Mouse controller"; - case PCI_CLASS_INPUT_OTHER: return "Input device controller"; - - case PCI_CLASS_DOCKING_GENERIC: return "Generic Docking Station"; - case PCI_CLASS_DOCKING_OTHER: return "Docking Station"; - - case PCI_CLASS_PROCESSOR_386: return "386"; - case PCI_CLASS_PROCESSOR_486: return "486"; - case PCI_CLASS_PROCESSOR_PENTIUM: return "Pentium"; - case PCI_CLASS_PROCESSOR_ALPHA: return "Alpha"; - case PCI_CLASS_PROCESSOR_POWERPC: return "Power PC"; - case PCI_CLASS_PROCESSOR_CO: return "Co-processor"; - - case PCI_CLASS_SERIAL_FIREWIRE: return "FireWire (IEEE 1394)"; - case PCI_CLASS_SERIAL_ACCESS: return "ACCESS Bus"; - case PCI_CLASS_SERIAL_SSA: return "SSA"; - case PCI_CLASS_SERIAL_USB: return "USB Controller"; - case PCI_CLASS_SERIAL_FIBER: return "Fiber Channel"; - - default: return "Unknown class"; - } -} - - -const char *pci_strvendor(unsigned int vendor) -{ - switch (vendor) { - case PCI_VENDOR_ID_COMPAQ: return "Compaq"; - case PCI_VENDOR_ID_NCR: return "NCR"; - case PCI_VENDOR_ID_ATI: return "ATI"; - case PCI_VENDOR_ID_VLSI: return "VLSI"; - case PCI_VENDOR_ID_ADL: return "Avance Logic"; - case PCI_VENDOR_ID_NS: return "NS"; - case PCI_VENDOR_ID_TSENG: return "Tseng'Lab"; - case PCI_VENDOR_ID_WEITEK: return "Weitek"; - case PCI_VENDOR_ID_DEC: return "DEC"; - case PCI_VENDOR_ID_CIRRUS: return "Cirrus Logic"; - case PCI_VENDOR_ID_IBM: return "IBM"; - case PCI_VENDOR_ID_WD: return "Western Digital"; - case PCI_VENDOR_ID_AMD: return "AMD"; - case PCI_VENDOR_ID_TRIDENT: return "Trident"; - case PCI_VENDOR_ID_AI: return "Acer Incorporated"; - case PCI_VENDOR_ID_MATROX: return "Matrox"; - case PCI_VENDOR_ID_CT: return "Chips & Technologies"; - case PCI_VENDOR_ID_MIRO: return "Miro"; - case PCI_VENDOR_ID_NEC: return "NEC"; - case PCI_VENDOR_ID_FD: return "Future Domain"; - case PCI_VENDOR_ID_SI: return "Silicon Integrated Systems"; - case PCI_VENDOR_ID_HP: return "Hewlett Packard"; - case PCI_VENDOR_ID_PCTECH: return "PCTECH"; - case PCI_VENDOR_ID_DPT: return "DPT"; - case PCI_VENDOR_ID_OPTI: return "OPTi"; - case PCI_VENDOR_ID_SGS: return "SGS Thomson"; - case PCI_VENDOR_ID_BUSLOGIC: return "BusLogic"; - case PCI_VENDOR_ID_TI: return "Texas Instruments"; - case PCI_VENDOR_ID_OAK: return "OAK"; - case PCI_VENDOR_ID_WINBOND2: return "Winbond"; - case PCI_VENDOR_ID_MOTOROLA: return "Motorola"; - case PCI_VENDOR_ID_PROMISE: return "Promise Technology"; - case PCI_VENDOR_ID_N9: return "Number Nine"; - case PCI_VENDOR_ID_UMC: return "UMC"; - case PCI_VENDOR_ID_X: return "X TECHNOLOGY"; - case PCI_VENDOR_ID_PICOP: return "PicoPower"; - case PCI_VENDOR_ID_APPLE: return "Apple"; - case PCI_VENDOR_ID_NEXGEN: return "Nexgen"; - case PCI_VENDOR_ID_QLOGIC: return "Q Logic"; - case PCI_VENDOR_ID_CYRIX: return "Cyrix"; - case PCI_VENDOR_ID_LEADTEK: return "Leadtek Research"; - case PCI_VENDOR_ID_CONTAQ: return "Contaq"; - case PCI_VENDOR_ID_FOREX: return "Forex"; - case PCI_VENDOR_ID_OLICOM: return "Olicom"; - case PCI_VENDOR_ID_SUN: return "Sun Microsystems"; - case PCI_VENDOR_ID_CMD: return "CMD"; - case PCI_VENDOR_ID_VISION: return "Vision"; - case PCI_VENDOR_ID_BROOKTREE: return "Brooktree"; - case PCI_VENDOR_ID_SIERRA: return "Sierra"; - case PCI_VENDOR_ID_ACC: return "ACC MICROELECTRONICS"; - case PCI_VENDOR_ID_WINBOND: return "Winbond"; - case PCI_VENDOR_ID_DATABOOK: return "Databook"; - case PCI_VENDOR_ID_3COM: return "3Com"; - case PCI_VENDOR_ID_SMC: return "SMC"; - case PCI_VENDOR_ID_AL: return "Acer Labs"; - case PCI_VENDOR_ID_MITSUBISHI: return "Mitsubishi"; - case PCI_VENDOR_ID_SURECOM: return "Surecom"; - case PCI_VENDOR_ID_NEOMAGIC: return "Neomagic"; - case PCI_VENDOR_ID_ASP: return "Advanced System Products"; - case PCI_VENDOR_ID_CERN: return "CERN"; - case PCI_VENDOR_ID_NVIDIA: return "NVidia"; - case PCI_VENDOR_ID_IMS: return "IMS"; - case PCI_VENDOR_ID_TEKRAM2: return "Tekram"; - case PCI_VENDOR_ID_TUNDRA: return "Tundra"; - case PCI_VENDOR_ID_AMCC: return "AMCC"; - case PCI_VENDOR_ID_INTERG: return "Intergraphics"; - case PCI_VENDOR_ID_REALTEK: return "Realtek"; - case PCI_VENDOR_ID_TRUEVISION: return "Truevision"; - case PCI_VENDOR_ID_INIT: return "Initio Corp"; - case PCI_VENDOR_ID_VIA: return "VIA Technologies"; - case PCI_VENDOR_ID_VORTEX: return "VORTEX"; - case PCI_VENDOR_ID_EF: return "Efficient Networks"; - case PCI_VENDOR_ID_FORE: return "Fore Systems"; - case PCI_VENDOR_ID_IMAGINGTECH: return "Imaging Technology"; - case PCI_VENDOR_ID_PHILIPS: return "Philips"; - case PCI_VENDOR_ID_PLX: return "PLX"; - case PCI_VENDOR_ID_ALLIANCE: return "Alliance"; - case PCI_VENDOR_ID_VMIC: return "VMIC"; - case PCI_VENDOR_ID_DIGI: return "Digi Intl."; - case PCI_VENDOR_ID_MUTECH: return "Mutech"; - case PCI_VENDOR_ID_RENDITION: return "Rendition"; - case PCI_VENDOR_ID_TOSHIBA: return "Toshiba"; - case PCI_VENDOR_ID_RICOH: return "Ricoh"; - case PCI_VENDOR_ID_ZEITNET: return "ZeitNet"; - case PCI_VENDOR_ID_OMEGA: return "Omega Micro"; - case PCI_VENDOR_ID_LITEON: return "LiteOn"; - case PCI_VENDOR_ID_NP: return "Network Peripherals"; - case PCI_VENDOR_ID_SPECIALIX: return "Specialix"; - case PCI_VENDOR_ID_AURAVISION: return "Auravision"; - case PCI_VENDOR_ID_IKON: return "Ikon"; - case PCI_VENDOR_ID_ZORAN: return "Zoran"; - case PCI_VENDOR_ID_COMPEX: return "Compex"; - case PCI_VENDOR_ID_RP: return "Comtrol"; - case PCI_VENDOR_ID_CYCLADES: return "Cyclades"; - case PCI_VENDOR_ID_3DFX: return "3Dfx"; - case PCI_VENDOR_ID_STALLION: return "Stallion Technologies"; - case PCI_VENDOR_ID_SIGMADES: return "Sigma Designs"; - case PCI_VENDOR_ID_OPTIBASE: return "Optibase"; - case PCI_VENDOR_ID_ENSONIQ: return "Ensoniq"; - case PCI_VENDOR_ID_PICTUREL: return "Picture Elements"; - case PCI_VENDOR_ID_NVIDIA_SGS: return "NVidia/SGS Thomson"; - case PCI_VENDOR_ID_SYMPHONY: return "Symphony"; - case PCI_VENDOR_ID_TEKRAM: return "Tekram"; - case PCI_VENDOR_ID_3DLABS: return "3Dlabs"; - case PCI_VENDOR_ID_AVANCE: return "Avance"; - case PCI_VENDOR_ID_NETVIN: return "NetVin"; - case PCI_VENDOR_ID_S3: return "S3 Inc."; - case PCI_VENDOR_ID_INTEL: return "Intel"; - case PCI_VENDOR_ID_KTI: return "KTI"; - case PCI_VENDOR_ID_ADAPTEC: return "Adaptec"; - case PCI_VENDOR_ID_ATRONICS: return "Atronics"; - case PCI_VENDOR_ID_ARK: return "ARK Logic"; - default: return "Unknown vendor"; - } -} - - -const char *pci_strdev(unsigned int vendor, unsigned int device) +__initfunc(static void *pci_malloc(long size, unsigned long *mem_startp)) { - struct pci_dev_info *info; + void *mem; - info = pci_lookup_dev(vendor, device); - return info ? info->name : "Unknown device"; + mem = (void*) *mem_startp; + *mem_startp += (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1); + memset(mem, 0, size); + return mem; } @@ -704,10 +55,10 @@ case PCIBIOS_BAD_REGISTER_NUMBER: return "BAD_REGISTER_NUMBER"; - case PCIBIOS_SET_FAILED: + case PCIBIOS_SET_FAILED: return "SET_FAILED"; - case PCIBIOS_BUFFER_TOO_SMALL: + case PCIBIOS_BUFFER_TOO_SMALL: return "BUFFER_TOO_SMALL"; default: @@ -717,198 +68,10 @@ } -/* - * Convert some of the configuration space registers of the device at - * address (bus,devfn) into a string (possibly several lines each). - * The configuration string is stored starting at buf[len]. If the - * string would exceed the size of the buffer (SIZE), 0 is returned. - */ -static int sprint_dev_config(struct pci_dev *dev, char *buf, int size) -{ - unsigned long base; - unsigned int l, class_rev, bus, devfn; - unsigned short vendor, device, status; - unsigned char bist, latency, min_gnt, max_lat; - int reg, len = 0; - const char *str; - - bus = dev->bus->number; - devfn = dev->devfn; - - pcibios_read_config_dword(bus, devfn, PCI_CLASS_REVISION, &class_rev); - pcibios_read_config_word (bus, devfn, PCI_VENDOR_ID, &vendor); - pcibios_read_config_word (bus, devfn, PCI_DEVICE_ID, &device); - pcibios_read_config_word (bus, devfn, PCI_STATUS, &status); - pcibios_read_config_byte (bus, devfn, PCI_BIST, &bist); - pcibios_read_config_byte (bus, devfn, PCI_LATENCY_TIMER, &latency); - pcibios_read_config_byte (bus, devfn, PCI_MIN_GNT, &min_gnt); - pcibios_read_config_byte (bus, devfn, PCI_MAX_LAT, &max_lat); - if (len + 80 > size) { - return -1; - } - len += sprintf(buf + len, " Bus %2d, device %3d, function %2d:\n", - bus, PCI_SLOT(devfn), PCI_FUNC(devfn)); - - if (len + 80 > size) { - return -1; - } - len += sprintf(buf + len, " %s: %s %s (rev %d).\n ", - pci_strclass(class_rev >> 8), pci_strvendor(vendor), - pci_strdev(vendor, device), class_rev & 0xff); - - if (!pci_lookup_dev(vendor, device)) { - len += sprintf(buf + len, - "Vendor id=%x. Device id=%x.\n ", - vendor, device); - } - - str = 0; /* to keep gcc shut... */ - switch (status & PCI_STATUS_DEVSEL_MASK) { - case PCI_STATUS_DEVSEL_FAST: str = "Fast devsel. "; break; - case PCI_STATUS_DEVSEL_MEDIUM: str = "Medium devsel. "; break; - case PCI_STATUS_DEVSEL_SLOW: str = "Slow devsel. "; break; - } - if (len + strlen(str) > size) { - return -1; - } - len += sprintf(buf + len, str); - - if (status & PCI_STATUS_FAST_BACK) { -# define fast_b2b_capable "Fast back-to-back capable. " - if (len + strlen(fast_b2b_capable) > size) { - return -1; - } - len += sprintf(buf + len, fast_b2b_capable); -# undef fast_b2b_capable - } - - if (bist & PCI_BIST_CAPABLE) { -# define BIST_capable "BIST capable. " - if (len + strlen(BIST_capable) > size) { - return -1; - } - len += sprintf(buf + len, BIST_capable); -# undef BIST_capable - } - - if (dev->irq) { - if (len + 40 > size) { - return -1; - } - len += sprintf(buf + len, "IRQ %d. ", dev->irq); - } - - if (dev->master) { - if (len + 80 > size) { - return -1; - } - len += sprintf(buf + len, "Master Capable. "); - if (latency) - len += sprintf(buf + len, "Latency=%d. ", latency); - else - len += sprintf(buf + len, "No bursts. "); - if (min_gnt) - len += sprintf(buf + len, "Min Gnt=%d.", min_gnt); - if (max_lat) - len += sprintf(buf + len, "Max Lat=%d.", max_lat); - } - - for (reg = 0; reg < 6; reg++) { - if (len + 40 > size) { - return -1; - } - pcibios_read_config_dword(bus, devfn, - PCI_BASE_ADDRESS_0 + (reg << 2), &l); - if (l == 0xffffffff) - base = 0; - else - base = l; - if (!base) - continue; - - if (base & PCI_BASE_ADDRESS_SPACE_IO) { - len += sprintf(buf + len, - "\n I/O at 0x%lx [0x%lx].", - base & PCI_BASE_ADDRESS_IO_MASK, - dev->base_address[reg]); - } else { - const char *pref, *type = "unknown"; - - if (base & PCI_BASE_ADDRESS_MEM_PREFETCH) { - pref = "P"; - } else { - pref = "Non-p"; - } - switch (base & PCI_BASE_ADDRESS_MEM_TYPE_MASK) { - case PCI_BASE_ADDRESS_MEM_TYPE_32: - type = "32 bit"; break; - case PCI_BASE_ADDRESS_MEM_TYPE_1M: - type = "20 bit"; break; - case PCI_BASE_ADDRESS_MEM_TYPE_64: - type = "64 bit"; - /* read top 32 bit address of base addr: */ - reg += 4; - pcibios_read_config_dword(bus, devfn, reg, &l); - base |= ((u64) l) << 32; - break; - } - len += sprintf(buf + len, - "\n %srefetchable %s memory at " - "0x%lx [0x%lx].", pref, type, - base & PCI_BASE_ADDRESS_MEM_MASK, - dev->base_address[reg]); - } - } - - len += sprintf(buf + len, "\n"); - return len; -} - - -/* - * Return list of PCI devices as a character string for /proc/pci. - * BUF is a buffer that is PAGE_SIZE bytes long. - */ -int get_pci_list(char *buf) -{ - int nprinted, len, size; - struct pci_dev *dev; -# define MSG "\nwarning: page-size limit reached!\n" - - /* reserve same for truncation warning message: */ - size = PAGE_SIZE - (strlen(MSG) + 1); - len = sprintf(buf, "PCI devices found:\n"); - - for (dev = pci_devices; dev; dev = dev->next) { - nprinted = sprint_dev_config(dev, buf + len, size - len); - if (nprinted < 0) { - return len + sprintf(buf + len, MSG); - } - len += nprinted; - } - return len; -} - - -/* - * pci_malloc() returns initialized memory of size SIZE. Can be - * used only while pci_init() is active. - */ -__initfunc(static void *pci_malloc(long size, unsigned long *mem_startp)) -{ - void *mem; - - mem = (void*) *mem_startp; - *mem_startp += (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1); - memset(mem, 0, size); - return mem; -} - unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp) { unsigned int devfn, l, max, class; unsigned char cmd, irq, tmp, hdr_type = 0; - struct pci_dev_info *info; struct pci_dev *dev; struct pci_bus *child; int reg; @@ -939,17 +102,6 @@ dev->vendor = l & 0xffff; dev->device = (l >> 16) & 0xffff; - /* - * Check to see if we know about this device and report - * a message at boot time. This is the only way to - * learn about new hardware... - */ - info = pci_lookup_dev(dev->vendor, dev->device); - if (!info) { - printk("PCI: Warning: Unknown PCI device (%x:%x). Please read include/linux/pci.h\n", - dev->vendor, dev->device); - } - /* non-destructively determine if device can be a master: */ pcibios_read_config_byte(bus->number, devfn, PCI_COMMAND, &cmd); pcibios_write_config_byte(bus->number, devfn, PCI_COMMAND, cmd | PCI_COMMAND_MASTER); @@ -1047,7 +199,7 @@ * has already been configured by the system. If so, * do not modify the configuration, merely note it. */ - pcibios_read_config_dword(bus->number, devfn, 0x18, &buses); + pcibios_read_config_dword(bus->number, devfn, PCI_PRIMARY_BUS, &buses); if ((buses & 0xFFFFFF) != 0) { child->primary = buses & 0xFF; @@ -1066,7 +218,7 @@ (((unsigned int)(child->primary) << 0) | ((unsigned int)(child->secondary) << 8) | ((unsigned int)(child->subordinate) << 16)); - pcibios_write_config_dword(bus->number, devfn, 0x18, buses); + pcibios_write_config_dword(bus->number, devfn, PCI_PRIMARY_BUS, buses); /* * Now we can scan all subordinate buses: */ @@ -1078,7 +230,7 @@ child->subordinate = max; buses = (buses & 0xff00ffff) | ((unsigned int)(child->subordinate) << 16); - pcibios_write_config_dword(bus->number, devfn, 0x18, buses); + pcibios_write_config_dword(bus->number, devfn, PCI_PRIMARY_BUS, buses); } pcibios_write_config_word(bus->number, devfn, PCI_COMMAND, cr); } @@ -1113,16 +265,6 @@ /* give BIOS a chance to apply platform specific fixes: */ mem_start = pcibios_fixup(mem_start, mem_end); - -#ifdef DEBUG - { - int len = get_pci_list((char*)mem_start); - if (len) { - ((char *) mem_start)[len] = '\0'; - printk("%s\n", (char *) mem_start); - } - } -#endif #ifdef CONFIG_PCI_OPTIMIZE pci_quirks_init(); diff -ruN /usr/src/linux-2.1/drivers/pci/proc.c drivers/pci/proc.c --- /usr/src/linux-2.1/drivers/pci/proc.c Thu Jan 1 01:00:00 1970 +++ drivers/pci/proc.c Sun Dec 28 13:14:24 1997 @@ -0,0 +1,292 @@ +/* + * $Id: proc.c,v 1.1 1997/12/22 17:22:31 mj Exp $ + * + * Procfs interface for the PCI bus. + * + * Copyright (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz> + */ + +#include <linux/config.h> +#include <linux/types.h> +#include <linux/kernel.h> +#include <linux/bios32.h> +#include <linux/pci.h> +#include <linux/proc_fs.h> +#include <linux/init.h> +#include <asm/uaccess.h> +#include <asm/byteorder.h> + +#define PCI_CFG_SPACE_SIZE 256 + +static loff_t +proc_bus_pci_lseek(struct file *file, loff_t off, int whence) +{ + loff_t new; + + switch (whence) { + case 0: + new = off; + break; + case 1: + new = file->f_pos + off; + break; + case 2: + new = PCI_CFG_SPACE_SIZE + off; + break; + default: + return -EINVAL; + } + if (new < 0 || new > PCI_CFG_SPACE_SIZE) + return -EINVAL; + return (file->f_pos = new); +} + +static ssize_t +proc_bus_pci_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) +{ + struct inode *ino = file->f_dentry->d_inode; + struct proc_dir_entry *dp = ino->u.generic_ip; + struct pci_dev *dev = dp->data; + int pos = *ppos; + unsigned char bus = dev->bus->number; + unsigned char dfn = dev->devfn; + int cnt; + + if (pos >= PCI_CFG_SPACE_SIZE) + return 0; + if (nbytes >= PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE; + if (pos + nbytes > PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE - pos; + cnt = nbytes; + + if (!access_ok(VERIFY_WRITE, buf, cnt)) + return -EINVAL; + + if ((pos & 1) && cnt) { + unsigned char val; + pcibios_read_config_byte(bus, dfn, pos, &val); + __put_user(val, buf); + buf++; + pos++; + cnt--; + } + + if ((pos & 3) && cnt > 2) { + unsigned short val; + pcibios_read_config_word(bus, dfn, pos, &val); + __put_user(cpu_to_le16(val), (unsigned short *) buf); + buf += 2; + pos += 2; + cnt -= 2; + } + + while (cnt >= 4) { + unsigned int val; + pcibios_read_config_dword(bus, dfn, pos, &val); + __put_user(cpu_to_le32(val), (unsigned int *) buf); + buf += 4; + pos += 4; + cnt -= 4; + } + + if (cnt >= 2) { + unsigned short val; + pcibios_read_config_word(bus, dfn, pos, &val); + __put_user(cpu_to_le16(val), (unsigned short *) buf); + buf += 2; + pos += 2; + cnt -= 2; + } + + if (cnt) { + unsigned char val; + pcibios_read_config_byte(bus, dfn, pos, &val); + __put_user(val, buf); + buf++; + pos++; + cnt--; + } + + *ppos = pos; + return nbytes; +} + +static ssize_t +proc_bus_pci_write(struct file *file, const char *buf, size_t nbytes, loff_t *ppos) +{ + struct inode *ino = file->f_dentry->d_inode; + struct proc_dir_entry *dp = ino->u.generic_ip; + struct pci_dev *dev = dp->data; + int pos = *ppos; + unsigned char bus = dev->bus->number; + unsigned char dfn = dev->devfn; + int cnt; + + if (pos >= PCI_CFG_SPACE_SIZE) + return 0; + if (nbytes >= PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE; + if (pos + nbytes > PCI_CFG_SPACE_SIZE) + nbytes = PCI_CFG_SPACE_SIZE - pos; + cnt = nbytes; + + if (!access_ok(VERIFY_READ, buf, cnt)) + return -EINVAL; + + if ((pos & 1) && cnt) { + unsigned char val; + __get_user(val, buf); + pcibios_write_config_byte(bus, dfn, pos, val); + buf++; + pos++; + cnt--; + } + + if ((pos & 3) && cnt > 2) { + unsigned short val; + __get_user(val, (unsigned short *) buf); + pcibios_write_config_word(bus, dfn, pos, le16_to_cpu(val)); + buf += 2; + pos += 2; + cnt -= 2; + } + + while (cnt >= 4) { + unsigned int val; + __get_user(val, (unsigned int *) buf); + pcibios_write_config_dword(bus, dfn, pos, le32_to_cpu(val)); + buf += 4; + pos += 4; + cnt -= 4; + } + + if (cnt >= 2) { + unsigned short val; + __get_user(val, (unsigned short *) buf); + pcibios_write_config_word(bus, dfn, pos, le16_to_cpu(val)); + buf += 2; + pos += 2; + cnt -= 2; + } + + if (cnt) { + unsigned char val; + __get_user(val, buf); + pcibios_write_config_byte(bus, dfn, pos, val); + buf++; + pos++; + cnt--; + } + + *ppos = pos; + return nbytes; +} + +static struct file_operations proc_bus_pci_operations = { + proc_bus_pci_lseek, + proc_bus_pci_read, + proc_bus_pci_write, + NULL, /* readdir */ + NULL, /* poll */ + NULL, /* ioctl */ + NULL, /* mmap */ + NULL, /* no special open code */ + NULL, /* no special release code */ + NULL /* can't fsync */ +}; + +static struct inode_operations proc_bus_pci_inode_operations = { + &proc_bus_pci_operations, /* default base directory file-ops */ + NULL, /* create */ + NULL, /* lookup */ + NULL, /* link */ + NULL, /* unlink */ + NULL, /* symlink */ + NULL, /* mkdir */ + NULL, /* rmdir */ + NULL, /* mknod */ + NULL, /* rename */ + NULL, /* readlink */ + NULL, /* follow_link */ + NULL, /* readpage */ + NULL, /* writepage */ + NULL, /* bmap */ + NULL, /* truncate */ + NULL /* permission */ +}; + +int +get_pci_dev_info(char *buf, char **start, off_t pos, int count, int wr) +{ + struct pci_dev *dev = pci_devices; + off_t at = 0; + int len, i, cnt; + + cnt = 0; + while (dev && count > cnt) { + len = sprintf(buf, "%02x%02x\t%04x%04x\t%x", + dev->bus->number, + dev->devfn, + dev->vendor, + dev->device, + dev->irq); + for(i=0; i<6; i++) + len += sprintf(buf+len, +#if BITS_PER_LONG == 32 + "\t%08lx", +#else + "\t%016lx", +#endif + dev->base_address[i]); + buf[len++] = '\n'; + at += len; + if (at >= pos) { + if (!*start) { + *start = buf + (pos - (at - len)); + cnt = at - pos; + } else + cnt += len; + buf += len; + } + dev = dev->next; + } + return (count > cnt) ? cnt : count; +} + +static struct proc_dir_entry proc_pci_devices = { + PROC_BUS_PCI_DEVICES, 7, "devices", + S_IFREG | S_IRUGO, 1, 0, 0, + 0, &proc_array_inode_operations, + get_pci_dev_info +}; + +__initfunc(void proc_bus_pci_init(void)) +{ + struct proc_dir_entry *proc_pci; + struct pci_bus *bus; + + if (!pcibios_present()) + return; + proc_pci = create_proc_entry("pci", S_IFDIR, proc_bus); + proc_register(proc_pci, &proc_pci_devices); + for(bus = &pci_root; bus; bus = bus->next) { + char name[16]; + struct proc_dir_entry *de; + struct pci_dev *dev; + + sprintf(name, "%02x", bus->number); + de = create_proc_entry(name, S_IFDIR, proc_pci); + for(dev = bus->devices; dev; dev = dev->sibling) { + struct proc_dir_entry *e; + + sprintf(name, "%02x.%x", + PCI_SLOT(dev->devfn), + PCI_FUNC(dev->devfn)); + e = create_proc_entry(name, S_IFREG | S_IRUGO | S_IWUSR, de); + e->ops = &proc_bus_pci_inode_operations; + e->data = dev; + e->size = PCI_CFG_SPACE_SIZE; + } + } +} --- /usr/src/linux-2.1/drivers/net/ne.c Sat Dec 13 21:18:23 1997 +++ drivers/net/ne.c Mon Dec 22 21:45:51 1997 @@ -72,14 +72,14 @@ #ifdef CONFIG_PCI /* Ack! People are making PCI ne2000 clones! Oh the horror, the horror... */ -static struct { unsigned short vendor, dev_id;} +static struct { unsigned short vendor, dev_id; char *name; } pci_clone_list[] __initdata = { - {PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029}, - {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940}, - {PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000}, - {PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2}, - {PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC}, - {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C926}, + {PCI_VENDOR_ID_REALTEK, PCI_DEVICE_ID_REALTEK_8029, "Realtek 8029" }, + {PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940, "Winbond 89C940" }, + {PCI_VENDOR_ID_COMPEX, PCI_DEVICE_ID_COMPEX_RL2000, "Compex ReadyLink 2000" }, + {PCI_VENDOR_ID_KTI, PCI_DEVICE_ID_KTI_ET32P2, "KTI ET32P2" }, + {PCI_VENDOR_ID_NETVIN, PCI_DEVICE_ID_NETVIN_NV5000SC, "NetVin NV5000" }, + {PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C926, "VIA 82C926 Amazon" }, {0,} }; #endif @@ -228,9 +228,8 @@ break; /* Beauty -- got a valid card. */ } if (pci_irq_line == 0) continue; /* Try next PCI ID */ - printk("ne.c: PCI BIOS reports %s %s at i/o %#x, irq %d.\n", - pci_strvendor(pci_clone_list[i].vendor), - pci_strdev(pci_clone_list[i].vendor, pci_clone_list[i].dev_id), + printk("ne.c: PCI BIOS reports %s at i/o %#x, irq %d.\n", + pci_clone_list[i].name, pci_ioaddr, pci_irq_line); if (ne_probe1(dev, pci_ioaddr) != 0) { /* Shouldn't happen. */ printk(KERN_ERR "ne.c: Probe of PCI card at %#x failed.\n", pci_ioaddr); --- /usr/src/linux-2.1/MAINTAINERS Sat Dec 20 22:39:47 1997 +++ MAINTAINERS Fri Dec 26 22:53:01 1997 @@ -395,7 +389,7 @@ SVGA HANDLING: P: Martin Mares -M: mj@k332.feld.cvut.cz +M: mj@atrey.karlin.mff.cuni.cz L: linux-video@atrey.karlin.mff.cuni.cz S: Maintained @@ -564,5 +551,11 @@ P: Krzysztof G. Baranowski M: kgb@manjak.knm.org.pl S: Maintained + +PCI SUBSYSTEM +P: Martin Mares +M: mj@atrey.karlin.mff.cuni.cz +L: linux-kernel@vger.rutgers.edu +S: Maintained REST: --- /usr/src/linux-2.1/arch/alpha/config.in Mon Dec 22 10:36:20 1997 +++ arch/alpha/config.in Fri Dec 26 19:09:28 1997 @@ -80,8 +80,9 @@ if [ "$CONFIG_PCI" = "y" ]; then bool 'TGA Console Support' CONFIG_TGA_CONSOLE if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool 'PCI bridge optimization (experimental)' CONFIG_PCI_OPTIMIZE fi + bool 'Backward-compatible /proc/pci' CONFIG_PCI_OLD_PROC fi bool 'Networking support' CONFIG_NET bool 'System V IPC' CONFIG_SYSVIPC --- /usr/src/linux-2.1/arch/alpha/defconfig Thu Dec 4 15:15:02 1997 +++ arch/alpha/defconfig Mon Dec 22 21:40:43 1997 @@ -80,5 +80,6 @@ # CONFIG_ALPHA_P2K is not set CONFIG_PCI=y +CONFIG_PCI_OLD_PROC=y CONFIG_ALPHA_EV5=y CONFIG_ALPHA_CIA=y CONFIG_ALPHA_SRM=y --- /usr/src/linux-2.1/arch/i386/config.in Mon Dec 22 10:36:20 1997 +++ arch/i386/config.in Fri Dec 26 22:54:29 1997 @@ -39,6 +39,7 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then bool ' PCI bridge optimization (experimental)' CONFIG_PCI_OPTIMIZE fi + bool ' Backward-compatible /proc/pci' CONFIG_PCI_OLD_PROC fi bool 'MCA support' CONFIG_MCA bool 'System V IPC' CONFIG_SYSVIPC --- /usr/src/linux-2.1/arch/i386/defconfig Mon Dec 22 10:36:21 1997 +++ arch/i386/defconfig Mon Dec 22 21:41:01 1997 @@ -30,5 +29,7 @@ CONFIG_PCI=y CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y +# CONFIG_PCI_OPTIMIZE is not set +CONFIG_PCI_OLD_PROC=y # CONFIG_MCA is not set CONFIG_SYSVIPC=y --- /usr/src/linux-2.1/fs/proc/array.c Sat Dec 13 21:18:26 1997 +++ fs/proc/array.c Mon Dec 22 21:47:50 1997 @@ -1083,7 +1088,7 @@ extern int get_irq_list(char *); extern int get_dma_list(char *); extern int get_cpuinfo(char *); -extern int get_pci_list(char*); +extern int get_pci_list(char *); extern int get_md_status (char *); extern int get_rtc_status (char *); extern int get_locks_status (char *, char **, off_t, int); @@ -1111,7 +1116,7 @@ case PROC_MEMINFO: return get_meminfo(page); -#ifdef CONFIG_PCI +#ifdef CONFIG_PCI_OLD_PROC case PROC_PCI: return get_pci_list(page); #endif --- /usr/src/linux-2.1/fs/proc/root.c Thu Dec 4 15:16:10 1997 +++ fs/proc/root.c Mon Dec 22 21:47:52 1997 @@ -149,7 +149,7 @@ &proc_root, NULL }; -struct proc_dir_entry *proc_net, *proc_scsi; +struct proc_dir_entry *proc_net, *proc_scsi, *proc_bus; #ifdef CONFIG_MCA struct proc_dir_entry proc_mca = { @@ -578,7 +584,6 @@ NULL, NULL, /* get_info, fill_inode */ NULL, /* next */ NULL, NULL /* parent, subdir */ - }; #endif @@ -657,6 +665,11 @@ #endif #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); +#endif + + proc_bus = create_proc_entry("bus", S_IFDIR, 0); +#ifdef CONFIG_PCI + proc_bus_pci_init(); #endif } --- /usr/src/linux-2.1/include/linux/pci.h Thu Dec 25 22:45:03 1997 +++ include/linux/pci.h Sat Dec 27 14:56:47 1997 @@ -1,48 +1,27 @@ /* - * PCI defines and function prototypes - * Copyright 1994, Drew Eckhardt + * $Id: pci.h,v 1.51 1997/12/27 13:55:23 mj Exp $ * - * For more information, please consult - * - * PCI BIOS Specification Revision - * PCI Local Bus Specification - * PCI System Design Guide + * PCI defines and function prototypes + * Copyright 1994, Drew Eckhardt + * Copyright 1997, Martin Mares <mj@atrey.karlin.mff.cuni.cz> * - * PCI Special Interest Group - * M/S HF3-15A - * 5200 N.E. Elam Young Parkway - * Hillsboro, Oregon 97124-6497 - * +1 (503) 696-2000 - * +1 (800) 433-5177 + * For more information, please consult * - * Manuals are $25 each or $50 for all three, plus $7 shipping - * within the United States, $35 abroad. - */ - - - -/* PROCEDURE TO REPORT NEW PCI DEVICES - * We are trying to collect information on new PCI devices, using - * the standard PCI identification procedure. If some warning is - * displayed at boot time, please report - * - /proc/pci - * - your exact hardware description. Try to find out - * which device is unknown. It may be you mainboard chipset. - * PCI-CPU bridge or PCI-ISA bridge. - * - If you can't find the actual information in your hardware - * booklet, try to read the references of the chip on the board. - * - Send all that to linux-pcisupport@cck.uni-kl.de - * and I'll add your device to the list as soon as possible - * - * BEFORE you send a mail, please check the latest linux releases - * to be sure it has not been recently added. + * PCI BIOS Specification Revision + * PCI Local Bus Specification + * PCI System Design Guide * - * Thanks - * Jens Maurer + * PCI Special Interest Group + * M/S HF3-15A + * 5200 N.E. Elam Young Parkway + * Hillsboro, Oregon 97124-6497 + * +1 (503) 696-2000 + * +1 (800) 433-5177 + * + * Manuals are $25 each or $50 for all three, plus $7 shipping + * within the United States, $35 abroad. */ - - #ifndef LINUX_PCI_H #define LINUX_PCI_H @@ -102,7 +81,7 @@ */ #define PCI_BASE_ADDRESS_0 0x10 /* 32 bits */ #define PCI_BASE_ADDRESS_1 0x14 /* 32 bits */ -#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits */ +#define PCI_BASE_ADDRESS_2 0x18 /* 32 bits [htype 0 only] */ #define PCI_BASE_ADDRESS_3 0x1c /* 32 bits */ #define PCI_BASE_ADDRESS_4 0x20 /* 32 bits */ #define PCI_BASE_ADDRESS_5 0x24 /* 32 bits */ @@ -118,6 +97,7 @@ #define PCI_BASE_ADDRESS_IO_MASK (~0x03) /* bit 1 is reserved if address_space = 1 */ +/* Header type 0 (normal devices) */ #define PCI_CARDBUS_CIS 0x28 #define PCI_SUBSYSTEM_ID 0x2c #define PCI_SUBSYSTEM_VENDOR_ID 0x2e @@ -131,6 +111,46 @@ #define PCI_MIN_GNT 0x3e /* 8 bits */ #define PCI_MAX_LAT 0x3f /* 8 bits */ +/* Header type 1 (PCI-to-PCI bridges) */ +#define PCI_PRIMARY_BUS 0x18 /* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19 /* Secondary bus number */ +#define PCI_SUBORDINATE_BUS 0x1a /* Highest bus number behind the bridge */ +#define PCI_SEC_LATENCY_TIMER 0x1b /* Latency timer for secondary interface */ +#define PCI_IO_BASE 0x1c /* I/O range behind the bridge */ +#define PCI_IO_LIMIT 0x1d +#define PCI_IO_RANGE_TYPE_MASK 0x0f /* I/O bridging type */ +#define PCI_IO_RANGE_TYPE_16 0x00 +#define PCI_IO_RANGE_TYPE_32 0x01 +#define PCI_IO_RANGE_MASK ~0x0f +#define PCI_SEC_STATUS 0x1e /* Secondary status register, only bit 14 used */ +#define PCI_MEMORY_BASE 0x20 /* Memory range behind */ +#define PCI_MEMORY_LIMIT 0x22 +#define PCI_MEMORY_RANGE_TYPE_MASK 0x0f +#define PCI_MEMORY_RANGE_MASK ~0x0f +#define PCI_PREF_MEMORY_BASE 0x24 /* Prefetchable memory range behind */ +#define PCI_PREF_MEMORY_LIMIT 0x26 +#define PCI_PREF_RANGE_TYPE_MASK 0x0f +#define PCI_PREF_RANGE_TYPE_32 0x00 +#define PCI_PREF_RANGE_TYPE_64 0x01 +#define PCI_PREF_RANGE_MASK ~0x0f +#define PCI_PREF_BASE_UPPER32 0x28 /* Upper half of prefetchable memory range */ +#define PCI_PREF_LIMIT_UPPER32 0x2c +#define PCI_IO_BASE_UPPER16 0x30 /* Upper half of I/O addresses */ +#define PCI_IO_LIMIT_UPPER16 0x32 +/* 0x34-0x3b is reserved */ +#define PCI_ROM_ADDRESS1 0x38 /* Same as PCI_ROM_ADDRESS, but for htype 1 */ +/* 0x3c-0x3d are same as for htype 0 */ +#define PCI_BRIDGE_CONTROL 0x3e +#define PCI_BRIDGE_CTL_PARITY 0x01 /* Enable parity detection on secondary interface */ +#define PCI_BRIDGE_CTL_SERR 0x02 /* The same for SERR forwarding */ +#define PCI_BRIDGE_CTL_NO_ISA 0x04 /* Disable bridging of ISA ports */ +#define PCI_BRIDGE_CTL_VGA 0x08 /* Forward VGA addresses */ +#define PCI_BRIDGE_CTL_MASTER_ABORT 0x20 /* Report master aborts */ +#define PCI_BRIDGE_CTL_BUS_RESET 0x40 /* Secondary bus reset */ +#define PCI_BRIDGE_CTL_FAST_BACK 0x80 /* Fast Back2Back enabled on secondary interface */ + +/* Device classes and subclasses */ + #define PCI_CLASS_NOT_DEFINED 0x0000 #define PCI_CLASS_NOT_DEFINED_VGA 0x0001 @@ -175,7 +195,6 @@ #define PCI_CLASS_BRIDGE_CARDBUS 0x0607 #define PCI_CLASS_BRIDGE_OTHER 0x0680 - #define PCI_BASE_CLASS_COMMUNICATION 0x07 #define PCI_CLASS_COMMUNICATION_SERIAL 0x0700 #define PCI_CLASS_COMMUNICATION_PARALLEL 0x0701 @@ -804,8 +823,8 @@ #define PCI_DEVICE_ID_INTEL_82865 0x1227 #define PCI_DEVICE_ID_INTEL_82557 0x1229 #define PCI_DEVICE_ID_INTEL_82437 0x122d -#define PCI_DEVICE_ID_INTEL_82371FB_0 0x122e -#define PCI_DEVICE_ID_INTEL_82371FB_1 0x1230 +#define PCI_DEVICE_ID_INTEL_82371_0 0x122e +#define PCI_DEVICE_ID_INTEL_82371_1 0x1230 #define PCI_DEVICE_ID_INTEL_82371MX 0x1234 #define PCI_DEVICE_ID_INTEL_82437MX 0x1235 #define PCI_DEVICE_ID_INTEL_82441 0x1237 @@ -856,7 +875,6 @@ #define PCI_DEVICE_ID_ARK_STINGARK 0xa099 #define PCI_DEVICE_ID_ARK_2000MT 0xa0a1 -#ifdef __KERNEL__ /* * The PCI interface treats multi-function devices as independent * devices. The slot/function address of each device is encoded @@ -869,6 +887,7 @@ #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f) #define PCI_FUNC(devfn) ((devfn) & 0x07) +#ifdef __KERNEL__ /* * There is one pci_dev structure for each slot-number/function-number * combination: @@ -920,34 +939,16 @@ unsigned char subordinate; /* max number of subordinate buses */ }; -/* - * This is used to map a vendor-id/device-id pair into device-specific - * information. - */ -struct pci_dev_info { - unsigned short vendor; /* vendor id */ - unsigned short device; /* device id */ - - const char *name; /* device name */ - unsigned char bridge_type; /* bridge type or 0xff */ -}; - extern struct pci_bus pci_root; /* root bus */ extern struct pci_dev *pci_devices; /* list of all devices */ - extern unsigned long pci_init (unsigned long mem_start, unsigned long mem_end); -extern unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp); - -extern struct pci_dev_info *pci_lookup_dev (unsigned int vendor, - unsigned int dev); -extern const char *pci_strclass (unsigned int class); -extern const char *pci_strvendor (unsigned int vendor); -extern const char *pci_strdev (unsigned int vendor, unsigned int device); +extern unsigned int pci_scan_bus (struct pci_bus *bus, unsigned long *mem_startp); extern int get_pci_list (char *buf); extern void pci_quirks_init (void); + #endif /* __KERNEL__ */ #endif /* LINUX_PCI_H */ --- /usr/src/linux-2.1/include/linux/proc_fs.h Sat Dec 20 22:36:24 1997 +++ include/linux/proc_fs.h Fri Dec 26 23:30:41 1997 @@ -198,6 +200,12 @@ PROC_MCA_LAST = (PROC_MCA_SLOT + 8) }; +enum bus_directory_inos { + PROC_BUS_PCI = PROC_MCA_LAST, + PROC_BUS_PCI_DEVICES, + PROC_BUS_LAST +}; + /* Finally, the dynamically allocatable proc entries are reserved: */ #define PROC_DYNAMIC_FIRST 4096 @@ -263,12 +266,13 @@ extern struct proc_dir_entry proc_pid; extern struct proc_dir_entry proc_pid_fd; extern struct proc_dir_entry proc_mca; +extern struct proc_dir_entry *proc_bus; extern struct inode_operations proc_scsi_inode_operations; extern void proc_root_init(void); extern void proc_base_init(void); -extern void proc_net_init(void); +extern void proc_bus_pci_init(void); extern int proc_register(struct proc_dir_entry *, struct proc_dir_entry *); extern int proc_unregister(struct proc_dir_entry *, int); --- /usr/src/linux-2.1/kernel/ksyms.c Thu Dec 25 22:45:03 1997 +++ kernel/ksyms.c Sat Dec 27 01:15:33 1997 @@ -99,7 +99,6 @@ EXPORT_SYMBOL(get_options); #ifdef CONFIG_PCI -/* PCI BIOS support */ EXPORT_SYMBOL(pcibios_present); EXPORT_SYMBOL(pcibios_find_class); EXPORT_SYMBOL(pcibios_find_device); @@ -110,8 +109,6 @@ EXPORT_SYMBOL(pcibios_write_config_word); EXPORT_SYMBOL(pcibios_write_config_dword); EXPORT_SYMBOL(pcibios_strerror); -EXPORT_SYMBOL(pci_strvendor); -EXPORT_SYMBOL(pci_strdev); #endif /* process memory management */ --- /usr/src/linux-2.1/drivers/block/ide-proc.c Sun Dec 28 13:08:21 1997 +++ drivers/block/ide-proc.c Sun Dec 28 13:09:37 1997 @@ -196,11 +196,8 @@ { ide_hwif_t *hwif = (ide_hwif_t *) data; int len; - const char *vids, *dids; - vids = pci_strvendor(hwif->pci_devid.vid); - dids = pci_strdev(hwif->pci_devid.vid, hwif->pci_devid.did); - len = sprintf(page,"%s: %s\n", vids ? vids : "(none)", dids ? dids : "(none)"); + len = sprintf(page,"%04x: %04x\n", hwif->pci_devid.vid, hwif->pci_devid.did); PROC_IDE_READ_RETURN(page,start,off,count,eof,len); } #endif /* CONFIG_PCI */