Hi all,

I'm pretty new to this mailing list, so please bear with me if this is a dumb 
question... I'm trying to enumerate all PCI devices from inside vb. I do this 
by testing bus 0-255, device 0-31. If the device has a vendor ID != 0xFFFFFFFF 
I try function 0-7. I access the PCI config data by writing and reading ports 
0xcf8 and 0xcfc. This works on bochs, QEMU and Virtual PC - but not in VB. Why?

Does anyone have an idea what might be going wrong?

What additional info would be useful?



(Hopefully) Relevant parts of the codes follow:
--------------------------------------------------------------------------------------------------------
const
  PCI_ADR_REG=$cf8;
  PCI_DATA_REG=$cfc;
  PCI_ENABLE=$80000000;

function readb(bus,dev,func,reg:byte):byte;
begin
  outportl(PCI_ADR_REG,PCI_ENABLE or (longint(bus) shl 16) or (longint(dev) shl 
11)
                                  or (longint(func) shl 8) or longint(reg));
  readb:=inportb(PCI_DATA_REG+(reg and 3));
end;

function readl(bus,dev,func,reg:byte):longint;
begin
  outportl(PCI_ADR_REG,PCI_ENABLE or (longint(bus) shl 16) or (longint(dev) shl 
11)
                                  or (longint(func) shl 8) or longint(reg));
  readl:=inportl(PCI_DATA_REG);
end;

function findpcidevice(d:tdevice)
var
  id:longword;
begin
  id:=readl(d.bus,d.dev,d.func,0);
  if (readb(d.bus,d.dev,d.func,$0)<>$ff) or (readb(d.bus,d.dev,d.func,$1)<>$ff) 
then begin
    if (id<>$FFFFFFFF) and (id<>$0) then begin
      //PCI device found, do useful stuff here
      ...
--------------------------------------------------------------------------------------------------------


Simon

_______________________________________________
vbox-users mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-users

Reply via email to