Page 2 of 2

Posted: Tue Jun 10, 2008 12:06 am
by naiksidd_85
hi,

I read the wiki for enumarating the PCI but in vain.
I am not able find how exactly it needs to be done.
What i am looking forward to is to just detect the presence of USB host controller.

I have checked with the code that reads the SMBIOS tables, it does detect USB device. This means that BIOS enumerates PCI bus, now I am trying to check actually how do i do it.

If any one has any idea pls help me out. :(

Posted: Tue Jun 10, 2008 2:37 am
by Combuster
What on the PCI page is it that you don't understand?

Posted: Tue Jun 10, 2008 6:03 am
by naiksidd_85
i tried reading the the address 0xcf8 to 0xcfc and beyond but the values there are zero...

Posted: Tue Jun 10, 2008 10:07 am
by Combuster
Well then

outs to 0xCF8 lets you choose a device and a register on that device (see the table on that page) You'll have to choose the device and register of your liking, then read 0xCFC to get the contents of that register.

Code: Select all

dword value;
for (int i = 0; i < 32; i++)
{
    out32 (0xCF8, (i << 11) | 0x80000000);
    value = in32(0xCFC);
    if (value != 0xffffffff && value != 0)
    {
        printf("Device found in slot %i: %x\r\n", i, value);
    }
}

Posted: Wed Jun 11, 2008 2:07 am
by naiksidd_85
hey thanks now am able to read the values

Posted: Wed Jun 11, 2008 4:00 am
by CmpXchg
naiksidd_85 wrote:I have checked with the code that reads the SMBIOS tables, it does detect USB device. This means that BIOS enumerates PCI bus, ... .
How exactly do you do this?

Posted: Wed Jun 11, 2008 5:01 am
by naiksidd_85
I just scan for the string _SM_ in memory range f0000 to fffff on 16 bit boundry.

on encountering the anchor string jump to offset 18h where we have the 4 byte address of location of the SMBIOS structures.
just read the structures and you get all the information of the hardware connected to your machine.

Posted: Wed Jun 11, 2008 1:30 pm
by Alboin
I don't know if you care, but the SMBIOS is for 'maintenance purposes'. To quote Brendan in a previous thread:
SMBIOS is designed for hardware maintenance purposes - e.g. creating a catalogue of hardware on your LAN so you can keep track of it all for spare parts, upgrades, insurance, etc. ACPI, MPS, PCI, PnP, etc are designed for software to use for hardware detection and configuration. I wouldn't use SMBIOS for hardware detection and configuration, and I wouldn't use ACPI, MPS, PCI, PnP, etc for hardware maintenance purposes.

Posted: Wed Jun 11, 2008 10:30 pm
by naiksidd_85
you did not get my point I tried SMBIOS just to see if the PCI enumaration takes place at bios level.
If Bios can enumerate PCI the will be a small footprint of the code that we execute in real mode this is just my way of information gathering surely there are better ways of doing it ..

Posted: Thu Jun 12, 2008 5:20 am
by CmpXchg
naiksidd_85 wrote:you did not get my point I tried SMBIOS just to see if the PCI enumaration takes place at bios level...
Naturally it takes place at bios level, and bios does it extremely well.

I'm now thinking if I should use ports 0CF8h-0CFFh for PCI enumaration, or should I call BIOS for it? This call is available even in protected mode (it's INT 1Ah, if I'm not much mistaken).

Posted: Fri Jun 13, 2008 12:20 am
by naiksidd_85
I might be wrong but isnt 1Ah used for system timer and clock services???
:?:

Posted: Fri Jun 13, 2008 10:40 am
by CmpXchg
naiksidd_85 wrote:I might be wrong but isnt 1Ah used for system timer and clock services???
:?:
Oh yes. The timing functions are AH=00h-0Fh while PCIBIOS covers AX=0B101h-0B10Fh and also AX=0B181h-0B18Fh. The latter seem to be 32-bit, so they are probably available in protected mode. I should try to test it from under DOS...

Re: enumarating USB device

Posted: Sun Jun 22, 2008 10:30 pm
by naiksidd_85
sorry for going off topic is past few posts also i was away from the PC as I was suffering from conjunctivitis and was not able to sit for long hours..
starting the work again ...
am still not able to read the BARS properly. need to do a lot more reading hopefully i may get some thing out of it. [-o<