forked from AbleOS/ableos
my changes and then boom
This commit is contained in:
parent
7a256dde68
commit
f5f68bc2df
|
@ -22,7 +22,12 @@ get_ids := fn(bus: u8, device: u8, function: u8): PCI_ID {
|
||||||
}
|
}
|
||||||
|
|
||||||
PciDeviceInfo := struct {
|
PciDeviceInfo := struct {
|
||||||
pci_id: PCI_ID,
|
header_type: u8,
|
||||||
|
device: u8,
|
||||||
|
bus: u8,
|
||||||
|
device_id: PCI_ID,
|
||||||
|
class: u16,
|
||||||
|
rev_id: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
calculate_address := fn(bus: u8, device: u8, function: u8, offset: u8): int {
|
calculate_address := fn(bus: u8, device: u8, function: u8, offset: u8): int {
|
||||||
|
@ -34,6 +39,14 @@ calculate_address := fn(bus: u8, device: u8, function: u8, offset: u8): int {
|
||||||
return address
|
return address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_header_type := fn(bus: u8, device: u8, function: u8): u8 {
|
||||||
|
res := config_read32(bus, device, function, 0xC)
|
||||||
|
ret := res >> 16
|
||||||
|
ret &= 0xFF
|
||||||
|
|
||||||
|
return ret
|
||||||
|
}
|
||||||
|
|
||||||
check_device := fn(bus: u8, device: u8): PciDeviceInfo {
|
check_device := fn(bus: u8, device: u8): PciDeviceInfo {
|
||||||
pci_id := get_ids(bus, device, 0)
|
pci_id := get_ids(bus, device, 0)
|
||||||
|
|
||||||
|
@ -42,16 +55,15 @@ check_device := fn(bus: u8, device: u8): PciDeviceInfo {
|
||||||
} else {
|
} else {
|
||||||
stn.log.info(":)\0")
|
stn.log.info(":)\0")
|
||||||
}
|
}
|
||||||
|
|
||||||
address := calculate_address(bus, device, 0, 0x8)
|
address := calculate_address(bus, device, 0, 0x8)
|
||||||
reg2 := config_read32(bus, device, 0, 0x8)
|
reg2 := config_read32(bus, device, 0, 0x8)
|
||||||
|
|
||||||
class := reg2 >> 16 & 0xFFFF
|
class := reg2 >> 16 & 0xFFFF
|
||||||
b := "\0\0\0\0\0\0\0"
|
|
||||||
|
|
||||||
string.display_int(class, b)
|
header_type := get_header_type(bus, device, 0)
|
||||||
stn.log.info(b)
|
|
||||||
|
|
||||||
return PciDeviceInfo.(pci_id)
|
rev_id := reg2 & 0xFF
|
||||||
|
return PciDeviceInfo.(header_type, device, bus, pci_id, class, rev_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): PCI_ID {
|
find_device := fn(vendor_id: int, device_id: int, pci_address: PCIAddress): PCI_ID {
|
||||||
|
|
Loading…
Reference in a new issue