enumarating USB device
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
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.
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.
Learning a lot these days THANKS to OSdev users
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
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.
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);
}
}
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
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.
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.
Learning a lot these days THANKS to OSdev users
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.
C8H10N4O2 | #446691 | Trust the nodes.
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
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 ..
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 ..
Learning a lot these days THANKS to OSdev users
- CmpXchg
- Member
- Posts: 61
- Joined: Mon Apr 28, 2008 12:14 pm
- Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime
Naturally it takes place at bios level, and bios does it extremely well.naiksidd_85 wrote:you did not get my point I tried SMBIOS just to see if the PCI enumaration takes place at bios level...
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
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
- CmpXchg
- Member
- Posts: 61
- Joined: Mon Apr 28, 2008 12:14 pm
- Location: Petrozavodsk, Russia during school months, Vänersborg Sweden in the summertime
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...naiksidd_85 wrote:I might be wrong but isnt 1Ah used for system timer and clock services???
Every Man Must Learn David DeAngelo's Stuff, Period.
http://www.doubleyourdating.com/Catalog
http://www.doubleyourdating.com/Catalog
- naiksidd_85
- Member
- Posts: 76
- Joined: Thu Jan 17, 2008 1:15 am
Re: enumarating USB device
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.
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.
Learning a lot these days THANKS to OSdev users