diff options
author | Anton Kling <anton@kling.gg> | 2023-11-10 15:47:08 +0100 |
---|---|---|
committer | Anton Kling <anton@kling.gg> | 2023-11-10 15:47:08 +0100 |
commit | 9a1f977e39d8e9fcb6a9cb2a612f4743e802221d (patch) | |
tree | 1fc53f6e80eb40d24274f2f8967d584b88c6d664 /kernel/drivers/pci.c | |
parent | 0cb4afef6da5488a128e5aaece435e9aa5f5797e (diff) |
Kernel Style: Change uint*_t -> u*
Diffstat (limited to 'kernel/drivers/pci.c')
-rw-r--r-- | kernel/drivers/pci.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/kernel/drivers/pci.c b/kernel/drivers/pci.c index 5fe14bd..f73b341 100644 --- a/kernel/drivers/pci.c +++ b/kernel/drivers/pci.c @@ -6,39 +6,39 @@ #define CONFIG_ADDRESS 0xCF8 #define CONFIG_DATA 0xCFC -void pci_config_write32(const struct PCI_DEVICE *device, uint8_t func, - uint8_t offset, uint32_t data) { - uint32_t address; - uint32_t lbus = (uint32_t)device->bus; - uint32_t lslot = (uint32_t)device->slot; - uint32_t lfunc = (uint32_t)func; +void pci_config_write32(const struct PCI_DEVICE *device, u8 func, + u8 offset, u32 data) { + u32 address; + u32 lbus = (u32)device->bus; + u32 lslot = (u32)device->slot; + u32 lfunc = (u32)func; // Create configuration address as per Figure 1 - address = (uint32_t)((lbus << 16) | (lslot << 11) | (lfunc << 8) | - (offset & 0xFC) | ((uint32_t)0x80000000)); + address = (u32)((lbus << 16) | (lslot << 11) | (lfunc << 8) | + (offset & 0xFC) | ((u32)0x80000000)); // Write out the address outl(CONFIG_ADDRESS, address); outl(CONFIG_DATA, data); } -uint32_t pci_config_read32(const struct PCI_DEVICE *device, uint8_t func, - uint8_t offset) { - uint32_t address; - uint32_t lbus = (uint32_t)device->bus; - uint32_t lslot = (uint32_t)device->slot; - uint32_t lfunc = (uint32_t)func; +u32 pci_config_read32(const struct PCI_DEVICE *device, u8 func, + u8 offset) { + u32 address; + u32 lbus = (u32)device->bus; + u32 lslot = (u32)device->slot; + u32 lfunc = (u32)func; // Create configuration address as per Figure 1 - address = (uint32_t)((lbus << 16) | (lslot << 11) | (lfunc << 8) | - (offset & 0xFC) | ((uint32_t)0x80000000)); + address = (u32)((lbus << 16) | (lslot << 11) | (lfunc << 8) | + (offset & 0xFC) | ((u32)0x80000000)); // Write out the address outl(CONFIG_ADDRESS, address); return inl(CONFIG_DATA); } -int pci_populate_device_struct(uint16_t vendor, uint16_t device, +int pci_populate_device_struct(u16 vendor, u16 device, struct PCI_DEVICE *pci_device) { pci_device->vendor = vendor; pci_device->device = device; @@ -48,14 +48,14 @@ int pci_populate_device_struct(uint16_t vendor, uint16_t device, struct PCI_DEVICE tmp; tmp.bus = bus; tmp.slot = slot; - uint32_t device_vendor = pci_config_read32(&tmp, 0, 0); + u32 device_vendor = pci_config_read32(&tmp, 0, 0); if (vendor != (device_vendor & 0xFFFF)) continue; if (device != (device_vendor >> 16)) continue; pci_device->bus = bus; pci_device->slot = slot; - uint32_t bar0 = pci_config_read32(pci_device, 0, 0x10); + u32 bar0 = pci_config_read32(pci_device, 0, 0x10); assert(bar0 & 0x1 && "Only support memory IO"); pci_device->gen.base_mem_io = bar0 & (~0x3); return 1; @@ -64,6 +64,6 @@ int pci_populate_device_struct(uint16_t vendor, uint16_t device, return 0; } -uint8_t pci_get_interrupt_line(const struct PCI_DEVICE *device) { +u8 pci_get_interrupt_line(const struct PCI_DEVICE *device) { return pci_config_read32(device, 0, 0x3C) & 0xFF; } |