|
|
1.1 root 1: /*
2: * drivers/pci/pci.c
3: *
4: * PCI services that are built on top of the BIOS32 service.
5: *
6: * Copyright 1993, 1994, 1995 Drew Eckhardt, Frederic Potter,
7: * David Mosberger-Tang
8: *
9: * Apr 12, 1998 : Fixed handling of alien header types. [mj]
10: */
11:
12: #include <linux/config.h>
13: #include <linux/ptrace.h>
14: #include <linux/types.h>
15: #include <linux/kernel.h>
16: #include <linux/bios32.h>
17: #include <linux/pci.h>
18: #include <linux/string.h>
19:
20: #include <asm/page.h>
21:
22: struct pci_bus pci_root;
23: struct pci_dev *pci_devices = 0;
24:
25:
26: /*
27: * The bridge_id field is an offset of an item into the array
28: * BRIDGE_MAPPING_TYPE. 0xff indicates that the device is not a PCI
29: * bridge, or that we don't know for the moment how to configure it.
30: * I'm trying to do my best so that the kernel stays small. Different
31: * chipset can have same optimization structure. i486 and pentium
32: * chipsets from the same manufacturer usually have the same
33: * structure.
34: */
35: #define DEVICE(vid,did,name) \
36: {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name), 0xff}
37:
38: #define BRIDGE(vid,did,name,bridge) \
39: {PCI_VENDOR_ID_##vid, PCI_DEVICE_ID_##did, (name), (bridge)}
40:
41: /*
42: * Sorted in ascending order by vendor and device.
43: * Use binary search for lookup. If you add a device make sure
44: * it is sequential by both vendor and device id.
45: */
46: struct pci_dev_info dev_info[] = {
47: DEVICE( COMPAQ, COMPAQ_1280, "QVision 1280/p"),
48: DEVICE( COMPAQ, COMPAQ_SMART2P, "Smart-2/P RAID Controller"),
49: DEVICE( COMPAQ, COMPAQ_NETEL100,"Netelligent 10/100"),
50: DEVICE( COMPAQ, COMPAQ_NETEL10, "Netelligent 10"),
51: DEVICE( COMPAQ, COMPAQ_NETFLEX3I,"NetFlex 3"),
52: DEVICE( COMPAQ, COMPAQ_NETEL100D,"Netelligent 10/100 Dual"),
53: DEVICE( COMPAQ, COMPAQ_NETEL100PI,"Netelligent 10/100 ProLiant"),
54: DEVICE( COMPAQ, COMPAQ_NETEL100I,"Netelligent 10/100 Integrated"),
55: DEVICE( COMPAQ, COMPAQ_THUNDER, "ThunderLAN"),
56: DEVICE( COMPAQ, COMPAQ_NETFLEX3B,"NetFlex 3 BNC"),
57: DEVICE( NCR, NCR_53C810, "53c810"),
58: DEVICE( NCR, NCR_53C820, "53c820"),
59: DEVICE( NCR, NCR_53C825, "53c825"),
60: DEVICE( NCR, NCR_53C815, "53c815"),
61: DEVICE( NCR, NCR_53C860, "53c860"),
62: DEVICE( NCR, NCR_53C896, "53c896"),
63: DEVICE( NCR, NCR_53C895, "53c895"),
64: DEVICE( NCR, NCR_53C885, "53c885"),
65: DEVICE( NCR, NCR_53C875, "53c875"),
66: DEVICE( NCR, NCR_53C875J, "53c875J"),
67: DEVICE( ATI, ATI_68800, "68800AX"),
68: DEVICE( ATI, ATI_215CT222, "215CT222"),
69: DEVICE( ATI, ATI_210888CX, "210888CX"),
70: DEVICE( ATI, ATI_215GB, "Mach64 GB"),
71: DEVICE( ATI, ATI_215GD, "Mach64 GD (Rage Pro)"),
72: DEVICE( ATI, ATI_215GI, "Mach64 GI (Rage Pro)"),
73: DEVICE( ATI, ATI_215GP, "Mach64 GP (Rage Pro)"),
74: DEVICE( ATI, ATI_215GQ, "Mach64 GQ (Rage Pro)"),
75: DEVICE( ATI, ATI_215GT, "Mach64 GT (Rage II)"),
76: DEVICE( ATI, ATI_215GTB, "Mach64 GT (Rage II)"),
77: DEVICE( ATI, ATI_210888GX, "210888GX"),
78: DEVICE( ATI, ATI_215LG, "Mach64 LG (3D Rage LT)"),
79: DEVICE( ATI, ATI_264LT, "Mach64 LT"),
80: DEVICE( ATI, ATI_264VT, "Mach64 VT"),
81: DEVICE( VLSI, VLSI_82C592, "82C592-FC1"),
82: DEVICE( VLSI, VLSI_82C593, "82C593-FC1"),
83: DEVICE( VLSI, VLSI_82C594, "82C594-AFC2"),
84: DEVICE( VLSI, VLSI_82C597, "82C597-AFC2"),
85: DEVICE( VLSI, VLSI_82C541, "82C541 Lynx"),
86: DEVICE( VLSI, VLSI_82C543, "82C543 Lynx ISA"),
87: DEVICE( VLSI, VLSI_82C532, "82C532"),
88: DEVICE( VLSI, VLSI_82C534, "82C534"),
89: DEVICE( VLSI, VLSI_82C535, "82C535"),
90: DEVICE( VLSI, VLSI_82C147, "82C147"),
91: DEVICE( VLSI, VLSI_VAS96011, "VAS96011 (Golden Gate II)"),
92: DEVICE( ADL, ADL_2301, "2301"),
93: DEVICE( NS, NS_87415, "87415"),
94: DEVICE( NS, NS_87410, "87410"),
95: DEVICE( TSENG, TSENG_W32P_2, "ET4000W32P"),
96: DEVICE( TSENG, TSENG_W32P_b, "ET4000W32P rev B"),
97: DEVICE( TSENG, TSENG_W32P_c, "ET4000W32P rev C"),
98: DEVICE( TSENG, TSENG_W32P_d, "ET4000W32P rev D"),
99: DEVICE( TSENG, TSENG_ET6000, "ET6000"),
100: DEVICE( WEITEK, WEITEK_P9000, "P9000"),
101: DEVICE( WEITEK, WEITEK_P9100, "P9100"),
102: BRIDGE( DEC, DEC_BRD, "DC21050", 0x00),
103: DEVICE( DEC, DEC_TULIP, "DC21040"),
104: DEVICE( DEC, DEC_TGA, "DC21030 (TGA)"),
105: DEVICE( DEC, DEC_TULIP_FAST, "DC21140"),
106: DEVICE( DEC, DEC_TGA2, "TGA2"),
107: DEVICE( DEC, DEC_FDDI, "DEFPA"),
108: DEVICE( DEC, DEC_TULIP_PLUS, "DC21041"),
109: DEVICE( DEC, DEC_21142, "DC21142"),
110: DEVICE( DEC, DEC_21052, "DC21052"),
111: DEVICE( DEC, DEC_21150, "DC21150"),
112: DEVICE( DEC, DEC_21152, "DC21152"),
113: DEVICE( CIRRUS, CIRRUS_7548, "GD 7548"),
114: DEVICE( CIRRUS, CIRRUS_5430, "GD 5430"),
115: DEVICE( CIRRUS, CIRRUS_5434_4, "GD 5434"),
116: DEVICE( CIRRUS, CIRRUS_5434_8, "GD 5434"),
117: DEVICE( CIRRUS, CIRRUS_5436, "GD 5436"),
118: DEVICE( CIRRUS, CIRRUS_5446, "GD 5446"),
119: DEVICE( CIRRUS, CIRRUS_5480, "GD 5480"),
120: DEVICE( CIRRUS, CIRRUS_5464, "GD 5464"),
121: DEVICE( CIRRUS, CIRRUS_5465, "GD 5465"),
122: DEVICE( CIRRUS, CIRRUS_6729, "CL 6729"),
123: DEVICE( CIRRUS, CIRRUS_6832, "PD 6832"),
124: DEVICE( CIRRUS, CIRRUS_7542, "CL 7542"),
125: DEVICE( CIRRUS, CIRRUS_7543, "CL 7543"),
126: DEVICE( CIRRUS, CIRRUS_7541, "CL 7541"),
127: DEVICE( IBM, IBM_FIRE_CORAL, "Fire Coral"),
128: DEVICE( IBM, IBM_TR, "Token Ring"),
129: DEVICE( IBM, IBM_82G2675, "82G2675"),
130: DEVICE( IBM, IBM_MCA, "MicroChannel"),
131: DEVICE( IBM, IBM_82351, "82351"),
132: DEVICE( IBM, IBM_SERVERAID, "ServeRAID"),
133: DEVICE( IBM, IBM_TR_WAKE, "Wake On LAN Token Ring"),
134: DEVICE( IBM, IBM_3780IDSP, "MWave DSP"),
135: DEVICE( WD, WD_7197, "WD 7197"),
136: DEVICE( AMD, AMD_LANCE, "79C970"),
137: DEVICE( AMD, AMD_SCSI, "53C974"),
138: DEVICE( TRIDENT, TRIDENT_9397, "Cyber9397"),
139: DEVICE( TRIDENT, TRIDENT_9420, "TG 9420"),
140: DEVICE( TRIDENT, TRIDENT_9440, "TG 9440"),
141: DEVICE( TRIDENT, TRIDENT_9660, "TG 9660 / Cyber9385"),
142: DEVICE( TRIDENT, TRIDENT_9750, "Image 975"),
143: DEVICE( AI, AI_M1435, "M1435"),
144: DEVICE( MATROX, MATROX_MGA_2, "Atlas PX2085"),
145: DEVICE( MATROX, MATROX_MIL, "Millennium"),
146: DEVICE( MATROX, MATROX_MYS, "Mystique"),
147: DEVICE( MATROX, MATROX_MIL_2, "Millennium II"),
148: DEVICE( MATROX, MATROX_MIL_2_AGP,"Millennium II AGP"),
149: DEVICE( MATROX, MATROX_MGA_IMP, "MGA Impression"),
150: DEVICE( CT, CT_65545, "65545"),
151: DEVICE( CT, CT_65548, "65548"),
152: DEVICE( CT, CT_65550, "65550"),
153: DEVICE( CT, CT_65554, "65554"),
154: DEVICE( CT, CT_65555, "65555"),
155: DEVICE( MIRO, MIRO_36050, "ZR36050"),
156: DEVICE( NEC, NEC_PCX2, "PowerVR PCX2"),
157: DEVICE( FD, FD_36C70, "TMC-18C30"),
158: DEVICE( SI, SI_5591_AGP, "5591/5592 AGP"),
159: DEVICE( SI, SI_6202, "6202"),
160: DEVICE( SI, SI_503, "85C503"),
161: DEVICE( SI, SI_ACPI, "ACPI"),
162: DEVICE( SI, SI_5597_VGA, "5597/5598 VGA"),
163: DEVICE( SI, SI_6205, "6205"),
164: DEVICE( SI, SI_501, "85C501"),
165: DEVICE( SI, SI_496, "85C496"),
166: DEVICE( SI, SI_601, "85C601"),
167: DEVICE( SI, SI_5107, "5107"),
168: DEVICE( SI, SI_5511, "85C5511"),
169: DEVICE( SI, SI_5513, "85C5513"),
170: DEVICE( SI, SI_5571, "5571"),
171: DEVICE( SI, SI_5591, "5591/5592 Host"),
172: DEVICE( SI, SI_5597, "5597/5598 Host"),
173: DEVICE( SI, SI_7001, "7001 USB"),
174: DEVICE( HP, HP_J2585A, "J2585A"),
175: DEVICE( HP, HP_J2585B, "J2585B (Lassen)"),
176: DEVICE( PCTECH, PCTECH_RZ1000, "RZ1000 (buggy)"),
177: DEVICE( PCTECH, PCTECH_RZ1001, "RZ1001 (buggy?)"),
178: DEVICE( PCTECH, PCTECH_SAMURAI_0,"Samurai 0"),
179: DEVICE( PCTECH, PCTECH_SAMURAI_1,"Samurai 1"),
180: DEVICE( PCTECH, PCTECH_SAMURAI_IDE,"Samurai IDE"),
181: DEVICE( DPT, DPT, "SmartCache/Raid"),
182: DEVICE( OPTI, OPTI_92C178, "92C178"),
183: DEVICE( OPTI, OPTI_82C557, "82C557 Viper-M"),
184: DEVICE( OPTI, OPTI_82C558, "82C558 Viper-M ISA+IDE"),
185: DEVICE( OPTI, OPTI_82C621, "82C621"),
186: DEVICE( OPTI, OPTI_82C700, "82C700"),
187: DEVICE( OPTI, OPTI_82C701, "82C701 FireStar Plus"),
188: DEVICE( OPTI, OPTI_82C814, "82C814 Firebridge 1"),
189: DEVICE( OPTI, OPTI_82C822, "82C822"),
190: DEVICE( OPTI, OPTI_82C825, "82C825 Firebridge 2"),
191: DEVICE( SGS, SGS_2000, "STG 2000X"),
192: DEVICE( SGS, SGS_1764, "STG 1764X"),
193: DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER_NC, "MultiMaster NC"),
194: DEVICE( BUSLOGIC, BUSLOGIC_MULTIMASTER, "MultiMaster"),
195: DEVICE( BUSLOGIC, BUSLOGIC_FLASHPOINT, "FlashPoint"),
196: DEVICE( TI, TI_TVP4010, "TVP4010 Permedia"),
197: DEVICE( TI, TI_TVP4020, "TVP4020 Permedia 2"),
198: DEVICE( TI, TI_PCI1130, "PCI1130"),
199: DEVICE( TI, TI_PCI1131, "PCI1131"),
200: DEVICE( TI, TI_PCI1250, "PCI1250"),
201: DEVICE( OAK, OAK_OTI107, "OTI107"),
202: DEVICE( WINBOND2, WINBOND2_89C940,"NE2000-PCI"),
203: DEVICE( MOTOROLA, MOTOROLA_MPC105,"MPC105 Eagle"),
204: DEVICE( MOTOROLA, MOTOROLA_MPC106,"MPC106 Grackle"),
205: DEVICE( MOTOROLA, MOTOROLA_RAVEN, "Raven"),
206: DEVICE( PROMISE, PROMISE_20246, "IDE UltraDMA/33"),
207: DEVICE( PROMISE, PROMISE_5300, "DC5030"),
208: DEVICE( N9, N9_I128, "Imagine 128"),
209: DEVICE( N9, N9_I128_2, "Imagine 128v2"),
210: DEVICE( UMC, UMC_UM8673F, "UM8673F"),
211: BRIDGE( UMC, UMC_UM8891A, "UM8891A", 0x01),
212: DEVICE( UMC, UMC_UM8886BF, "UM8886BF"),
213: DEVICE( UMC, UMC_UM8886A, "UM8886A"),
214: BRIDGE( UMC, UMC_UM8881F, "UM8881F", 0x02),
215: DEVICE( UMC, UMC_UM8886F, "UM8886F"),
216: DEVICE( UMC, UMC_UM9017F, "UM9017F"),
217: DEVICE( UMC, UMC_UM8886N, "UM8886N"),
218: DEVICE( UMC, UMC_UM8891N, "UM8891N"),
219: DEVICE( X, X_AGX016, "ITT AGX016"),
220: DEVICE( PICOP, PICOP_PT86C52X, "PT86C52x Vesuvius"),
221: DEVICE( PICOP, PICOP_PT80C524, "PT80C524 Nile"),
222: DEVICE( APPLE, APPLE_BANDIT, "Bandit"),
223: DEVICE( APPLE, APPLE_GC, "Grand Central"),
224: DEVICE( APPLE, APPLE_HYDRA, "Hydra"),
225: DEVICE( NEXGEN, NEXGEN_82C501, "82C501"),
226: DEVICE( QLOGIC, QLOGIC_ISP1020, "ISP1020"),
227: DEVICE( QLOGIC, QLOGIC_ISP1022, "ISP1022"),
228: DEVICE( CYRIX, CYRIX_5510, "5510"),
229: DEVICE( CYRIX, CYRIX_PCI_MASTER,"PCI Master"),
230: DEVICE( CYRIX, CYRIX_5520, "5520"),
231: DEVICE( CYRIX, CYRIX_5530_LEGACY,"5530 Kahlua Legacy"),
232: DEVICE( CYRIX, CYRIX_5530_SMI, "5530 Kahlua SMI"),
233: DEVICE( CYRIX, CYRIX_5530_IDE, "5530 Kahlua IDE"),
234: DEVICE( CYRIX, CYRIX_5530_AUDIO,"5530 Kahlua Audio"),
235: DEVICE( CYRIX, CYRIX_5530_VIDEO,"5530 Kahlua Video"),
236: DEVICE( LEADTEK, LEADTEK_805, "S3 805"),
237: DEVICE( CONTAQ, CONTAQ_82C599, "82C599"),
238: DEVICE( CONTAQ, CONTAQ_82C693, "82C693"),
239: DEVICE( OLICOM, OLICOM_OC3136, "OC-3136/3137"),
240: DEVICE( OLICOM, OLICOM_OC2315, "OC-2315"),
241: DEVICE( OLICOM, OLICOM_OC2325, "OC-2325"),
242: DEVICE( OLICOM, OLICOM_OC2183, "OC-2183/2185"),
243: DEVICE( OLICOM, OLICOM_OC2326, "OC-2326"),
244: DEVICE( OLICOM, OLICOM_OC6151, "OC-6151/6152"),
245: DEVICE( SUN, SUN_EBUS, "EBUS"),
246: DEVICE( SUN, SUN_HAPPYMEAL, "Happy Meal Ethernet"),
247: DEVICE( SUN, SUN_SIMBA, "Advanced PCI Bridge"),
248: DEVICE( SUN, SUN_PBM, "PCI Bus Module"),
249: DEVICE( SUN, SUN_SABRE, "Ultra IIi PCI"),
250: DEVICE( CMD, CMD_640, "640 (buggy)"),
251: DEVICE( CMD, CMD_643, "643"),
252: DEVICE( CMD, CMD_646, "646"),
253: DEVICE( CMD, CMD_670, "670"),
254: DEVICE( VISION, VISION_QD8500, "QD-8500"),
255: DEVICE( VISION, VISION_QD8580, "QD-8580"),
256: DEVICE( BROOKTREE, BROOKTREE_848, "Bt848"),
257: DEVICE( BROOKTREE, BROOKTREE_849A, "Bt849"),
258: DEVICE( BROOKTREE, BROOKTREE_8474, "Bt8474"),
259: DEVICE( SIERRA, SIERRA_STB, "STB Horizon 64"),
260: DEVICE( ACC, ACC_2056, "2056"),
261: DEVICE( WINBOND, WINBOND_83769, "W83769F"),
262: DEVICE( WINBOND, WINBOND_82C105, "SL82C105"),
263: DEVICE( WINBOND, WINBOND_83C553, "W83C553"),
264: DEVICE( DATABOOK, DATABOOK_87144, "DB87144"),
265: DEVICE( PLX, PLX_SPCOM200, "SPCom 200 PCI serial I/O"),
266: DEVICE( PLX, PLX_9050, "PLX9050 PCI <-> IOBus Bridge"),
267: DEVICE( PLX, PLX_9080, "PCI9080 I2O"),
268: DEVICE( MADGE, MADGE_MK2, "Smart 16/4 BM Mk2 Ringnode"),
269: DEVICE( 3COM, 3COM_3C339, "3C339 TokenRing"),
270: DEVICE( 3COM, 3COM_3C590, "3C590 10bT"),
271: DEVICE( 3COM, 3COM_3C595TX, "3C595 100bTX"),
272: DEVICE( 3COM, 3COM_3C595T4, "3C595 100bT4"),
273: DEVICE( 3COM, 3COM_3C595MII, "3C595 100b-MII"),
274: DEVICE( 3COM, 3COM_3C900TPO, "3C900 10bTPO"),
275: DEVICE( 3COM, 3COM_3C900COMBO,"3C900 10b Combo"),
276: DEVICE( 3COM, 3COM_3C905TX, "3C905 100bTX"),
277: DEVICE( 3COM, 3COM_3C905T4, "3C905 100bT4"),
278: DEVICE( 3COM, 3COM_3C905B_TX, "3C905B 100bTX"),
279: DEVICE( SMC, SMC_EPIC100, "9432 TX"),
280: DEVICE( AL, AL_M1445, "M1445"),
281: DEVICE( AL, AL_M1449, "M1449"),
282: DEVICE( AL, AL_M1451, "M1451"),
283: DEVICE( AL, AL_M1461, "M1461"),
284: DEVICE( AL, AL_M1489, "M1489"),
285: DEVICE( AL, AL_M1511, "M1511"),
286: DEVICE( AL, AL_M1513, "M1513"),
287: DEVICE( AL, AL_M1521, "M1521"),
288: DEVICE( AL, AL_M1523, "M1523"),
289: DEVICE( AL, AL_M1531, "M1531 Aladdin IV"),
290: DEVICE( AL, AL_M1533, "M1533 Aladdin IV"),
291: DEVICE( AL, AL_M3307, "M3307 MPEG-1 decoder"),
292: DEVICE( AL, AL_M4803, "M4803"),
293: DEVICE( AL, AL_M5219, "M5219"),
294: DEVICE( AL, AL_M5229, "M5229 TXpro"),
295: DEVICE( AL, AL_M5237, "M5237 USB"),
296: DEVICE( SURECOM, SURECOM_NE34, "NE-34PCI LAN"),
297: DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2070, "Magicgraph NM2070"),
298: DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128V, "MagicGraph 128V"),
299: DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_128ZV, "MagicGraph 128ZV"),
300: DEVICE( NEOMAGIC, NEOMAGIC_MAGICGRAPH_NM2160, "MagicGraph NM2160"),
301: DEVICE( ASP, ASP_ABP940, "ABP940"),
302: DEVICE( ASP, ASP_ABP940U, "ABP940U"),
303: DEVICE( ASP, ASP_ABP940UW, "ABP940UW"),
304: DEVICE( MACRONIX, MACRONIX_MX98713,"MX98713"),
305: DEVICE( MACRONIX, MACRONIX_MX987x5,"MX98715 / MX98725"),
306: DEVICE( CERN, CERN_SPSB_PMC, "STAR/RD24 SCI-PCI (PMC)"),
307: DEVICE( CERN, CERN_SPSB_PCI, "STAR/RD24 SCI-PCI (PMC)"),
308: DEVICE( CERN, CERN_HIPPI_DST, "HIPPI destination"),
309: DEVICE( CERN, CERN_HIPPI_SRC, "HIPPI source"),
310: DEVICE( IMS, IMS_8849, "8849"),
311: DEVICE( TEKRAM2, TEKRAM2_690c, "DC690c"),
312: DEVICE( TUNDRA, TUNDRA_CA91C042,"CA91C042 Universe"),
313: DEVICE( AMCC, AMCC_MYRINET, "Myrinet PCI (M2-PCI-32)"),
314: DEVICE( AMCC, AMCC_S5933, "S5933"),
315: DEVICE( AMCC, AMCC_S5933_HEPC3,"S5933 Traquair HEPC3"),
316: DEVICE( INTERG, INTERG_1680, "IGA-1680"),
317: DEVICE( INTERG, INTERG_1682, "IGA-1682"),
318: DEVICE( REALTEK, REALTEK_8029, "8029"),
319: DEVICE( REALTEK, REALTEK_8129, "8129"),
320: DEVICE( REALTEK, REALTEK_8139, "8139"),
321: DEVICE( TRUEVISION, TRUEVISION_T1000,"TARGA 1000"),
322: DEVICE( INIT, INIT_320P, "320 P"),
323: DEVICE( INIT, INIT_360P, "360 P"),
324: DEVICE( VIA, VIA_82C505, "VT 82C505"),
325: DEVICE( VIA, VIA_82C561, "VT 82C561"),
326: DEVICE( VIA, VIA_82C586_1, "VT 82C586 Apollo IDE"),
327: DEVICE( VIA, VIA_82C576, "VT 82C576 3V"),
328: DEVICE( VIA, VIA_82C585, "VT 82C585 Apollo VP1/VPX"),
329: DEVICE( VIA, VIA_82C586_0, "VT 82C586 Apollo ISA"),
330: DEVICE( VIA, VIA_82C595, "VT 82C595 Apollo VP2"),
331: DEVICE( VIA, VIA_82C597_0, "VT 82C597 Apollo VP3"),
332: DEVICE( VIA, VIA_82C926, "VT 82C926 Amazon"),
333: DEVICE( VIA, VIA_82C416, "VT 82C416MV"),
334: DEVICE( VIA, VIA_82C595_97, "VT 82C595 Apollo VP2/97"),
335: DEVICE( VIA, VIA_82C586_2, "VT 82C586 Apollo USB"),
336: DEVICE( VIA, VIA_82C586_3, "VT 82C586B Apollo ACPI"),
337: DEVICE( VIA, VIA_86C100A, "VT 86C100A"),
338: DEVICE( VIA, VIA_82C597_1, "VT 82C597 Apollo VP3 AGP"),
339: DEVICE( VORTEX, VORTEX_GDT60x0, "GDT 60x0"),
340: DEVICE( VORTEX, VORTEX_GDT6000B,"GDT 6000b"),
341: DEVICE( VORTEX, VORTEX_GDT6x10, "GDT 6110/6510"),
342: DEVICE( VORTEX, VORTEX_GDT6x20, "GDT 6120/6520"),
343: DEVICE( VORTEX, VORTEX_GDT6530, "GDT 6530"),
344: DEVICE( VORTEX, VORTEX_GDT6550, "GDT 6550"),
345: DEVICE( VORTEX, VORTEX_GDT6x17, "GDT 6117/6517"),
346: DEVICE( VORTEX, VORTEX_GDT6x27, "GDT 6127/6527"),
347: DEVICE( VORTEX, VORTEX_GDT6537, "GDT 6537"),
348: DEVICE( VORTEX, VORTEX_GDT6557, "GDT 6557"),
349: DEVICE( VORTEX, VORTEX_GDT6x15, "GDT 6115/6515"),
350: DEVICE( VORTEX, VORTEX_GDT6x25, "GDT 6125/6525"),
351: DEVICE( VORTEX, VORTEX_GDT6535, "GDT 6535"),
352: DEVICE( VORTEX, VORTEX_GDT6555, "GDT 6555"),
353: DEVICE( VORTEX, VORTEX_GDT6x17RP,"GDT 6117RP/6517RP"),
354: DEVICE( VORTEX, VORTEX_GDT6x27RP,"GDT 6127RP/6527RP"),
355: DEVICE( VORTEX, VORTEX_GDT6537RP,"GDT 6537RP"),
356: DEVICE( VORTEX, VORTEX_GDT6557RP,"GDT 6557RP"),
357: DEVICE( VORTEX, VORTEX_GDT6x11RP,"GDT 6111RP/6511RP"),
358: DEVICE( VORTEX, VORTEX_GDT6x21RP,"GDT 6121RP/6521RP"),
359: DEVICE( VORTEX, VORTEX_GDT6x17RP1,"GDT 6117RP1/6517RP1"),
360: DEVICE( VORTEX, VORTEX_GDT6x27RP1,"GDT 6127RP1/6527RP1"),
361: DEVICE( VORTEX, VORTEX_GDT6537RP1,"GDT 6537RP1"),
362: DEVICE( VORTEX, VORTEX_GDT6557RP1,"GDT 6557RP1"),
363: DEVICE( VORTEX, VORTEX_GDT6x11RP1,"GDT 6111RP1/6511RP1"),
364: DEVICE( VORTEX, VORTEX_GDT6x21RP1,"GDT 6121RP1/6521RP1"),
365: DEVICE( VORTEX, VORTEX_GDT6x17RP2,"GDT 6117RP2/6517RP2"),
366: DEVICE( VORTEX, VORTEX_GDT6x27RP2,"GDT 6127RP2/6527RP2"),
367: DEVICE( VORTEX, VORTEX_GDT6537RP2,"GDT 6537RP2"),
368: DEVICE( VORTEX, VORTEX_GDT6557RP2,"GDT 6557RP2"),
369: DEVICE( VORTEX, VORTEX_GDT6x11RP2,"GDT 6111RP2/6511RP2"),
370: DEVICE( VORTEX, VORTEX_GDT6x21RP2,"GDT 6121RP2/6521RP2"),
371: DEVICE( EF, EF_ATM_FPGA, "155P-MF1 (FPGA)"),
372: DEVICE( EF, EF_ATM_ASIC, "155P-MF1 (ASIC)"),
373: DEVICE( FORE, FORE_PCA200PC, "PCA-200PC"),
374: DEVICE( FORE, FORE_PCA200E, "PCA-200E"),
375: DEVICE( IMAGINGTECH, IMAGINGTECH_ICPCI, "MVC IC-PCI"),
376: DEVICE( PHILIPS, PHILIPS_SAA7146,"SAA7146"),
377: DEVICE( CYCLONE, CYCLONE_SDK, "SDK"),
378: DEVICE( ALLIANCE, ALLIANCE_PROMOTIO, "Promotion-6410"),
379: DEVICE( ALLIANCE, ALLIANCE_PROVIDEO, "Provideo"),
380: DEVICE( ALLIANCE, ALLIANCE_AT24, "AT24"),
381: DEVICE( ALLIANCE, ALLIANCE_AT3D, "AT3D"),
382: DEVICE( VMIC, VMIC_VME, "VMIVME-7587"),
383: DEVICE( DIGI, DIGI_EPC, "AccelPort EPC"),
384: DEVICE( DIGI, DIGI_RIGHTSWITCH, "RightSwitch SE-6"),
385: DEVICE( DIGI, DIGI_XEM, "AccelPort Xem"),
386: DEVICE( DIGI, DIGI_XR, "AccelPort Xr"),
387: DEVICE( DIGI, DIGI_CX, "AccelPort C/X"),
388: DEVICE( DIGI, DIGI_XRJ, "AccelPort Xr/J"),
389: DEVICE( DIGI, DIGI_EPCJ, "AccelPort EPC/J"),
390: DEVICE( DIGI, DIGI_XR_920, "AccelPort Xr 920"),
391: DEVICE( MUTECH, MUTECH_MV1000, "MV-1000"),
392: DEVICE( RENDITION, RENDITION_VERITE,"Verite 1000"),
393: DEVICE( RENDITION, RENDITION_VERITE2100,"Verite 2100"),
394: DEVICE( TOSHIBA, TOSHIBA_601, "Laptop"),
395: DEVICE( TOSHIBA, TOSHIBA_TOPIC95,"ToPIC95"),
396: DEVICE( TOSHIBA, TOSHIBA_TOPIC97,"ToPIC97"),
397: DEVICE( RICOH, RICOH_RL5C466, "RL5C466"),
398: DEVICE( ARTOP, ARTOP_ATP850UF, "ATP850UF"),
399: DEVICE( ZEITNET, ZEITNET_1221, "1221"),
400: DEVICE( ZEITNET, ZEITNET_1225, "1225"),
401: DEVICE( OMEGA, OMEGA_82C092G, "82C092G"),
402: DEVICE( LITEON, LITEON_LNE100TX,"LNE100TX"),
403: DEVICE( NP, NP_PCI_FDDI, "NP-PCI"),
404: DEVICE( ATT, ATT_L56XMF, "L56xMF"),
405: DEVICE( SPECIALIX, SPECIALIX_IO8, "IO8+/PCI"),
406: DEVICE( SPECIALIX, SPECIALIX_XIO, "XIO/SIO host"),
407: DEVICE( SPECIALIX, SPECIALIX_RIO, "RIO host"),
408: DEVICE( AURAVISION, AURAVISION_VXP524,"VXP524"),
409: DEVICE( IKON, IKON_10115, "10115 Greensheet"),
410: DEVICE( IKON, IKON_10117, "10117 Greensheet"),
411: DEVICE( ZORAN, ZORAN_36057, "ZR36057"),
412: DEVICE( ZORAN, ZORAN_36120, "ZR36120"),
413: DEVICE( KINETIC, KINETIC_2915, "2915 CAMAC"),
414: DEVICE( COMPEX, COMPEX_ENET100VG4, "Readylink ENET100-VG4"),
415: DEVICE( COMPEX, COMPEX_RL2000, "ReadyLink 2000"),
416: DEVICE( RP, RP8OCTA, "RocketPort 8 Oct"),
417: DEVICE( RP, RP8INTF, "RocketPort 8 Intf"),
418: DEVICE( RP, RP16INTF, "RocketPort 16 Intf"),
419: DEVICE( RP, RP32INTF, "RocketPort 32 Intf"),
420: DEVICE( CYCLADES, CYCLOM_Y_Lo, "Cyclom-Y below 1Mbyte"),
421: DEVICE( CYCLADES, CYCLOM_Y_Hi, "Cyclom-Y above 1Mbyte"),
422: DEVICE( CYCLADES, CYCLOM_Z_Lo, "Cyclom-Z below 1Mbyte"),
423: DEVICE( CYCLADES, CYCLOM_Z_Hi, "Cyclom-Z above 1Mbyte"),
424: DEVICE( ESSENTIAL, ESSENTIAL_ROADRUNNER,"Roadrunner serial HIPPI"),
425: DEVICE( O2, O2_6832, "6832"),
426: DEVICE( 3DFX, 3DFX_VOODOO, "Voodoo"),
427: DEVICE( 3DFX, 3DFX_VOODOO2, "Voodoo2"),
428: DEVICE( SIGMADES, SIGMADES_6425, "REALmagic64/GX"),
429: DEVICE( STALLION, STALLION_ECHPCI832,"EasyConnection 8/32"),
430: DEVICE( STALLION, STALLION_ECHPCI864,"EasyConnection 8/64"),
431: DEVICE( STALLION, STALLION_EIOPCI,"EasyIO"),
432: DEVICE( OPTIBASE, OPTIBASE_FORGE, "MPEG Forge"),
433: DEVICE( OPTIBASE, OPTIBASE_FUSION,"MPEG Fusion"),
434: DEVICE( OPTIBASE, OPTIBASE_VPLEX, "VideoPlex"),
435: DEVICE( OPTIBASE, OPTIBASE_VPLEXCC,"VideoPlex CC"),
436: DEVICE( OPTIBASE, OPTIBASE_VQUEST,"VideoQuest"),
437: DEVICE( ASIX, ASIX_88140, "88140"),
438: DEVICE( SATSAGEM, SATSAGEM_PCR2101,"PCR2101 DVB receiver"),
439: DEVICE( SATSAGEM, SATSAGEM_TELSATTURBO,"Telsat Turbo DVB"),
440: DEVICE( ENSONIQ, ENSONIQ_AUDIOPCI,"AudioPCI"),
441: DEVICE( PICTUREL, PICTUREL_PCIVST,"PCIVST"),
442: DEVICE( NVIDIA_SGS, NVIDIA_SGS_RIVA128, "Riva 128"),
443: DEVICE( CBOARDS, CBOARDS_DAS1602_16,"DAS1602/16"),
444: DEVICE( SYMPHONY, SYMPHONY_101, "82C101"),
445: DEVICE( TEKRAM, TEKRAM_DC290, "DC-290"),
446: DEVICE( 3DLABS, 3DLABS_300SX, "GLINT 300SX"),
447: DEVICE( 3DLABS, 3DLABS_500TX, "GLINT 500TX"),
448: DEVICE( 3DLABS, 3DLABS_DELTA, "GLINT Delta"),
449: DEVICE( 3DLABS, 3DLABS_PERMEDIA,"PERMEDIA"),
450: DEVICE( 3DLABS, 3DLABS_MX, "GLINT MX"),
451: DEVICE( AVANCE, AVANCE_ALG2064, "ALG2064i"),
452: DEVICE( AVANCE, AVANCE_2302, "ALG-2302"),
453: DEVICE( NETVIN, NETVIN_NV5000SC,"NV5000"),
454: DEVICE( S3, S3_PLATO_PXS, "PLATO/PX (system)"),
455: DEVICE( S3, S3_ViRGE, "ViRGE"),
456: DEVICE( S3, S3_TRIO, "Trio32/Trio64"),
457: DEVICE( S3, S3_AURORA64VP, "Aurora64V+"),
458: DEVICE( S3, S3_TRIO64UVP, "Trio64UV+"),
459: DEVICE( S3, S3_ViRGE_VX, "ViRGE/VX"),
460: DEVICE( S3, S3_868, "Vision 868"),
461: DEVICE( S3, S3_928, "Vision 928-P"),
462: DEVICE( S3, S3_864_1, "Vision 864-P"),
463: DEVICE( S3, S3_864_2, "Vision 864-P"),
464: DEVICE( S3, S3_964_1, "Vision 964-P"),
465: DEVICE( S3, S3_964_2, "Vision 964-P"),
466: DEVICE( S3, S3_968, "Vision 968"),
467: DEVICE( S3, S3_TRIO64V2, "Trio64V2/DX or /GX"),
468: DEVICE( S3, S3_PLATO_PXG, "PLATO/PX (graphics)"),
469: DEVICE( S3, S3_ViRGE_DXGX, "ViRGE/DX or /GX"),
470: DEVICE( S3, S3_ViRGE_GX2, "ViRGE/GX2"),
471: DEVICE( S3, S3_ViRGE_MX, "ViRGE/MX"),
472: DEVICE( S3, S3_ViRGE_MXP, "ViRGE/MX+"),
473: DEVICE( S3, S3_ViRGE_MXPMV, "ViRGE/MX+MV"),
474: DEVICE( S3, S3_SONICVIBES, "SonicVibes"),
475: DEVICE( INTEL, INTEL_82375, "82375EB"),
476: BRIDGE( INTEL, INTEL_82424, "82424ZX Saturn", 0x00),
477: DEVICE( INTEL, INTEL_82378, "82378IB"),
478: DEVICE( INTEL, INTEL_82430, "82430ZX Aries"),
479: BRIDGE( INTEL, INTEL_82434, "82434LX Mercury/Neptune", 0x00),
480: DEVICE( INTEL, INTEL_82092AA_0,"82092AA PCMCIA bridge"),
481: DEVICE( INTEL, INTEL_82092AA_1,"82092AA EIDE"),
482: DEVICE( INTEL, INTEL_7116, "SAA7116"),
483: DEVICE( INTEL, INTEL_82596, "82596"),
484: DEVICE( INTEL, INTEL_82865, "82865"),
485: DEVICE( INTEL, INTEL_82557, "82557"),
486: DEVICE( INTEL, INTEL_82437, "82437"),
487: DEVICE( INTEL, INTEL_82371_0, "82371 Triton PIIX"),
488: DEVICE( INTEL, INTEL_82371_1, "82371 Triton PIIX"),
489: DEVICE( INTEL, INTEL_82371MX, "430MX - 82371MX MPIIX"),
490: DEVICE( INTEL, INTEL_82437MX, "430MX - 82437MX MTSC"),
491: DEVICE( INTEL, INTEL_82441, "82441FX Natoma"),
492: DEVICE( INTEL, INTEL_82380FB, "82380FB Mobile"),
493: DEVICE( INTEL, INTEL_82439, "82439HX Triton II"),
494: DEVICE( INTEL, INTEL_82371SB_0,"82371SB PIIX3 ISA"),
495: DEVICE( INTEL, INTEL_82371SB_1,"82371SB PIIX3 IDE"),
496: DEVICE( INTEL, INTEL_82371SB_2,"82371SB PIIX3 USB"),
497: DEVICE( INTEL, INTEL_82437VX, "82437VX Triton II"),
498: DEVICE( INTEL, INTEL_82439TX, "82439TX"),
499: DEVICE( INTEL, INTEL_82371AB_0,"82371AB PIIX4 ISA"),
500: DEVICE( INTEL, INTEL_82371AB, "82371AB PIIX4 IDE"),
501: DEVICE( INTEL, INTEL_82371AB_2,"82371AB PIIX4 USB"),
502: DEVICE( INTEL, INTEL_82371AB_3,"82371AB PIIX4 ACPI"),
503: DEVICE( INTEL, INTEL_82443LX_0,"440LX - 82443LX PAC Host"),
504: DEVICE( INTEL, INTEL_82443LX_1,"440LX - 82443LX PAC AGP"),
505: DEVICE( INTEL, INTEL_82443BX_0,"440BX - 82443BX Host"),
506: DEVICE( INTEL, INTEL_82443BX_1,"440BX - 82443BX AGP"),
507: DEVICE( INTEL, INTEL_82443BX_2,"440BX - 82443BX Host (no AGP)"),
508: DEVICE( INTEL, INTEL_82443GX_0,"440GX - 82443GX Host"),
509: DEVICE( INTEL, INTEL_82443GX_1,"440GX - 82443GX AGP"),
510: DEVICE( INTEL, INTEL_82443GX_2,"440GX - 82443GX Host (no AGP)"),
511: DEVICE( INTEL, INTEL_P6, "Orion P6"),
512: DEVICE( INTEL, INTEL_82450GX, "82450GX Orion P6"),
513: DEVICE( KTI, KTI_ET32P2, "ET32P2"),
514: DEVICE( ADAPTEC, ADAPTEC_7810, "AIC-7810 RAID"),
515: DEVICE( ADAPTEC, ADAPTEC_7850, "AIC-7850"),
516: DEVICE( ADAPTEC, ADAPTEC_7855, "AIC-7855"),
517: DEVICE( ADAPTEC, ADAPTEC_5800, "AIC-5800"),
518: DEVICE( ADAPTEC, ADAPTEC_7860, "AIC-7860"),
519: DEVICE( ADAPTEC, ADAPTEC_7861, "AIC-7861"),
520: DEVICE( ADAPTEC, ADAPTEC_7870, "AIC-7870"),
521: DEVICE( ADAPTEC, ADAPTEC_7871, "AIC-7871"),
522: DEVICE( ADAPTEC, ADAPTEC_7872, "AIC-7872"),
523: DEVICE( ADAPTEC, ADAPTEC_7873, "AIC-7873"),
524: DEVICE( ADAPTEC, ADAPTEC_7874, "AIC-7874"),
525: DEVICE( ADAPTEC, ADAPTEC_7895, "AIC-7895U"),
526: DEVICE( ADAPTEC, ADAPTEC_7880, "AIC-7880U"),
527: DEVICE( ADAPTEC, ADAPTEC_7881, "AIC-7881U"),
528: DEVICE( ADAPTEC, ADAPTEC_7882, "AIC-7882U"),
529: DEVICE( ADAPTEC, ADAPTEC_7883, "AIC-7883U"),
530: DEVICE( ADAPTEC, ADAPTEC_7884, "AIC-7884U"),
531: DEVICE( ADAPTEC, ADAPTEC_1030, "ABA-1030 DVB receiver"),
532: DEVICE( ADAPTEC2, ADAPTEC2_2940U2, "AHA-2940U2"),
533: DEVICE( ADAPTEC2, ADAPTEC2_7890, "AIC-7890/1"),
534: DEVICE( ADAPTEC2, ADAPTEC2_3940U2, "AHA-3940U2"),
535: DEVICE( ADAPTEC2, ADAPTEC2_7896, "AIC-7896/7"),
536: DEVICE( ATRONICS, ATRONICS_2015, "IDE-2015PL"),
537: DEVICE( TIGERJET, TIGERJET_300, "Tiger300 ISDN"),
538: DEVICE( ARK, ARK_STING, "Stingray"),
539: DEVICE( ARK, ARK_STINGARK, "Stingray ARK 2000PV"),
540: DEVICE( ARK, ARK_2000MT, "2000MT")
541: };
542:
543:
544: #ifdef CONFIG_PCI_OPTIMIZE
545:
546: /*
547: * An item of this structure has the following meaning:
548: * for each optimization, the register address, the mask
549: * and value to write to turn it on.
550: * There are 5 optimizations for the moment:
551: * Cache L2 write back best than write through
552: * Posted Write for CPU to PCI enable
553: * Posted Write for CPU to MEMORY enable
554: * Posted Write for PCI to MEMORY enable
555: * PCI Burst enable
556: *
557: * Half of the bios I've meet don't allow you to turn that on, and you
558: * can gain more than 15% on graphic accesses using those
559: * optimizations...
560: */
561: struct optimization_type {
562: const char *type;
563: const char *off;
564: const char *on;
565: } bridge_optimization[] = {
566: {"Cache L2", "write through", "write back"},
567: {"CPU-PCI posted write", "off", "on"},
568: {"CPU-Memory posted write", "off", "on"},
569: {"PCI-Memory posted write", "off", "on"},
570: {"PCI burst", "off", "on"}
571: };
572:
573: #define NUM_OPTIMIZATIONS \
574: (sizeof(bridge_optimization) / sizeof(bridge_optimization[0]))
575:
576: struct bridge_mapping_type {
577: unsigned char addr; /* config space address */
578: unsigned char mask;
579: unsigned char value;
580: } bridge_mapping[] = {
581: /*
582: * Intel Neptune/Mercury/Saturn:
583: * If the internal cache is write back,
584: * the L2 cache must be write through!
585: * I've to check out how to control that
586: * for the moment, we won't touch the cache
587: */
588: {0x0 ,0x02 ,0x02 },
589: {0x53 ,0x02 ,0x02 },
590: {0x53 ,0x01 ,0x01 },
591: {0x54 ,0x01 ,0x01 },
592: {0x54 ,0x02 ,0x02 },
593:
594: /*
595: * UMC 8891A Pentium chipset:
596: * Why did you think UMC was cheaper ??
597: */
598: {0x50 ,0x10 ,0x00 },
599: {0x51 ,0x40 ,0x40 },
600: {0x0 ,0x0 ,0x0 },
601: {0x0 ,0x0 ,0x0 },
602: {0x0 ,0x0 ,0x0 },
603:
604: /*
605: * UMC UM8881F
606: * This is a dummy entry for my tests.
607: * I have this chipset and no docs....
608: */
609: {0x0 ,0x1 ,0x1 },
610: {0x0 ,0x2 ,0x0 },
611: {0x0 ,0x0 ,0x0 },
612: {0x0 ,0x0 ,0x0 },
613: {0x0 ,0x0 ,0x0 }
614: };
615:
616: #endif /* CONFIG_PCI_OPTIMIZE */
617:
618:
619: /*
620: * device_info[] is sorted so we can use binary search
621: */
622: struct pci_dev_info *pci_lookup_dev(unsigned int vendor, unsigned int dev)
623: {
624: int min = 0,
625: max = sizeof(dev_info)/sizeof(dev_info[0]) - 1;
626:
627: for ( ; ; )
628: {
629: int i = (min + max) >> 1;
630: long order;
631:
632: order = dev_info[i].vendor - (long) vendor;
633: if (!order)
634: order = dev_info[i].device - (long) dev;
635:
636: if (order < 0)
637: {
638: min = i + 1;
639: if ( min > max )
640: return 0;
641: continue;
642: }
643:
644: if (order > 0)
645: {
646: max = i - 1;
647: if ( min > max )
648: return 0;
649: continue;
650: }
651:
652: return & dev_info[ i ];
653: }
654: }
655:
656: const char *pci_strclass (unsigned int class)
657: {
658: switch (class >> 8) {
659: case PCI_CLASS_NOT_DEFINED: return "Non-VGA device";
660: case PCI_CLASS_NOT_DEFINED_VGA: return "VGA compatible device";
661:
662: case PCI_CLASS_STORAGE_SCSI: return "SCSI storage controller";
663: case PCI_CLASS_STORAGE_IDE: return "IDE interface";
664: case PCI_CLASS_STORAGE_FLOPPY: return "Floppy disk controller";
665: case PCI_CLASS_STORAGE_IPI: return "IPI bus controller";
666: case PCI_CLASS_STORAGE_RAID: return "RAID bus controller";
667: case PCI_CLASS_STORAGE_OTHER: return "Unknown mass storage controller";
668:
669: case PCI_CLASS_NETWORK_ETHERNET: return "Ethernet controller";
670: case PCI_CLASS_NETWORK_TOKEN_RING: return "Token ring network controller";
671: case PCI_CLASS_NETWORK_FDDI: return "FDDI network controller";
672: case PCI_CLASS_NETWORK_ATM: return "ATM network controller";
673: case PCI_CLASS_NETWORK_OTHER: return "Network controller";
674:
675: case PCI_CLASS_DISPLAY_VGA: return "VGA compatible controller";
676: case PCI_CLASS_DISPLAY_XGA: return "XGA compatible controller";
677: case PCI_CLASS_DISPLAY_OTHER: return "Display controller";
678:
679: case PCI_CLASS_MULTIMEDIA_VIDEO: return "Multimedia video controller";
680: case PCI_CLASS_MULTIMEDIA_AUDIO: return "Multimedia audio controller";
681: case PCI_CLASS_MULTIMEDIA_OTHER: return "Multimedia controller";
682:
683: case PCI_CLASS_MEMORY_RAM: return "RAM memory";
684: case PCI_CLASS_MEMORY_FLASH: return "FLASH memory";
685: case PCI_CLASS_MEMORY_OTHER: return "Memory";
686:
687: case PCI_CLASS_BRIDGE_HOST: return "Host bridge";
688: case PCI_CLASS_BRIDGE_ISA: return "ISA bridge";
689: case PCI_CLASS_BRIDGE_EISA: return "EISA bridge";
690: case PCI_CLASS_BRIDGE_MC: return "MicroChannel bridge";
691: case PCI_CLASS_BRIDGE_PCI: return "PCI bridge";
692: case PCI_CLASS_BRIDGE_PCMCIA: return "PCMCIA bridge";
693: case PCI_CLASS_BRIDGE_NUBUS: return "NuBus bridge";
694: case PCI_CLASS_BRIDGE_CARDBUS: return "CardBus bridge";
695: case PCI_CLASS_BRIDGE_OTHER: return "Bridge";
696:
697: case PCI_CLASS_COMMUNICATION_SERIAL: return "Serial controller";
698: case PCI_CLASS_COMMUNICATION_PARALLEL: return "Parallel controller";
699: case PCI_CLASS_COMMUNICATION_OTHER: return "Communication controller";
700:
701: case PCI_CLASS_SYSTEM_PIC: return "PIC";
702: case PCI_CLASS_SYSTEM_DMA: return "DMA controller";
703: case PCI_CLASS_SYSTEM_TIMER: return "Timer";
704: case PCI_CLASS_SYSTEM_RTC: return "RTC";
705: case PCI_CLASS_SYSTEM_OTHER: return "System peripheral";
706:
707: case PCI_CLASS_INPUT_KEYBOARD: return "Keyboard controller";
708: case PCI_CLASS_INPUT_PEN: return "Digitizer Pen";
709: case PCI_CLASS_INPUT_MOUSE: return "Mouse controller";
710: case PCI_CLASS_INPUT_OTHER: return "Input device controller";
711:
712: case PCI_CLASS_DOCKING_GENERIC: return "Generic Docking Station";
713: case PCI_CLASS_DOCKING_OTHER: return "Docking Station";
714:
715: case PCI_CLASS_PROCESSOR_386: return "386";
716: case PCI_CLASS_PROCESSOR_486: return "486";
717: case PCI_CLASS_PROCESSOR_PENTIUM: return "Pentium";
718: case PCI_CLASS_PROCESSOR_ALPHA: return "Alpha";
719: case PCI_CLASS_PROCESSOR_POWERPC: return "Power PC";
720: case PCI_CLASS_PROCESSOR_CO: return "Co-processor";
721:
722: case PCI_CLASS_SERIAL_FIREWIRE: return "FireWire (IEEE 1394)";
723: case PCI_CLASS_SERIAL_ACCESS: return "ACCESS Bus";
724: case PCI_CLASS_SERIAL_SSA: return "SSA";
725: case PCI_CLASS_SERIAL_USB: return "USB Controller";
726: case PCI_CLASS_SERIAL_FIBER: return "Fiber Channel";
727:
728: default: return "Unknown class";
729: }
730: }
731:
732:
733: const char *pci_strvendor(unsigned int vendor)
734: {
735: switch (vendor) {
736: case PCI_VENDOR_ID_COMPAQ: return "Compaq";
737: case PCI_VENDOR_ID_NCR: return "NCR";
738: case PCI_VENDOR_ID_ATI: return "ATI";
739: case PCI_VENDOR_ID_VLSI: return "VLSI";
740: case PCI_VENDOR_ID_ADL: return "Advance Logic";
741: case PCI_VENDOR_ID_NS: return "NS";
742: case PCI_VENDOR_ID_TSENG: return "Tseng'Lab";
743: case PCI_VENDOR_ID_WEITEK: return "Weitek";
744: case PCI_VENDOR_ID_DEC: return "DEC";
745: case PCI_VENDOR_ID_CIRRUS: return "Cirrus Logic";
746: case PCI_VENDOR_ID_IBM: return "IBM";
747: case PCI_VENDOR_ID_WD: return "Western Digital";
748: case PCI_VENDOR_ID_AMD: return "AMD";
749: case PCI_VENDOR_ID_TRIDENT: return "Trident";
750: case PCI_VENDOR_ID_AI: return "Acer Incorporated";
751: case PCI_VENDOR_ID_MATROX: return "Matrox";
752: case PCI_VENDOR_ID_CT: return "Chips & Technologies";
753: case PCI_VENDOR_ID_MIRO: return "Miro";
754: case PCI_VENDOR_ID_NEC: return "NEC";
755: case PCI_VENDOR_ID_FD: return "Future Domain";
756: case PCI_VENDOR_ID_SI: return "Silicon Integrated Systems";
757: case PCI_VENDOR_ID_HP: return "Hewlett Packard";
758: case PCI_VENDOR_ID_PCTECH: return "PCTECH";
759: case PCI_VENDOR_ID_DPT: return "DPT";
760: case PCI_VENDOR_ID_OPTI: return "OPTi";
761: case PCI_VENDOR_ID_SGS: return "SGS Thomson";
762: case PCI_VENDOR_ID_BUSLOGIC: return "BusLogic";
763: case PCI_VENDOR_ID_TI: return "Texas Instruments";
764: case PCI_VENDOR_ID_OAK: return "OAK";
765: case PCI_VENDOR_ID_WINBOND2: return "Winbond";
766: case PCI_VENDOR_ID_MOTOROLA: return "Motorola";
767: case PCI_VENDOR_ID_PROMISE: return "Promise Technology";
768: case PCI_VENDOR_ID_APPLE: return "Apple";
769: case PCI_VENDOR_ID_N9: return "Number Nine";
770: case PCI_VENDOR_ID_UMC: return "UMC";
771: case PCI_VENDOR_ID_X: return "X TECHNOLOGY";
772: case PCI_VENDOR_ID_NEXGEN: return "Nexgen";
773: case PCI_VENDOR_ID_QLOGIC: return "Q Logic";
774: case PCI_VENDOR_ID_LEADTEK: return "Leadtek Research";
775: case PCI_VENDOR_ID_CONTAQ: return "Contaq";
776: case PCI_VENDOR_ID_FOREX: return "Forex";
777: case PCI_VENDOR_ID_OLICOM: return "Olicom";
778: case PCI_VENDOR_ID_CMD: return "CMD";
779: case PCI_VENDOR_ID_VISION: return "Vision";
780: case PCI_VENDOR_ID_BROOKTREE: return "Brooktree";
781: case PCI_VENDOR_ID_SIERRA: return "Sierra";
782: case PCI_VENDOR_ID_ACC: return "ACC MICROELECTRONICS";
783: case PCI_VENDOR_ID_WINBOND: return "Winbond";
784: case PCI_VENDOR_ID_DATABOOK: return "Databook";
785: case PCI_VENDOR_ID_3COM: return "3Com";
786: case PCI_VENDOR_ID_SMC: return "SMC";
787: case PCI_VENDOR_ID_AL: return "Acer Labs";
788: case PCI_VENDOR_ID_MITSUBISHI: return "Mitsubishi";
789: case PCI_VENDOR_ID_NEOMAGIC: return "Neomagic";
790: case PCI_VENDOR_ID_ASP: return "Advanced System Products";
791: case PCI_VENDOR_ID_CERN: return "CERN";
792: case PCI_VENDOR_ID_IMS: return "IMS";
793: case PCI_VENDOR_ID_TEKRAM2: return "Tekram";
794: case PCI_VENDOR_ID_TUNDRA: return "Tundra";
795: case PCI_VENDOR_ID_AMCC: return "AMCC";
796: case PCI_VENDOR_ID_INTERG: return "Intergraphics";
797: case PCI_VENDOR_ID_REALTEK: return "Realtek";
798: case PCI_VENDOR_ID_TRUEVISION: return "Truevision";
799: case PCI_VENDOR_ID_INIT: return "Initio Corp";
800: case PCI_VENDOR_ID_VIA: return "VIA Technologies";
801: case PCI_VENDOR_ID_VORTEX: return "VORTEX";
802: case PCI_VENDOR_ID_EF: return "Efficient Networks";
803: case PCI_VENDOR_ID_FORE: return "Fore Systems";
804: case PCI_VENDOR_ID_IMAGINGTECH: return "Imaging Technology";
805: case PCI_VENDOR_ID_PHILIPS: return "Philips";
806: case PCI_VENDOR_ID_PLX: return "PLX";
807: case PCI_VENDOR_ID_ALLIANCE: return "Alliance";
808: case PCI_VENDOR_ID_VMIC: return "VMIC";
809: case PCI_VENDOR_ID_DIGI: return "Digi Intl.";
810: case PCI_VENDOR_ID_MUTECH: return "Mutech";
811: case PCI_VENDOR_ID_RENDITION: return "Rendition";
812: case PCI_VENDOR_ID_TOSHIBA: return "Toshiba";
813: case PCI_VENDOR_ID_RICOH: return "Ricoh";
814: case PCI_VENDOR_ID_ZEITNET: return "ZeitNet";
815: case PCI_VENDOR_ID_OMEGA: return "Omega Micro";
816: case PCI_VENDOR_ID_NP: return "Network Peripherals";
817: case PCI_VENDOR_ID_SPECIALIX: return "Specialix";
818: case PCI_VENDOR_ID_IKON: return "Ikon";
819: case PCI_VENDOR_ID_ZORAN: return "Zoran";
820: case PCI_VENDOR_ID_COMPEX: return "Compex";
821: case PCI_VENDOR_ID_RP: return "Comtrol";
822: case PCI_VENDOR_ID_CYCLADES: return "Cyclades";
823: case PCI_VENDOR_ID_3DFX: return "3Dfx";
824: case PCI_VENDOR_ID_SIGMADES: return "Sigma Designs";
825: case PCI_VENDOR_ID_OPTIBASE: return "Optibase";
826: case PCI_VENDOR_ID_NVIDIA_SGS: return "NVidia/SGS Thomson";
827: case PCI_VENDOR_ID_ENSONIQ: return "Ensoniq";
828: case PCI_VENDOR_ID_SYMPHONY: return "Symphony";
829: case PCI_VENDOR_ID_TEKRAM: return "Tekram";
830: case PCI_VENDOR_ID_3DLABS: return "3Dlabs";
831: case PCI_VENDOR_ID_AVANCE: return "Avance";
832: case PCI_VENDOR_ID_NETVIN: return "NetVin";
833: case PCI_VENDOR_ID_S3: return "S3 Inc.";
834: case PCI_VENDOR_ID_INTEL: return "Intel";
835: case PCI_VENDOR_ID_KTI: return "KTI";
836: case PCI_VENDOR_ID_ADAPTEC: return "Adaptec";
837: case PCI_VENDOR_ID_ADAPTEC2: return "Adaptec";
838: case PCI_VENDOR_ID_ATRONICS: return "Atronics";
839: case PCI_VENDOR_ID_ARK: return "ARK Logic";
840: case PCI_VENDOR_ID_ASIX: return "ASIX";
841: case PCI_VENDOR_ID_LITEON: return "Lite-on";
842: default: return "Unknown vendor";
843: }
844: }
845:
846:
847: const char *pci_strdev(unsigned int vendor, unsigned int device)
848: {
849: struct pci_dev_info *info;
850:
851: info = pci_lookup_dev(vendor, device);
852: return info ? info->name : "Unknown device";
853: }
854:
855:
856:
857: /*
858: * Turn on/off PCI bridge optimization. This should allow benchmarking.
859: */
860: static void burst_bridge(unsigned char bus, unsigned char devfn,
861: unsigned char pos, int turn_on)
862: {
863: #ifdef CONFIG_PCI_OPTIMIZE
864: struct bridge_mapping_type *bmap;
865: unsigned char val;
866: int i;
867:
868: pos *= NUM_OPTIMIZATIONS;
869: printk("PCI bridge optimization.\n");
870: for (i = 0; i < NUM_OPTIMIZATIONS; i++) {
871: printk(" %s: ", bridge_optimization[i].type);
872: bmap = &bridge_mapping[pos + i];
873: if (!bmap->addr) {
874: printk("Not supported.");
875: } else {
876: pcibios_read_config_byte(bus, devfn, bmap->addr, &val);
877: if ((val & bmap->mask) == bmap->value) {
878: printk("%s.", bridge_optimization[i].on);
879: if (!turn_on) {
880: pcibios_write_config_byte(bus, devfn,
881: bmap->addr,
882: (val | bmap->mask)
883: - bmap->value);
884: printk("Changed! Now %s.", bridge_optimization[i].off);
885: }
886: } else {
887: printk("%s.", bridge_optimization[i].off);
888: if (turn_on) {
889: pcibios_write_config_byte(bus, devfn,
890: bmap->addr,
891: (val & (0xff - bmap->mask))
892: + bmap->value);
893: printk("Changed! Now %s.", bridge_optimization[i].on);
894: }
895: }
896: }
897: printk("\n");
898: }
899: #endif /* CONFIG_PCI_OPTIMIZE */
900: }
901:
902:
903: /*
904: * Convert some of the configuration space registers of the device at
905: * address (bus,devfn) into a string (possibly several lines each).
906: * The configuration string is stored starting at buf[len]. If the
907: * string would exceed the size of the buffer (SIZE), 0 is returned.
908: */
909: static int sprint_dev_config(struct pci_dev *dev, char *buf, int size)
910: {
911: unsigned long base;
912: unsigned int l, class_rev, bus, devfn, last_reg;
913: unsigned short vendor, device, status;
914: unsigned char bist, latency, min_gnt, max_lat, hdr_type;
915: int reg, len = 0;
916: const char *str;
917:
918: bus = dev->bus->number;
919: devfn = dev->devfn;
920:
921: pcibios_read_config_byte (bus, devfn, PCI_HEADER_TYPE, &hdr_type);
922: pcibios_read_config_dword(bus, devfn, PCI_CLASS_REVISION, &class_rev);
923: pcibios_read_config_word (bus, devfn, PCI_VENDOR_ID, &vendor);
924: pcibios_read_config_word (bus, devfn, PCI_DEVICE_ID, &device);
925: pcibios_read_config_word (bus, devfn, PCI_STATUS, &status);
926: pcibios_read_config_byte (bus, devfn, PCI_BIST, &bist);
927: pcibios_read_config_byte (bus, devfn, PCI_LATENCY_TIMER, &latency);
928: pcibios_read_config_byte (bus, devfn, PCI_MIN_GNT, &min_gnt);
929: pcibios_read_config_byte (bus, devfn, PCI_MAX_LAT, &max_lat);
930: if (len + 80 > size) {
931: return -1;
932: }
933: len += sprintf(buf + len, " Bus %2d, device %3d, function %2d:\n",
934: bus, PCI_SLOT(devfn), PCI_FUNC(devfn));
935:
936: if (len + 80 > size) {
937: return -1;
938: }
939: len += sprintf(buf + len, " %s: %s %s (rev %d).\n ",
940: pci_strclass(class_rev >> 8), pci_strvendor(vendor),
941: pci_strdev(vendor, device), class_rev & 0xff);
942:
943: if (!pci_lookup_dev(vendor, device)) {
944: len += sprintf(buf + len,
945: "Vendor id=%x. Device id=%x.\n ",
946: vendor, device);
947: }
948:
949: str = 0; /* to keep gcc shut... */
950: switch (status & PCI_STATUS_DEVSEL_MASK) {
951: case PCI_STATUS_DEVSEL_FAST: str = "Fast devsel. "; break;
952: case PCI_STATUS_DEVSEL_MEDIUM: str = "Medium devsel. "; break;
953: case PCI_STATUS_DEVSEL_SLOW: str = "Slow devsel. "; break;
954: }
955: if (len + strlen(str) > size) {
956: return -1;
957: }
958: len += sprintf(buf + len, str);
959:
960: if (status & PCI_STATUS_FAST_BACK) {
961: # define fast_b2b_capable "Fast back-to-back capable. "
962: if (len + strlen(fast_b2b_capable) > size) {
963: return -1;
964: }
965: len += sprintf(buf + len, fast_b2b_capable);
966: # undef fast_b2b_capable
967: }
968:
969: if (bist & PCI_BIST_CAPABLE) {
970: # define BIST_capable "BIST capable. "
971: if (len + strlen(BIST_capable) > size) {
972: return -1;
973: }
974: len += sprintf(buf + len, BIST_capable);
975: # undef BIST_capable
976: }
977:
978: if (dev->irq) {
979: if (len + 40 > size) {
980: return -1;
981: }
982: len += sprintf(buf + len, "IRQ %d. ", dev->irq);
983: }
984:
985: if (dev->master) {
986: if (len + 80 > size) {
987: return -1;
988: }
989: len += sprintf(buf + len, "Master Capable. ");
990: if (latency)
991: len += sprintf(buf + len, "Latency=%d. ", latency);
992: else
993: len += sprintf(buf + len, "No bursts. ");
994: if (min_gnt)
995: len += sprintf(buf + len, "Min Gnt=%d.", min_gnt);
996: if (max_lat)
997: len += sprintf(buf + len, "Max Lat=%d.", max_lat);
998: }
999:
1000: switch (hdr_type & 0x7f) {
1001: case 0:
1002: last_reg = PCI_BASE_ADDRESS_5;
1003: break;
1004: case 1:
1005: last_reg = PCI_BASE_ADDRESS_1;
1006: break;
1007: default:
1008: last_reg = 0;
1009: }
1010: for (reg = PCI_BASE_ADDRESS_0; reg <= last_reg; reg += 4) {
1011: if (len + 40 > size) {
1012: return -1;
1013: }
1014: pcibios_read_config_dword(bus, devfn, reg, &l);
1015: base = l;
1016: if (!base) {
1017: continue;
1018: }
1019:
1020: if (base & PCI_BASE_ADDRESS_SPACE_IO) {
1021: len += sprintf(buf + len,
1022: "\n I/O at 0x%lx.",
1023: base & PCI_BASE_ADDRESS_IO_MASK);
1024: } else {
1025: const char *pref, *type = "unknown";
1026:
1027: if (base & PCI_BASE_ADDRESS_MEM_PREFETCH) {
1028: pref = "P";
1029: } else {
1030: pref = "Non-p";
1031: }
1032: switch (base & PCI_BASE_ADDRESS_MEM_TYPE_MASK) {
1033: case PCI_BASE_ADDRESS_MEM_TYPE_32:
1034: type = "32 bit"; break;
1035: case PCI_BASE_ADDRESS_MEM_TYPE_1M:
1036: type = "20 bit"; break;
1037: case PCI_BASE_ADDRESS_MEM_TYPE_64:
1038: type = "64 bit";
1039: /* read top 32 bit address of base addr: */
1040: reg += 4;
1041: pcibios_read_config_dword(bus, devfn, reg, &l);
1042: base |= ((u64) l) << 32;
1043: break;
1044: }
1045: len += sprintf(buf + len,
1046: "\n %srefetchable %s memory at "
1047: "0x%lx.", pref, type,
1048: base & PCI_BASE_ADDRESS_MEM_MASK);
1049: }
1050: }
1051:
1052: len += sprintf(buf + len, "\n");
1053: return len;
1054: }
1055:
1056:
1057: /*
1058: * Return list of PCI devices as a character string for /proc/pci.
1059: * BUF is a buffer that is PAGE_SIZE bytes long.
1060: */
1061: int get_pci_list(char *buf)
1062: {
1063: int nprinted, len, size;
1064: struct pci_dev *dev;
1065: # define MSG "\nwarning: page-size limit reached!\n"
1066:
1067: /* reserve same for truncation warning message: */
1068: size = PAGE_SIZE - (strlen(MSG) + 1);
1069: len = sprintf(buf, "PCI devices found:\n");
1070:
1071: for (dev = pci_devices; dev; dev = dev->next) {
1072: nprinted = sprint_dev_config(dev, buf + len, size - len);
1073: if (nprinted < 0) {
1074: return len + sprintf(buf + len, MSG);
1075: }
1076: len += nprinted;
1077: }
1078: return len;
1079: }
1080:
1081:
1082: /*
1083: * pci_malloc() returns initialized memory of size SIZE. Can be
1084: * used only while pci_init() is active.
1085: */
1086: static void *pci_malloc(long size, unsigned long *mem_startp)
1087: {
1088: void *mem;
1089:
1090: #ifdef DEBUG
1091: printk("...pci_malloc(size=%ld,mem=%p)", size, *mem_startp);
1092: #endif
1093: mem = (void*) *mem_startp;
1094: *mem_startp += (size + sizeof(void*) - 1) & ~(sizeof(void*) - 1);
1095: memset(mem, 0, size);
1096: return mem;
1097: }
1098:
1099:
1100: static unsigned int scan_bus(struct pci_bus *bus, unsigned long *mem_startp)
1101: {
1102: unsigned int devfn, l, max;
1103: unsigned char cmd, tmp, hdr_type, ht, is_multi = 0;
1104: struct pci_dev_info *info;
1105: struct pci_dev *dev;
1106: struct pci_bus *child;
1107:
1108: #ifdef DEBUG
1109: printk("...scan_bus(busno=%d,mem=%p)\n", bus->number, *mem_startp);
1110: #endif
1111:
1112: max = bus->secondary;
1113: for (devfn = 0; devfn < 0xff; ++devfn) {
1114: if (PCI_FUNC(devfn) && !is_multi) {
1115: /* Not a multi-function device */
1116: continue;
1117: }
1118: pcibios_read_config_byte(bus->number, devfn, PCI_HEADER_TYPE, &hdr_type);
1119: if (!PCI_FUNC(devfn))
1120: is_multi = hdr_type & 0x80;
1121:
1122: pcibios_read_config_dword(bus->number, devfn, PCI_VENDOR_ID, &l);
1123: /* some broken boards return 0 if a slot is empty: */
1124: if (l == 0xffffffff || l == 0x00000000) {
1125: is_multi = 0;
1126: continue;
1127: }
1128:
1129: dev = pci_malloc(sizeof(*dev), mem_startp);
1130: dev->bus = bus;
1131: dev->devfn = devfn;
1132: dev->vendor = l & 0xffff;
1133: dev->device = (l >> 16) & 0xffff;
1134:
1135: /*
1136: * Check to see if we know about this device and report
1137: * a message at boot time. This is the only way to
1138: * learn about new hardware...
1139: */
1140: info = pci_lookup_dev(dev->vendor, dev->device);
1141: if (!info) {
1142: #if 0
1143: printk("Warning : Unknown PCI device (%x:%x). Please read include/linux/pci.h\n",
1144: dev->vendor, dev->device);
1145: #endif
1146: } else {
1147: /* Some BIOS' are lazy. Let's do their job: */
1148: if (info->bridge_type != 0xff) {
1149: burst_bridge(bus->number, devfn,
1150: info->bridge_type, 1);
1151: }
1152: }
1153:
1154: /* non-destructively determine if device can be a master: */
1155: pcibios_read_config_byte(bus->number, devfn, PCI_COMMAND,
1156: &cmd);
1157: pcibios_write_config_byte(bus->number, devfn, PCI_COMMAND,
1158: cmd | PCI_COMMAND_MASTER);
1159: pcibios_read_config_byte(bus->number, devfn, PCI_COMMAND,
1160: &tmp);
1161: dev->master = ((tmp & PCI_COMMAND_MASTER) != 0);
1162: pcibios_write_config_byte(bus->number, devfn, PCI_COMMAND,
1163: cmd);
1164:
1165: /* read irq level (may be changed during pcibios_fixup()): */
1166: pcibios_read_config_byte(bus->number, devfn,
1167: PCI_INTERRUPT_LINE, &dev->irq);
1168:
1169: /* check to see if this device is a PCI-PCI bridge: */
1170: pcibios_read_config_dword(bus->number, devfn,
1171: PCI_CLASS_REVISION, &l);
1172: l = l >> 8; /* upper 3 bytes */
1173: dev->class = l;
1174:
1175: /*
1176: * Check if the header type is known and consistent with
1177: * device type. PCI-to-PCI Bridges should have hdr_type 1,
1178: * CardBus Bridges 2, all other devices 0.
1179: */
1180: switch (dev->class >> 8) {
1181: case PCI_CLASS_BRIDGE_PCI:
1182: ht = 1;
1183: break;
1184: case PCI_CLASS_BRIDGE_CARDBUS:
1185: ht = 2;
1186: break;
1187: default:
1188: ht = 0;
1189: }
1190: if (ht != (hdr_type & 0x7f)) {
1191: printk(KERN_WARNING "PCI: %02x:%02x [%04x/%04x/%06x] has unknown header type %02x, ignoring.\n",
1192: bus->number, dev->devfn, dev->vendor, dev->device, dev->class, hdr_type);
1193: continue;
1194: }
1195:
1196: /*
1197: * Put it into the simple chain of all PCI devices.
1198: * It is used to find devices once everything is set up.
1199: */
1200: dev->next = pci_devices;
1201: pci_devices = dev;
1202:
1203: /*
1204: * Now insert it into the list of devices held
1205: * by the parent bus.
1206: */
1207: dev->sibling = bus->devices;
1208: bus->devices = dev;
1209:
1210: if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI) {
1211: unsigned int buses;
1212: unsigned short cr;
1213:
1214: /*
1215: * Insert it into the tree of buses.
1216: */
1217: child = pci_malloc(sizeof(*child), mem_startp);
1218: child->next = bus->children;
1219: bus->children = child;
1220: child->self = dev;
1221: child->parent = bus;
1222:
1223: /*
1224: * Set up the primary, secondary and subordinate
1225: * bus numbers.
1226: */
1227: child->number = child->secondary = ++max;
1228: child->primary = bus->secondary;
1229: child->subordinate = 0xff;
1230: /*
1231: * Clear all status bits and turn off memory,
1232: * I/O and master enables.
1233: */
1234: pcibios_read_config_word(bus->number, devfn,
1235: PCI_COMMAND, &cr);
1236: pcibios_write_config_word(bus->number, devfn,
1237: PCI_COMMAND, 0x0000);
1238: pcibios_write_config_word(bus->number, devfn,
1239: PCI_STATUS, 0xffff);
1240: /*
1241: * Read the existing primary/secondary/subordinate bus
1242: * number configuration to determine if the PCI bridge
1243: * has already been configured by the system. If so,
1244: * do not modify the configuration, merely note it.
1245: */
1246: pcibios_read_config_dword(bus->number, devfn, 0x18,
1247: &buses);
1248: if ((buses & 0xFFFFFF) != 0)
1249: {
1250: child->primary = buses & 0xFF;
1251: child->secondary = (buses >> 8) & 0xFF;
1252: child->subordinate = (buses >> 16) & 0xFF;
1253: child->number = child->secondary;
1254: max = scan_bus(child, mem_startp);
1255: }
1256: else
1257: {
1258: /*
1259: * Configure the bus numbers for this bridge:
1260: */
1261: buses &= 0xff000000;
1262: buses |=
1263: (((unsigned int)(child->primary) << 0) |
1264: ((unsigned int)(child->secondary) << 8) |
1265: ((unsigned int)(child->subordinate) << 16));
1266: pcibios_write_config_dword(bus->number, devfn, 0x18,
1267: buses);
1268: /*
1269: * Now we can scan all subordinate buses:
1270: */
1271: max = scan_bus(child, mem_startp);
1272: /*
1273: * Set the subordinate bus number to its real
1274: * value:
1275: */
1276: child->subordinate = max;
1277: buses = (buses & 0xff00ffff)
1278: | ((unsigned int)(child->subordinate) << 16);
1279: pcibios_write_config_dword(bus->number, devfn, 0x18,
1280: buses);
1281: }
1282: pcibios_write_config_word(bus->number, devfn,
1283: PCI_COMMAND, cr);
1284: }
1285: }
1286: /*
1287: * We've scanned the bus and so we know all about what's on
1288: * the other side of any bridges that may be on this bus plus
1289: * any devices.
1290: *
1291: * Return how far we've got finding sub-buses.
1292: */
1293: return max;
1294: }
1295:
1296:
1297: unsigned long pci_init (unsigned long mem_start, unsigned long mem_end)
1298: {
1299: mem_start = pcibios_init(mem_start, mem_end);
1300:
1301: if (!pcibios_present()) {
1302: printk("pci_init: no BIOS32 detected\n");
1303: return mem_start;
1304: }
1305:
1306: printk("Probing PCI hardware.\n");
1307:
1308: memset(&pci_root, 0, sizeof(pci_root));
1309: pci_root.subordinate = scan_bus(&pci_root, &mem_start);
1310:
1311: /* give BIOS a chance to apply platform specific fixes: */
1312: mem_start = pcibios_fixup(mem_start, mem_end);
1313:
1314: #ifdef DEBUG
1315: {
1316: int len = get_pci_list((char*)mem_start);
1317: if (len) {
1318: ((char *) mem_start)[len] = '\0';
1319: printk("%s\n", (char *) mem_start);
1320: }
1321: }
1322: #endif
1323: return mem_start;
1324: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.