PCI ?
Posted: Sun May 09, 2010 3:24 pm
Ok , I am trying to understand how the PCI bus works.
the os dev wiki is really helpful with this but I have just a few questions that I am confused about.
Question 1)
From my understanding PCI works like this
their is the configuration address register (at 0xCF8 ) and the configuration data register
(at 0xCFC)
the configuration address register is 32 bits long and by writing to it a specific value based on the spec's on the wiki
follows this format
After you write to the 0xCF8 address register with the info bus , device ,...etc info that you want to obtain from
Then you read from the data register at 0xCFC to get the info for that Bus , Device ,...etc that you wrote to 0xCF8
If their is no device their or anything then 0xCFC will return 0xFFFF.
But after those 2 examples on the osdev wiki they go to list a few configuration tables.
I have read that the tables should be 64 entries of 32bits
I know the 0xCF8 address register is 32bit's long but is the 0xCFC data register 256 bytes long?
Because I am having a hard time knowing how to access the fields in the 256 configuration space tables?
Is it just that the configuration whole 256byte table is return starting at port 0xCFC
And ending at DFC ( so to access any register or data values in the table all you would have to do is start at 0xCFC and read from an offset from that data register?)
If that is all it is then that would be easy.
For example to see if I got this correct if I want to read the values for the 3rd 32bit entry in the configuration table for a particular device
i.e
Class code Subclass Prog IF Revision ID
I would read a 32bit value starting at address 0xCFC + 0x08
tmp = SystemINLONG( 0xCFC + 0x08 ) ;
Thanks for any help
the os dev wiki is really helpful with this but I have just a few questions that I am confused about.
Question 1)
From my understanding PCI works like this
their is the configuration address register (at 0xCF8 ) and the configuration data register
(at 0xCFC)
the configuration address register is 32 bits long and by writing to it a specific value based on the spec's on the wiki
follows this format
Code: Select all
Enable Bit Reserved Bus Number Device Number Function Number Register Number 00
Then you read from the data register at 0xCFC to get the info for that Bus , Device ,...etc that you wrote to 0xCF8
If their is no device their or anything then 0xCFC will return 0xFFFF.
But after those 2 examples on the osdev wiki they go to list a few configuration tables.
I have read that the tables should be 64 entries of 32bits
I know the 0xCF8 address register is 32bit's long but is the 0xCFC data register 256 bytes long?
Because I am having a hard time knowing how to access the fields in the 256 configuration space tables?
Is it just that the configuration whole 256byte table is return starting at port 0xCFC
And ending at DFC ( so to access any register or data values in the table all you would have to do is start at 0xCFC and read from an offset from that data register?)
If that is all it is then that would be easy.
For example to see if I got this correct if I want to read the values for the 3rd 32bit entry in the configuration table for a particular device
i.e
Class code Subclass Prog IF Revision ID
I would read a 32bit value starting at address 0xCFC + 0x08
tmp = SystemINLONG( 0xCFC + 0x08 ) ;
Thanks for any help