/proc/pcibus patch, deleting PCI id tables.

Stephen Williams (steve@icarus.icarus.com)
Sun, 14 Sep 1997 22:50:05 +0800


This version of my /proc/pcibus patch takes the extra step and removes
the /proc/pci support. This was the original goal. The replacement for
the text dump of type names lives in

ftp://ftp.picturel.com/pub/source/pcistat.tar.gz

which contains a program to print the contents of /proc/pcibus is
human-readable form.

This program is a short term deal that uses a header file pulled of
a web PCI device id list. I would like to hear from the person(s) who
maintained the pci.c table of pci device ids and try to arrange for a
new data file with the same list, along with programs that can manipulate
that list.

NOTE that I left enough of a table internally to support the bridge
optimization code, although it is compiled out if the bridge optimization
is not configured in.

-- 
Steve Williams
steve@icarus.com
steve@picturel.com

"The woods are lovely, dark and deep. But I have promises to keep, And lines to code before I sleep, And lines to code before I sleep."

diff -Ncr -X ../exclude ./Documentation/Configure.help /usr/src/linux-2.1.55/Documentation/Configure.help *** ./Documentation/Configure.help Sat Sep 6 10:43:49 1997 --- /usr/src/linux-2.1.55/Documentation/Configure.help Sat Sep 13 11:02:38 1997 *************** *** 4243,4249 **** trouble if two devices are mistakenly configured to use the same IRQ). Several programs depend on this, so everyone should say Y here. ! NFS filesystem support CONFIG_NFS_FS If you are connected to some other (usually local) Unix computer --- 4243,4256 ---- trouble if two devices are mistakenly configured to use the same IRQ). Several programs depend on this, so everyone should say Y here. ! ! /proc/pcibus support ! CONFIG_PROC_PCIBUS ! This adds support for the pcibus directory under /proc. It allows ! the query of the configuration space of all the pci devices on the ! local computer. ! ! NFS filesystem support CONFIG_NFS_FS If you are connected to some other (usually local) Unix computer diff -Ncr -X ../exclude ./Documentation/pcibus.txt /usr/src/linux-2.1.55/Documentation/pcibus.txt *** ./Documentation/pcibus.txt Wed Dec 31 16:00:00 1969 --- /usr/src/linux-2.1.55/Documentation/pcibus.txt Sat Sep 13 16:36:48 1997 *************** *** 0 **** --- 1,21 ---- + + The /proc/pcibus directory provides support for access to the + configuration space of installed PCI devices. The directory contains a + file for every discovered function unit in the system. The file name + is a hex represent of the 16 bits arranged as follows: + + 15 - 8 7 - 3 2 - 0 + +------------+-----+-----+ + | BUS Number | dev | fn# | + +------------+-----+-----+ + + The numbers (except for the fn#) are assigned to the slot in a + mother-board specific way. The fn# allows for a device to have up to 8 + distinct functional units. + + Each file contains exactly 256 bytes. This is the official size of the + PCI configuration space for a device/function. Reading the bytes gets + the contents of the cnfiguration space directly from the + hardware. (Writing is currently not supported.) The layout of the + configuration space is defined by the ``PCI Local Bus Specification.'' + diff -Ncr -X ../exclude ./Makefile /usr/src/linux-2.1.55/Makefile *** ./Makefile Mon Sep 8 21:57:58 1997 --- /usr/src/linux-2.1.55/Makefile Thu Sep 11 16:56:47 1997 *************** *** 11,17 **** # # NOTE! SMP is experimental. See the file Documentation/SMP.txt # ! SMP = 1 # # SMP profiling options # SMP_PROF = 1 --- 11,17 ---- # # NOTE! SMP is experimental. See the file Documentation/SMP.txt # ! # SMP = 1 # # SMP profiling options # SMP_PROF = 1 diff -Ncr -X ../exclude ./drivers/pci/pci.c /usr/src/linux-2.1.55/drivers/pci/p ci.c *** ./drivers/pci/pci.c Sat Sep 6 10:43:50 1997 --- /usr/src/linux-2.1.55/drivers/pci/pci.c Sun Sep 14 12:27:59 1997 *************** *** 5,10 **** --- 5,13 ---- * * Copyright 1993, 1994, 1995 Drew Eckhardt, Frederic Potter, * David Mosberger-Tang + * + * Modified 1997 by Stephen Williams to put many things in init + * sections and get rid of some things made obsolete by /proc/pcibus. */ #include <linux/config.h> #include <linux/ptrace.h> *************** *** 20,25 **** --- 23,29 ---- struct pci_bus pci_root; struct pci_dev *pci_devices = 0; + #ifdef CONFIG_PCI_OPTIMIZE /* * The bridge_id field is an offset of an item into the array * BRIDGE_MAPPING_TYPE. 0xff indicates that the device is not a PCI *************** *** 36,373 **** {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name), (bridge)} /* * 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_NETELL100,"Netelligent 10/100"), ! DEVICE( COMPAQ, COMPAQ_NETELL10,"Netelligent 10"), ! DEVICE( COMPAQ, COMPAQ_NETFLEX3,"NetFlex 3"), ! DEVICE( COMPAQ, COMPAQ_THUNDER, "ThunderLAN"), ! 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( ATI, ATI_68800, "68800AX"), ! DEVICE( ATI, ATI_215CT222, "215CT222"), ! DEVICE( ATI, ATI_210888CX, "210888CX"), ! DEVICE( ATI, ATI_215GT, "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_VAS96011, "VAS96011 PowerPC"), ! 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"), BRIDGE( DEC, DEC_BRD, "DC21050", 0x00), - 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_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"), - 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( 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_7001, "7001"), - DEVICE( HP, HP_J2585A, "J2585A"), - DEVICE( HP, HP_J2585B, "J2585B"), - 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_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_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_5300, "DC5030"), - DEVICE( APPLE, APPLE_BANDIT, "Bandit"), - DEVICE( APPLE, APPLE_GC, "Grand Central"), - DEVICE( APPLE, APPLE_HYDRA, "Hydra"), - DEVICE( N9, N9_I128, "Imagine 128"), - DEVICE( N9, N9_I128_2, "Imagine 128v2"), - DEVICE( UMC, UMC_UM8673F, "UM8673F"), BRIDGE( UMC, UMC_UM8891A, "UM8891A", 0x01), - DEVICE( UMC, UMC_UM8886BF, "UM8886BF"), - DEVICE( UMC, UMC_UM8886A, "UM8886A"), BRIDGE( UMC, UMC_UM8881F, "UM8881F", 0x02), - 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( NEXGEN, NEXGEN_82C501, "82C501"), - DEVICE( QLOGIC, QLOGIC_ISP1020, "ISP1020"), - DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"), - 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"), BRIDGE( SUN, SUN_PBM, "PCI Bus Module", 0x02), - 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, BT848, "Brooktree 848"), - 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( 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_M4803, "M4803"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2070, "Magicgraph NM2070"), - DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128V, "MagicGraph 128V"), - 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"), - 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 VP-1"), - DEVICE( VIA, VIA_82C576, "VT 82C576 3V"), - DEVICE( VIA, VIA_82C585, "VT 82C585VP Apollo VP-1"), - DEVICE( VIA, VIA_82C586, "VT 82C586 Apollo VP-1"), - DEVICE( VIA, VIA_82C416, "VT 82C416MV"), - DEVICE( VIA, VIA_82C926, "VT 82C926 Amazon"), - 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( 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( 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( 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( NP, NP_PCI_FDDI, "NP-PCI"), - DEVICE( SPECIALIX, SPECIALIX_XIO, "XIO/SIO host"), - DEVICE( SPECIALIX, SPECIALIX_RIO, "RIO host"), - 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_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( 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( 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( 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"), - DEVICE( S3, S3_PLATO_PXG, "Plato"), - DEVICE( S3, S3_ViRGE_DXGX, "ViRGE/DX"), - DEVICE( INTEL, INTEL_82375, "82375EB"), BRIDGE( INTEL, INTEL_82424, "82424ZX Saturn", 0x00), - DEVICE( INTEL, INTEL_82378, "82378IB"), - DEVICE( INTEL, INTEL_82430, "82430ZX Aries"), BRIDGE( INTEL, INTEL_82434, "82434LX Mercury/Neptune", 0x00), - 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"), - DEVICE( INTEL, INTEL_82371AB, "82371AB 430TX PIIX4"), - DEVICE( INTEL, INTEL_82371AB_2,"82371AB PIIX4"), - DEVICE( INTEL, INTEL_82371AB_3,"82371AB PIIX4 Power Management"), - DEVICE( INTEL, INTEL_P6, "Orion P6"), - DEVICE( INTEL, INTEL_P6_2, "82450GX Orion P6"), - DEVICE( KTI, KTI_ET32P2, "ET32P2"), - DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"), - DEVICE( ADAPTEC, ADAPTEC_7855, "AIC-7855"), - 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_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") }; - #ifdef CONFIG_PCI_OPTIMIZE /* * An item of this structure has the following meaning: --- 40,71 ---- {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name), (bridge)} /* + * 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 */ + }; + + /* * 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. */ ! static struct pci_dev_info dev_info[] __initdata = { BRIDGE( DEC, DEC_BRD, "DC21050", 0x00), BRIDGE( UMC, UMC_UM8891A, "UM8891A", 0x01), BRIDGE( UMC, UMC_UM8881F, "UM8881F", 0x02), BRIDGE( SUN, SUN_PBM, "PCI Bus Module", 0x02), BRIDGE( INTEL, INTEL_82424, "82424ZX Saturn", 0x00), BRIDGE( INTEL, INTEL_82434, "82434LX Mercury/Neptune", 0x00), }; /* * An item of this structure has the following meaning: *************** *** 388,394 **** const char *type; const char *off; const char *on; ! } bridge_optimization[] = { {"Cache L2", "write through", "write back"}, {"CPU-PCI posted write", "off", "on"}, {"CPU-Memory posted write", "off", "on"}, --- 86,92 ---- const char *type; const char *off; const char *on; ! } bridge_optimization[] __initdata = { {"Cache L2", "write through", "write back"}, {"CPU-PCI posted write", "off", "on"}, {"CPU-Memory posted write", "off", "on"}, *************** *** 403,409 **** unsigned char addr; /* config space address */ unsigned char mask; unsigned char value; ! } bridge_mapping[] = { /* * Intel Neptune/Mercury/Saturn: * If the internal cache is write back, --- 101,107 ---- unsigned char addr; /* config space address */ unsigned char mask; unsigned char value; ! } bridge_mapping[] __initdata = { /* * Intel Neptune/Mercury/Saturn: * If the internal cache is write back, *************** *** 441,451 **** #endif /* CONFIG_PCI_OPTIMIZE */ ! /* ! * device_info[] is sorted so we can use binary search */ ! 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; --- 139,149 ---- #endif /* CONFIG_PCI_OPTIMIZE */ ! #ifdef CONFIG_PCI_OPTIMIZE /* ! * device_info[] is sorted so we can use binary search. */ ! __initfunc(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; *************** *** 478,483 **** --- 176,182 ---- return & dev_info[ i ]; } } + #endif const char *pci_strclass (unsigned int class) { *************** *** 556,677 **** } - 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 "Advance 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_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_APPLE: return "Apple"; - 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_NEXGEN: return "Nexgen"; - case PCI_VENDOR_ID_QLOGIC: return "Q Logic"; - 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_NEOMAGIC: return "Neomagic"; - case PCI_VENDOR_ID_ASP: return "Advanced System Products"; - case PCI_VENDOR_ID_CERN: return "CERN"; - 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_NP: return "Network Peripherals"; - case PCI_VENDOR_ID_SPECIALIX: return "Specialix"; - 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_SIGMADES: return "Sigma Designs"; - case PCI_VENDOR_ID_OPTIBASE: return "Optibase"; - 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_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) - { - struct pci_dev_info *info; - - info = pci_lookup_dev(vendor, device); - return info ? info->name : "Unknown device"; - } - const char *pcibios_strerror(int error) { --- 255,260 ---- *************** *** 704,716 **** } /* * Turn on/off PCI bridge optimization. This should allow benchmarking. */ __initfunc(static void burst_bridge(unsigned char bus, unsigned char devfn, unsigned char pos, int turn_on)) { - #ifdef CONFIG_PCI_OPTIMIZE struct bridge_mapping_type *bmap; unsigned char val; int i; --- 287,299 ---- } + #ifdef CONFIG_PCI_OPTIMIZE /* * Turn on/off PCI bridge optimization. This should allow benchmarking. */ __initfunc(static void burst_bridge(unsigned char bus, unsigned char devfn, unsigned char pos, int turn_on)) { struct bridge_mapping_type *bmap; unsigned char val; int i; *************** *** 746,762 **** } printk("\n"); } - #endif /* CONFIG_PCI_OPTIMIZE */ } /* * 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; --- 329,346 ---- } printk("\n"); } } + #endif /* CONFIG_PCI_OPTIMIZE */ + #ifdef DEBUG /* * 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. */ ! __initfunc(static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)) { unsigned long base; unsigned int l, class_rev, bus, devfn; *************** *** 785,799 **** 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) { --- 369,377 ---- if (len + 80 > size) { return -1; } ! len += sprintf(buf + len, " %s: Vendor id=%04x Device id=%04x" ! " (rev %d).\n ", pci_strclass(class_rev >> 8), ! vendor, device, class_rev & 0xff); str = 0; /* to keep gcc shut... */ switch (status & PCI_STATUS_DEVSEL_MASK) { *************** *** 899,915 **** /* ! * 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) { --- 477,494 ---- /* ! * Return list of PCI devices as a character string. This is only used ! * if DEBUG is defined, and is only called by the pci_init function to ! * dump the PCI configuration into the console log. */ ! __initfunc(static 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 - sizeof(MSG); len = sprintf(buf, "PCI devices found:\n"); for (dev = pci_devices; dev; dev = dev->next) { *************** *** 921,927 **** } return len; } ! /* * pci_malloc() returns initialized memory of size SIZE. Can be --- 500,506 ---- } return len; } ! #endif /* * pci_malloc() returns initialized memory of size SIZE. Can be *************** *** 941,951 **** } ! unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp) { unsigned int devfn, l, max; unsigned char cmd, tmp, irq, hdr_type = 0; - struct pci_dev_info *info; struct pci_dev *dev; struct pci_bus *child; int reg; --- 520,529 ---- } ! __initfunc(unsigned int pci_scan_bus(struct pci_bus *bus, unsigned long *mem_startp)) { unsigned int devfn, l, max; unsigned char cmd, tmp, irq, hdr_type = 0; struct pci_dev *dev; struct pci_bus *child; int reg; *************** *** 987,1008 **** 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); ! } else { /* Some BIOS' are lazy. Let's do their job: */ ! if (info->bridge_type != 0xff) { ! burst_bridge(bus->number, devfn, ! info->bridge_type, 1); ! } } /* non-destructively determine if device can be a master: */ pcibios_read_config_byte(bus->number, devfn, PCI_COMMAND, --- 565,585 ---- dev->vendor = l & 0xffff; dev->device = (l >> 16) & 0xffff; + #ifdef CONFIG_PCI_OPTIMIZE /* ! * Perhaps this is a device that I can jiggle to make ! * it go better? */ ! { ! struct pci_dev_info*info; ! info = pci_lookup_dev(dev->vendor, dev->device); /* Some BIOS' are lazy. Let's do their job: */ ! if (info && info->bridge_type != 0xff) ! burst_bridge(bus->number, devfn, ! info->bridge_type, 1); } + #endif + /* non-destructively determine if device can be a master: */ pcibios_read_config_byte(bus->number, devfn, PCI_COMMAND, diff -Ncr -X ../exclude ./fs/Config.in /usr/src/linux-2.1.55/fs/Config.in *** ./fs/Config.in Sat Aug 16 09:53:08 1997 --- /usr/src/linux-2.1.55/fs/Config.in Sat Sep 13 11:02:16 1997 *************** *** 16,21 **** --- 16,25 ---- dep_tristate 'umsdos: Unix like fs on top of std MSDOS FAT fs' CONFIG_UMSDOS_FS $CONFIG_MSDOS_FS bool '/proc filesystem support' CONFIG_PROC_FS + if [ "$CONFIG_PROC_FS" = "y" -a "$CONFIG_PCI" = "y" ]; then + bool '/proc/pcibus support' CONFIG_PROC_PCIBUS + fi + if [ "$CONFIG_INET" = "y" ]; then tristate 'NFS filesystem support' CONFIG_NFS_FS if [ "$CONFIG_NFS_FS" = "y" ]; then diff -Ncr -X ../exclude ./fs/proc/Makefile /usr/src/linux-2.1.55/fs/proc/Makefi le *** ./fs/proc/Makefile Sat Aug 16 09:53:08 1997 --- /usr/src/linux-2.1.55/fs/proc/Makefile Sat Sep 13 10:49:03 1997 *************** *** 28,31 **** --- 28,35 ---- O_OBJS += proc_devtree.o endif + ifeq ($(CONFIG_PROC_PCIBUS),y) + O_OBJS += pcibus.o + endif + include $(TOPDIR)/Rules.make diff -Ncr -X ../exclude ./fs/proc/array.c /usr/src/linux-2.1.55/fs/proc/array.c *** ./fs/proc/array.c Wed Aug 20 13:59:36 1997 --- /usr/src/linux-2.1.55/fs/proc/array.c Sat Sep 13 23:16:37 1997 *************** *** 1046,1056 **** case PROC_MEMINFO: return get_meminfo(page); - #ifdef CONFIG_PCI - case PROC_PCI: - return get_pci_list(page); - #endif - case PROC_CPUINFO: return get_cpuinfo(page); --- 1046,1051 ---- diff -Ncr -X ../exclude ./fs/proc/pcibus.c /usr/src/linux-2.1.55/fs/proc/pcibus .c *** ./fs/proc/pcibus.c Wed Dec 31 16:00:00 1969 --- /usr/src/linux-2.1.55/fs/proc/pcibus.c Sat Sep 13 19:07:12 1997 *************** *** 0 **** --- 1,152 ---- + /* + * Copyright (c) 1997 Stephen Williams (steve@icarus.com) + * + * This source code is free software; you can redistribute it + * and/or modify it in source code form under the terms of the GNU + * General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) + * any later version. In order to redistribute the software in + * binary form, you will need a Picture Elements Binary Software + * License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + /* + * The /proc/pcibus directory contains files for all the known PCI + * devices. The contents of each file is the configuration space of + * the device and can only be read. + */ + + # include <linux/proc_fs.h> + # include <linux/bios32.h> + # include <linux/pci.h> + # include <linux/malloc.h> + # include <linux/init.h> + # include <asm/uaccess.h> + + /* + * Do the actual read of PCI configuration space. Access only DWORD + * values because there are PCI BIOSs out there that cannot properly + * do otherwise. Anyhow, there is no real point of doing less on a + * 32bit wide bus. + * + * The device to manipulate is passed as the data pointer, which was + * in turn set up by the init function when it created the file inode. + */ + static int pcibus_read(char*page, char **start, off_t off, + int cnt, int *eof, void *data) + { + struct pci_dev*dev = (struct pci_dev*)data; + unsigned tpos = off; + unsigned long tcnt; + unsigned *valp; + + if (tpos >= 256) { *eof = 1; return 0; } + if ((tpos + cnt) >= 256) { *eof = 1; cnt = 256 - tpos; } + + tcnt = cnt; + if (tpos & 3) { + tcnt += tpos & 3; + tpos &= ~3; + } + + tcnt = (tcnt + 3) & ~3; + + valp = (unsigned*)(page + tpos); + while (tcnt) { + int rc = pcibios_read_config_dword(dev->bus->number, + dev->devfn, tpos, + valp); + if (rc != PCIBIOS_SUCCESSFUL) { + printk("/proc/pcibus: Error %d reading config space.\n", rc); + return -EIO; + } + tcnt -= 4; + valp += 1; + tpos += 4; + } + + *start = page + off; + return cnt; + } + + static struct proc_dir_entry proc_root_pcibus = { + 0, /* Get the inode number dynamically */ + 6, "pcibus", + S_IFDIR | S_IRUGO | S_IXUGO, + 2, + 0, 0, + 0, + &proc_dir_inode_operations, + 0, 0, + 0, 0, 0, + 0, + NULL, NULL }; + + static const struct proc_dir_entry proc_root_dev_sample __initdata = { + 0, /* Get the inode number dynamically */ + 4, 0, /* All fine names are 4 characters, filled in later. */ + S_IFREG | S_IRUGO, + 1, + 0, 0, + 256, + NULL, + 0, 0, + 0, 0, 0, + 0, + pcibus_read, NULL }; + + + __initfunc(void proc_pcibus_init(void)) + { + struct proc_dir_entry*dev_table = 0; + struct pci_dev*dev; + struct proc_dir_entry*curp; + char*strp; + unsigned dev_count; + + if (!pcibios_present()) return; + + proc_register(&proc_root, &proc_root_pcibus); + + /* Count the PCI devices. I need the count to size the various + tables following. */ + dev_count = 0; + for (dev = pci_devices ; dev ; dev = dev->next) + dev_count += 1; + + if (dev_count == 0) return; + + /* This hack of allocating a single chunk of memory to hold + all my stuff is an attempt to reduce the malloc + overhead. Anyhow, it does the job with little fuss. */ + dev_table = kmalloc(dev_count * sizeof(struct proc_dir_entry) + + 5 * dev_count, GFP_KERNEL); + if (! dev_table) { + printk("/proc/pcibios: Not enough memory.\n"); + return; + } + + curp = dev_table; + strp = (char*)(dev_table + dev_count); + + for (dev = pci_devices ; dev ; dev = dev->next) { + *curp = proc_root_dev_sample; + curp->name = strp; + curp->data = dev; + sprintf(strp, "%02x%02x", dev->bus->number, dev->devfn); + + proc_register(&proc_root_pcibus, curp); + + curp += 1; + strp += 5; + } + } diff -Ncr -X ../exclude ./fs/proc/root.c /usr/src/linux-2.1.55/fs/proc/root.c *** ./fs/proc/root.c Sun Sep 7 14:00:24 1997 --- /usr/src/linux-2.1.55/fs/proc/root.c Sat Sep 13 23:24:35 1997 *************** *** 284,289 **** --- 284,293 ---- extern void openpromfs_init (void); #endif /* CONFIG_SUN_OPENPROMFS */ + #ifdef CONFIG_PROC_PCIBUS + extern void proc_pcibus_init(void); + #endif + static int make_inode_number(void) { int i = find_first_zero_bit((void *) proc_alloc_map, PROC_NDYNAMIC); *************** *** 412,424 **** S_IFREG | S_IRUGO, 1, 0, 0, 0, &proc_array_inode_operations }; - #ifdef CONFIG_PCI - static struct proc_dir_entry proc_root_pci = { - PROC_PCI, 3, "pci", - S_IFREG | S_IRUGO, 1, 0, 0, - 0, &proc_array_inode_operations - }; - #endif #ifdef CONFIG_ZORRO static struct proc_dir_entry proc_root_zorro = { PROC_ZORRO, 5, "zorro", --- 416,421 ---- *************** *** 568,576 **** proc_register(&proc_root, &proc_root_meminfo); proc_register(&proc_root, &proc_root_kmsg); proc_register(&proc_root, &proc_root_version); - #ifdef CONFIG_PCI - proc_register(&proc_root, &proc_root_pci); - #endif #ifdef CONFIG_ZORRO proc_register(&proc_root, &proc_root_zorro); #endif --- 565,570 ---- *************** *** 635,640 **** --- 629,637 ---- #endif #ifdef CONFIG_PROC_DEVICETREE proc_device_tree_init(); + #endif + #ifdef CONFIG_PROC_PCIBUS + proc_pcibus_init(); #endif } diff -Ncr -X ../exclude ./include/linux/pci.h /usr/src/linux-2.1.55/include/lin ux/pci.h *** ./include/linux/pci.h Sat Sep 6 10:43:50 1997 --- /usr/src/linux-2.1.55/include/linux/pci.h Sun Sep 14 12:28:01 1997 *************** *** 806,823 **** 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 */ --- 806,811 ---- *************** *** 826,837 **** 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 int get_pci_list (char *buf); #endif /* PCI_H */ --- 814,819 ---- diff -Ncr -X ../exclude ./include/linux/proc_fs.h /usr/src/linux-2.1.55/include /linux/proc_fs.h *** ./include/linux/proc_fs.h Tue Sep 9 11:16:25 1997 --- /usr/src/linux-2.1.55/include/linux/proc_fs.h Sat Sep 13 23:16:05 1997 *************** *** 21,27 **** PROC_KMSG, PROC_VERSION, PROC_CPUINFO, - PROC_PCI, PROC_MCA, PROC_SELF, /* will change inode # */ PROC_NET, --- 21,26 ---- diff -Ncr -X ../exclude ./kernel/ksyms.c /usr/src/linux-2.1.55/kernel/ksyms.c *** ./kernel/ksyms.c Sat Sep 6 18:18:26 1997 --- /usr/src/linux-2.1.55/kernel/ksyms.c Sun Sep 14 12:50:05 1997 *************** *** 107,114 **** 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 */ --- 107,112 ----