PCI set-up

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

PCI set-up

Post by xsix »

There are devices plugged into the pci slots. So when POST starts it assigns memory ant I/O addresses to them automatically? so if some_card information says that BAR0 is address where i should write into, so i read BAR0 value from that device and just do IN and OUT instructions with it(of course if it is I/O address) ?
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re: PCI set-up

Post by Candy »

xsix wrote:There are devices plugged into the pci slots. So when POST starts it assigns memory ant I/O addresses to them automatically? so if some_card information says that BAR0 is address where i should write into, so i read BAR0 value from that device and just do IN and OUT instructions with it(of course if it is I/O address) ?
If all is initialized, you just use the addresses as mentioned in the BARs. If it's not, you set them, recursively, to available locations. You determine how big the BAR is by setting it to all ones and determining the bits that can't be set (that's the size). You always assign it an aligned address. Bridges get the entire range of the devices that are attached to them, plus any for their own BAR's (if applicable). You set/read all this using PCI configuration space, which you access using the PCI registers which are fixed in IO space.

If you ever make such a ****up that you map some IO space on top of the PCI configuration space, your computer is probably ready for the scrapheap. You might want to watch out with that ;).
Post Reply