Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
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.
What on the PCI page is it that you don't understand?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
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.
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);
}
}
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
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.
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.
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 ..
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).
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...
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.