Store a List of discovered PCI devices

This commit is contained in:
Josh Holtrop 2023-10-24 08:49:11 -04:00
parent 757f8f8c65
commit d86bf47211

View File

@ -10,6 +10,7 @@ import hulk.hurl.a1;
import hulk.range;
import hulk.usb.xhci;
import hulk.acpi;
import hulk.list;
struct Pci
{
@ -196,6 +197,11 @@ struct Pci
}
}
/**
* Store a list of discovered PCI devices.
*/
public static __gshared List!Device devices;
private static uint read_config_register(Address address, uint register_id)
{
uint cfg_addr = 0x8000_0000u |
@ -361,6 +367,7 @@ struct Pci
if (config.vendor_id != 0xFFFFu)
{
Device * device = A1.allocate!Device();
devices.add(device);
device.initialize(Address(bus_nr, device_nr, function_nr), config);
if (device.multifunction)
{