Getting the base IO address

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.
Post Reply
flash
Member
Member
Posts: 29
Joined: Sun Feb 04, 2007 6:33 am

Getting the base IO address

Post 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.
PyroMathic
Member
Member
Posts: 33
Joined: Wed Apr 26, 2006 11:00 pm

Post 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
xsix
Member
Member
Posts: 59
Joined: Tue Oct 24, 2006 10:52 am

Post 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
flash
Member
Member
Posts: 29
Joined: Sun Feb 04, 2007 6:33 am

Post by flash »

Is there a code for instance?
Just how to get the io base of pci?
flash
Member
Member
Posts: 29
Joined: Sun Feb 04, 2007 6:33 am

Post 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?
Post Reply