We managed till Keyboard and mouse, which I had exp. w earlier, now moving on to PCI, I will make notes
-
Has 8 busses. (3 bits)
-
Every bus can have upto 32 devices. (5 bits)
-
Every device can have upto 8 function. (3 bits)
Classic ecamples, sound card has two functions, audio capture device and audio output device (OG sound card)
-
We will query in the following format: "What is Y device on X bus" We will get two 32 bit integers as answer,
- uint32_t vendor_id -> Smaller vendors share ids,
- uint32_t device_id
- Metadata:
- uint16_t class_id,
- uint16_t subclass_id
Till now we used hardcoded addresses, but now we will assign various addresses to various ports. This is the solution for having multiple devices of same types, like having 2 keyboards.
- I/O type Base Address Registers
- Last two bits have to be set to 1 (includes LSB).
- Hence port number has to be a multiple of 4.s a kind of hardware restriction.
- Memory Mapping Base Address Registers
- There are specific memory locations for reading and writing data.
- LSB = 0
- Prefetchable bit -> OS might prefetch some locations of hard disk, but not keys strokes
- The middle two bits indicate the length of BAR(Base Address Register)
- 00 -> 32 Bit BAR
- 01 -> 20 Bit BAR
- 10 -> 64 Bit BAR

