![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-10-31 14:58 |
47,815 topics / 349,930 posts / today 0 new / 48,290 members |
| DOS开发编程 & 发展交流 (开发室) » [Help] Is there a programming method for searching PCI devices under DOS? |
| Printable Version 3,978 / 9 |
| Floor1 taoweiwei | Posted 2003-12-04 00:00 |
| 初级用户 Posts 5 Credits 120 | |
| Floor2 yixianwei | Posted 2003-12-05 00:00 |
| 初级用户 Posts 26 Credits 207 | |
|
Use the pcibios interrupt.
|
|
| Floor3 aria | Posted 2003-12-13 00:00 |
| 高级用户 Posts 243 Credits 924 | |
|
Program directly to the ports and registers.
You can refer to the book <> |
|
| Floor4 笑傲江湖 | Posted 2003-12-19 00:00 |
| 初级用户 Posts 61 Credits 271 | |
|
Assembly is enough.
|
|
| Floor5 ldy810 | Posted 2005-10-07 21:59 |
| 新手上路 Posts 6 Credits 13 | |
|
I wrote a program that can find all PCI devices.
|
|
| Floor6 ldy810 | Posted 2005-10-10 14:48 |
| 新手上路 Posts 6 Credits 13 | |
|
The interrupt number for PCI BIOS is 0X1A. You can use it to access all PCI DEVICEs, but you need to know the DEVICE NUMBER, FUNCTION NUMBER, and VERNDOR ID. Use a FOR loop and search these addresses starting from 0.
|
|
| Floor7 fire314 | Posted 2005-12-27 13:15 |
| 新手上路 Posts 1 Credits 2 | |
| Floor8 jpzsj | Posted 2006-07-12 01:33 |
| 初级用户 Posts 26 Credits 43 | |
|
Give us an executable file.
|
|
| Floor9 firstsail | Posted 2006-07-12 12:14 |
| 高级用户 Posts 295 Credits 668 From 广东深圳 | |
|
Here is an example (run under Win98):
Advantech's PCI-1713 is a 32-channel PCI-bus AD card. The base address of a PCI bus card is assigned by the operating system, and multiple identical PCI cards can be inserted into one computer. Therefore, different computer hardware specs will cause the base address of the PCI card to vary. My system has two identical PCI-1713 cards installed. In order to obtain the base address of the PCI-1713, the program is as follows //Advantech PCI-1713 vendor code #define VENDOR_ADVANTECH 0x13FEL //Advantech PCI-1713 card device code #define DEVICE_ADVANTECH_PCI1713 0x1713L //Function: scan for PCI cards matching the specified format word, and return the base addresses of multiple PCI cards with the same format word. //Input parameter: dwFormat ---- the low 16 bits are the vendor code, the high 16 bits are the device code //Output parameter: pnBase1 ------ the first PCI card matching the specified format word //Output parameter: pnBase2 ------ the second PCI card matching the specified format word //Return value: true if found, otherwise FALSE BOOL ScanPCI_IO(DWORD dwFormat, int* pnBase1, int* pnBase2) { if (pnBase1 != NULL) *pnBase1 = NULL; if (pnBase2 != NULL) *pnBase2 = NULL; //i is the bus number for (char i = 0; i < 5; i++) { //j is the device number for(char j=0; j < 32; j++) { DWORD dwPCI = 0x80000000Lu + i * 0x10000Lu + (j * 8) * 0x100Lu; //the 0th double word DWORD dwPCI_Vendor = dwPCI | (0x0 * sizeof(DWORD)); ::_outpd(0xcf8, dwPCI_Vendor); DWORD dwDeviceAndVendor = ::_inpd(0xcfc); //check whether the vendor code and device code are the same if (dwDeviceAndVendor != dwFormat) { continue; } //analyze each base address for (int k = 0; k < 6; k++) { DWORD dwPCI_Base = (dwPCI | ((4 + k) * sizeof(DWORD))); ::_outpd(0xcf8, dwPCI_Base); DWORD dwBase = ::_inpd(0xcfc); BOOL bMem = !(dwBase & 0x1); dwBase &= 0xFFFFFFFEL; //I/O, the address must be valid if (!bMem && (dwBase != 0x0 && dwBase != 0xFFFFFFFEL)) { if (pnBase1 != NULL && *pnBase1 == 0) { *pnBase1 = (int)dwBase; if (pnBase2 == NULL) { return(TRUE); } } else if (pnBase2 != NULL && *pnBase2 == 0) { *pnBase2 = (int)dwBase; return(TRUE); } } } } } return(FALSE); } //Get the base address of the Advantech PCI-1713. //Function: scan for the base address of the Advantech PCI-1713 //Output parameter: pnBase1 ------ base address of the first PCI-1713 card //Output parameter: pnBase2 ------ base address of the second PCI-1713 card //Return value: true if found, otherwise FALSE BOOL ScanAdvantech_PCI1713(int* pnBase1, int* pnBase2) { return(::ScanPCI_IO(((DEVICE_ADVANTECH_PCI1713 << 16) | VENDOR_ADVANTECH), pnBase1, pnBase2)); } |
|
| Floor10 ITU | Posted 2009-12-02 03:15 |
| 中级用户 Posts 82 Credits 209 | |
|
fire314:
Originally posted by fire314 at 2005-12-27 13:15: When this program runs on some computers, it shows a lot of duplicate devices. Can this program be fixed? I just tested a computer with one onboard network card (interface not connected), plus one additional PCI network card installed. Both are 8139s. The test result is as follows: Index Bus. Dev. func. Vendor:Device DeviceType ---------------------------------------------------- 00 0 00 0 8086:2570 Bridge device 01 0 01 0 8086:2571 Bridge device 02 0 1D 0 8086:24D2 Serial bus controllers 03 0 1D 1 8086:24D4 Serial bus controllers 04 0 1D 2 8086:24D7 Serial bus controllers 05 0 1D 3 8086:24DE Serial bus controllers 06 0 1D 7 8086:24DD Serial bus controllers 07 0 1E 0 8086:244E Bridge device 08 0 1F 0 8086:24D0 Bridge device 09 0 1F 1 8086:24DB Mass Storage Controller 0A 0 1F 2 8086:24D1 Mass Storage Controller 0B 0 1F 3 8086:24D3 Serial bus controllers 0C 0 1F 5 8086:24D5 Mutimedia device 0D 1 00 0 1002:5159 Display Controller 0E 1 00 1 1002:5159 Display Controller 0F 1 00 2 1002:5159 Display Controller 10 1 00 3 1002:5159 Display Controller 11 1 00 4 1002:5159 Display Controller 12 1 00 5 1002:5159 Display Controller 13 1 00 6 1002:5159 Display Controller 14 1 00 7 1002:5159 Display Controller 15 2 01 0 104C:8024 Serial bus controllers 16 2 01 1 104C:8024 Serial bus controllers 17 2 01 2 104C:8024 Serial bus controllers 18 2 01 3 104C:8024 Serial bus controllers 19 2 01 4 104C:8024 Serial bus controllers 1A 2 01 5 104C:8024 Serial bus controllers 1B 2 01 6 104C:8024 Serial bus controllers 1C 2 01 7 104C:8024 Serial bus controllers 1D 2 02 0 10EC:8139 Network Controller 1E 2 09 0 10EC:8139 Network Controller 1F 2 09 1 10EC:8139 Network Controller 20 2 09 2 10EC:8139 Network Controller 21 2 09 3 10EC:8139 Network Controller 22 2 09 4 10EC:8139 Network Controller 23 2 09 5 10EC:8139 Network Controller 24 2 09 6 10EC:8139 Network Controller 25 2 09 7 10EC:8139 Network Controller There are far too many network card entries in it, but in fact there should only be two network cards. I also tested with other testing tools, and their results were all fine. So I think this should be a problem with this program. Because after compiling it is only 1.5K, much smaller than similar software, I very strongly hope this program issue can be fixed. Thanks! Also attaching the test results from other tools on the same computer: As follows: 1. The result tested with PCILIST.EXE is: =============================================== PC/AT PCI device list Version 1.36 Copyright(C) 2003-09 傑傝傕 PCI BIOS Version 2.10, Last bus number(BIOS)=2, Configuration mechanism #1 Bus Dev Func Class Vendor IRQ INT B/M P/E I/O MEM MWI SER PED DPD SED CL : PCI--HOST Intel -- Yes No No Yes No No - - - - : GFX bridge Intel -- Yes No Yes Yes No Yes - - - - :: USB Intel 12 Yes No Yes No No No - - - - :: USB Intel 3 Yes No Yes No No No - - - - :: USB Intel 11 Yes No Yes No No No - - - - :: USB Intel 12 Yes No Yes No No No - - - - :: USB 2.0 Intel 5 Yes No No Yes No No - - - - : LPC bridge Intel -- Yes No Yes Yes No Yes - - - - :: PCI--ISA Intel -- Yes No Yes Yes No No - - - - :: IDE ctrl. Intel -- Yes No Yes Yes No No - - - - :: IDE ctrl. Intel 11 Yes No Yes No No No - - - - :: SM bus Intel 10 No No Yes No No No - - - - :: MM-AUDIO Intel 10 Yes No Yes Yes No No - - - - : VGA-VIDEO ATI ** Yes No Yes Yes No No - - - 8 : IEEE1394 Texas Ins 10 Yes No No Yes No No - - - 8 : EtherNet RealTEK 11 Yes No Yes Yes No No - - - - : EtherNet RealTEK 10 Yes No Yes Yes No No - - - - =============================================== 2. The result tested with PCISCAN.EXE is: =============================================== Bus Dev Func Slot Vend Dev. Class Name Subclass Name ---------------------------------------------------------------- 0 0 0 0 8086 2570 Bridge CPU/PCI 0 1 0 1 8086 2571 Bridge PCI/PCI 0 1D 0 1D 8086 24D2 Serial Bus USB 0 1D 1 1D 8086 24D4 Serial Bus USB 0 1E 0 1E 8086 244E Bridge PCI/PCI 0 1F 0 1F 8086 24D0 Bridge PCI/ISA 0 1F 1 1F 8086 24DB Disk IDE 1 0 0 20 1002 5159 Display VGA 2 1 0 41 104C 8024 Serial Bus Firewire 2 2 0 42 10EC 8139 Network Ethernet 2 9 0 49 10EC 8139 Network Ethernet 11 PCI devices found 3. The result tested with PCISLEEP.EXE is: =============================================== PCI BIOS version 2.10, highest bus number is 2. bus.device(.function) classcode(/iface) vendor class BusDevf vend:type class vendor description... ----------------------------------------------------------------------------- 00.00 8086:2570 0600 Intel CPU host bridge 00.01 8086:2571 0604 Intel PCI bridge 00.1d.0 8086:24d2 0c03 Intel USB controller 00.1d.1 8086:24d4 0c03 Intel USB controller 00.1d.2 8086:24d7 0c03 Intel USB controller 00.1d.3 8086:24de 0c03 Intel USB controller 00.1d.7 8086:24dd 0c03/20 Intel USB controller 00.1e 8086:244e 0604 Intel PCI bridge 00.1f.0 8086:24d0 0601 Intel ISA bridge 00.1f.1 8086:24db 0101/8a Intel IDE controller 00.1f.2 8086:24d1 0101/8f Intel IDE controller 00.1f.3 8086:24d3 0c05 Intel SMBus controller 00.1f.5 8086:24d5 0401 Intel audio 01.00 1002:5159 0300 ATI VGA graphics 02.01 104c:8024 0c00/10 TI FireWire IEEE1394 02.02 10ec:8139 0200 Realtek LAN / Ethernet 02.09 10ec:8139 0200 Realtek LAN / Ethernet PCI Scan done. =============================================== [ Last edited by ITU on 2009-12-2 at 03:23 ] |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |