Informations regarding PCIe devices
Posted: Sat Aug 03, 2024 3:42 pm
Hello,
I went back to OS developing after a long break, and I'm currently working on a little OS for fun. For context, the OS is meant to be booted on an EFI machine with x86_64. I've got my loader working, mapping the address space and everything and created a (currently empty) kernel that just sets up a GDT.
I recently decided to go back to my loader to add new features, especially those regarding ACPI and PCIe. I know that in order to easily find where the PCIe ECAM structure is located I have to first find the MCFG table in the ACPI tables. I did this and it works fine.
Now here are my two questions:
I went back to OS developing after a long break, and I'm currently working on a little OS for fun. For context, the OS is meant to be booted on an EFI machine with x86_64. I've got my loader working, mapping the address space and everything and created a (currently empty) kernel that just sets up a GDT.
I recently decided to go back to my loader to add new features, especially those regarding ACPI and PCIe. I know that in order to easily find where the PCIe ECAM structure is located I have to first find the MCFG table in the ACPI tables. I did this and it works fine.
Now here are my two questions:
- When I enumerate the PCIe devices from the Host PCI Bridge (using QEMU by the way), I find a lot of devices, but no CPU is to be found... However, according to the PCI specification, there is a Base Class Code (0x0B) reserved for all kinds of processors. Is it normal I can't find the single CPU (not using SMP yet) running the QEMU VM in the PCIe devices?
This is the list of devices I managed to enumerate: https://imgur.com/a/JSdw1Hs.
- The MCFG tables I'm working with right now only have one field (covering every bus in the PCI Segment Group 0), so I use the base address of this field as an absolute physical address as specified by the specification (recall this field covers bus 0). But what happens when I have more fields, especially with some covering only a part of the buses (let's say one from 0x00 to 0x7F and another one covering 0x80 to 0xFF). If I understood the specification correctly, the base address of the second field would be relative to the one contained in the field covering bus 0, is this right?
What happens when more PCI Segment groups are present?
To be more precise, this is what I don't understand: https://imgur.com/a/f0ID7nI.