Announcement

Collapse
No announcement yet.

Getting PCI info

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Tony Burcham
    replied
    I modified the PB code so it now also looks up vendors and
    device descriptions. I posted it on my website today.
    The url is http://www.gvii.net/tburcham/PCI.zip. The file
    contains the PB3.5 source and the freeware vendor database.

    Here's the modified code:

    '***** PCI.bas for PBDos 3.5 *****
    defint A-Z
    %FORCE32bit=&h66
    cls
    screen 0
    color 1,7

    for n = 1 to 25
    ? string$(80," ")
    next n

    ? string$(80,"*")
    color 4
    ? " This retrieves and displays information about PCI devices"
    ? "installed in the system it's run on."
    ? "From demo code modified by Tony Burcham: [email protected]"
    ? "I saw no indication of a copyright and my part is public domain"
    ? "as is 'PCIDEVS.TXT' according to its author."
    ? "For updates visit: <A HREF="http://members.hyperlink.net.au/~chart"" TARGET=_blank>http://members.hyperlink.net.au/~chart"</A>
    ? "Press any key to skip the 3-second delay between devices."
    ?

    color 1
    ? string$(80,"*")

    open "C:\PB\EXAMPLE\PCIDEVS.txt" for input as #1

    public V$
    public D$

    PCIpresent%=0
    LastPCIbus%=0
    PCIrev%=0
    PCImechanism%=0

    'get PCI system data
    !mov ax,&hb101
    !int &h1a
    !jnc zz
    !and ah,&hff
    !jnz xit
    zz:
    !db %FORCE32bit
    !cmp dx,&h20494350
    !jnz xit
    !mov PCImechanism%,al
    !mov PCIrev%,bx
    !mov LastPCIbus%,cl
    !mov ax,-1
    !mov PCIpresent%,ax
    xit:
    If PCIpresent% then
    color 15
    print "last bus number = ";LastPCIbus%
    print "PCI revision number = ";hex$(PCIrev%\256);".";hex$(PCIrev% and 255)
    if bit(PCImechanism%,0) then print "Configuration mechanism #1 supported"
    if bit(PCImechanism%,1) then print "Configuration mechanism #2 supported"
    if bit(PCImechanism%,4) then print "Special cycle supported via configuration mechanism #1"
    if bit(PCImechanism%,5) then print "Special cycle supported via configuration mechanism #2"

    else
    color 4
    print "PCI system not present"
    end if

    for bus%=0 to LastPCIbus%
    for func%=0 to 255
    flag%=0

    'get vendor ID
    !mov ax,&hb109 ;read PCI header
    !mov bh,bus% ;on this bus
    !mov bl,func% ;for this device
    !mov di,0 ;location 0 = vendor ID
    !int &h1a
    !jc fail
    !and ah,&hff
    !jnz fail
    !mov config%,cx
    !inc flag%
    fail:
    if flag% and config%<>&hffff then

    color 15
    print "bus";bus%;" device number";func%\8;" function";func% and 7;" vendor ID =";hex$(config%)
    V$ = Vendor$(config%)
    flag%=0

    'get device ID
    !mov ax,&hb109
    !mov bh,bus%
    !mov bl,func%
    !mov di,2 ;location 2 = device ID
    !int &h1a
    !jc fail2
    !and ah,&hff
    !jnz fail2
    !mov config%,cx
    !inc flag%
    fail2:

    color 15
    if flag% then print " device ID ="hex$(config%) else print
    D$ = Device$(config%)
    color 0
    ? V$
    color 2
    ? D$
    color 1
    ? string$(80,"*")
    sleep 3

    end if
    next
    next

    close 1
    end


    function Vendor(con as integer) as string
    seek #1, 1
    V$ = hex$(con)
    V$ = "V" & chr$(9) & right$("0000" & V$,4)

    while not eof(1)

    line input #1, F$

    if V$ = left$(F$,6) then
    if len(F$) > 7 then Vendor$ = right$(F$,len(F$) - 7)
    exit loop
    end if

    wend

    end function

    function Device(con as integer) as string
    D$ = hex$(con)
    D$ = "D" & chr$(9) & right$("0000" & D$,4)

    while not eof(1)

    line input #1, F$

    if D$ = left$(F$,6) then
    if len(F$) > 7 then Device$ = right$(F$,len(F$) - 7)
    exit loop
    end if

    wend

    end function


    'Tony.




    ------------------

    Leave a comment:


  • Rob de Jong
    Guest replied
    Guys, thanx a 1M. It was exactly what I needed. One more: how to find this info for a PCMCIA-card ?

    ------------------

    Leave a comment:


  • Sebastian Groeneveld
    replied
    Rob,

    There is a nice program written by Ralph Brown (yes, from the marvellous interrupt list)
    that obtains LOTS of information from PCI devices... and the great thing is, the source
    is included (a single C++ file)!

    You can find it at: http://www.cs.cmu.edu/~ralf/pub-files/rbpci119.zip

    And you might want to check out the other utils he wrote: http://www.cs.cmu.edu/~ralf/files.html

    Greetings,

    ------------------
    Sebastian Groeneveld
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Paul Dixon
    replied
    Rob,
    try the following. INT &h1a with ah=&hb1 is used to access the PCI system.

    Paul.

    Code:
    %FORCE32bit=&h66
    cls
    
    PCIpresent%=0
    LastPCIbus%=0
    PCIrev%=0
    PCImechanism%=0
    
    'get PCI system data
    !mov ax,&hb101
    !int &h1a
    
    !jnc zz
    !and ah,&hff
    !jnz xit
    
    zz:
    !db %FORCE32bit
    !cmp dx,&h20494350
    !jnz xit
    
    !mov PCImechanism%,al
    !mov PCIrev%,bx
    !mov LastPCIbus%,cl
    !mov ax,-1
    !mov PCIpresent%,ax
    
    xit:
    
    If PCIpresent% then
    
    print "last bus number = ";LastPCIbus%
    print "PCI revision number = ";hex$(PCIrev%\256);".";hex$(PCIrev% and 255)
    
    if bit(PCImechanism%,0) then print "Configuration mechanism #1 supported"
    if bit(PCImechanism%,1) then print "Configuration mechanism #2 supported"
    if bit(PCImechanism%,4) then print "Special cycle supported via configuration mechanism #1"
    if bit(PCImechanism%,5) then print "Special cycle supported via configuration mechanism #2"
    
    
    else
    print "PCI system not present"
    end if
    
    for bus%=0 to LastPCIbus%
    for func%=0 to 255
    flag%=0
    
    'get vendor ID
    !mov ax,&hb109    ;read PCI headre
    !mov bh,bus%      ;on this bus
    !mov bl,func%     ;for this device
    !mov di,0         ;location 0 = vendor ID
    
    !int &h1a
    
    !jc fail
    !and ah,&hff
    !jnz fail
    
    !mov config%,cx
    !inc flag%
    
    fail:
    
    if flag% and config%<>&hffff then
    print "bus ";bus%;" device number ";func%\8;" function ";func% and 7;"vendor ID=";hex$(config%);
    
    
    flag%=0
    
    'get device ID
    !mov ax,&hb109
    !mov bh,bus%
    !mov bl,func%
    !mov di,2        ;location 2 = device ID
    
    !int &h1a
    
    !jc fail2
    !and ah,&hff
    !jnz fail2
    
    !mov config%,cx
    !inc flag%
    fail2:
    
    if flag% then print " device ID ="hex$(config%) else print
    
    end if
    
    next
    next

    Leave a comment:


  • Rob de Jong
    Guest started a topic Getting PCI info

    Getting PCI info

    I'm trying to find a way to enumerate PCI devices in a PC. I'm looking for the vendor ID and the device ID strings of the PCI devices (in particular the network card). Any ideas ? Would int 1A with ax=B401 do the trick ?

    ------------------
Working...
X