Page 1 of 1
Getting the base IO address
Posted: Sun Feb 04, 2007 8:14 am
by flash
I've begun my os project for almost a year, and now it can run in user mode. But I recently got a puzzle, I found some code for reading the device port uses a mov instruction to change the memory. So that is called IO map. Who could tell me how to get those base addresses? Such as the base IO address of rtl8139 or usb.
Posted: Sun Feb 04, 2007 8:36 am
by PyroMathic
lo,
You need to enumerate the pci devices on the bus, if you do that, then you can easely get the Port-base adresses + the memory map base adresses and some other use-full things like the irq.
so just look for pci-enumeration examples.
Regards
PyroMathic
Posted: Sun Feb 04, 2007 9:06 am
by xsix
each PCI device has it's own 256byte size configuration space which you can read. Memory/IO addresses are named BARn (eg. BAR0 BAR1...). Read PCI related stuff, you just need to encode location of device(bus, device, function) send it to PCI and then send or read data to/from it, i have my own PCI minidriver with enumeration, if you want it i can post
Posted: Sun Feb 04, 2007 11:58 am
by flash
Is there a code for instance?
Just how to get the io base of pci?
Posted: Tue Feb 06, 2007 10:09 am
by flash
hi, now i have completed my PCI Driver, it can runs well now, and it can enumerate the pci devices on the machine. Yes, i also get some base address(memory&io space). But, i wonder how to use these base memories ?
At the moment, can i use a mov instruction to change those registers on the pci devices?