diff options
Diffstat (limited to 'src/kernel/pci/pci.c')
-rw-r--r-- | src/kernel/pci/pci.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/kernel/pci/pci.c b/src/kernel/pci/pci.c index 5a6f060..478a82d 100644 --- a/src/kernel/pci/pci.c +++ b/src/kernel/pci/pci.c @@ -17,10 +17,10 @@ uint32_t pci_read_field(uint32_t device, int field, int size) uint32_t t = inl(PCI_VALUE_PORT); return t; } else if (size == 2) { - uint16_t t = inw(PCI_VALUE_PORT + (field & 2)); + uint16_t t = inw((uint16_t) (PCI_VALUE_PORT + (field & 2))); return t; } else if (size == 1) { - uint8_t t = inb(PCI_VALUE_PORT + (field & 3)); + uint8_t t = inb((uint16_t) (PCI_VALUE_PORT + (field & 3))); return t; } return 0xFFFF; @@ -28,7 +28,7 @@ uint32_t pci_read_field(uint32_t device, int field, int size) uint16_t pci_find_type(uint32_t dev) { - return (pci_read_field(dev, PCI_CLASS, 1) << 8) | pci_read_field(dev, PCI_SUBCLASS, 1); + return (uint16_t) ((pci_read_field(dev, PCI_CLASS, 1) << 8) | pci_read_field(dev, PCI_SUBCLASS, 1)); } void pci_scan_hit(pci_func_t f, uint32_t dev, void *extra) @@ -36,7 +36,7 @@ void pci_scan_hit(pci_func_t f, uint32_t dev, void *extra) int dev_vend = (int) pci_read_field(dev, PCI_VENDOR_ID, 2); int dev_dvid = (int) pci_read_field(dev, PCI_DEVICE_ID, 2); - f(dev, dev_vend, dev_dvid, extra); + f(dev, (uint16_t) dev_vend, (uint16_t) dev_dvid, extra); } void pci_scan_func(pci_func_t f, int type, int bus, int slot, int func, void *extra) @@ -45,7 +45,7 @@ void pci_scan_func(pci_func_t f, int type, int bus, int slot, int func, void *ex if (type == -1 || type == pci_find_type(dev)) pci_scan_hit(f, dev, extra); if (pci_find_type(dev) == PCI_TYPE_BRIDGE) - pci_scan_bus(f, type, pci_read_field(dev, PCI_SECONDARY_BUS, 1), extra); + pci_scan_bus(f, type, (int) pci_read_field(dev, PCI_SECONDARY_BUS, 1), extra); } void pci_scan_slot(pci_func_t f, int type, int bus, int slot, void *extra) @@ -99,9 +99,9 @@ void pci_remap() pci_scan(&find_isa_bridge, -1, &pci_isa); if (pci_isa) { for (int i = 0; i < 4; ++i) { - pci_remaps[i] = pci_read_field(pci_isa, 0x60 + i, 1); + pci_remaps[i] = (uint8_t) pci_read_field(pci_isa, 0x60 + i, 1); if (pci_remaps[i] == 0x80) { - pci_remaps[i] = 10 + (i % 1); + pci_remaps[i] = (uint8_t) (10 + (i % 1)); } } uint32_t out = 0; @@ -115,16 +115,16 @@ int pci_get_interrupt(uint32_t device) if (pci_isa) { uint32_t irq_pin = pci_read_field(device, 0x3D, 1); if (irq_pin == 0) - return pci_read_field(device, PCI_INTERRUPT_LINE, 1); + return (int) pci_read_field(device, PCI_INTERRUPT_LINE, 1); int pirq = (int) (irq_pin + pci_extract_slot(device) - 2) % 4; - int int_line = pci_read_field(device, PCI_INTERRUPT_LINE, 1); + int int_line = (int) pci_read_field(device, PCI_INTERRUPT_LINE, 1); if (pci_remaps[pirq] >= 0x80) { if (int_line == 0xFF) { int_line = 10; - pci_write_field(device, PCI_INTERRUPT_LINE, 1, int_line); + pci_write_field(device, PCI_INTERRUPT_LINE, 1, (uint32_t) int_line); } - pci_remaps[pirq] = int_line; + pci_remaps[pirq] = (uint8_t) int_line; uint32_t out = 0; memcpy(&out, &pci_remaps, 4); pci_write_field(pci_isa, 0x60, 4, out); @@ -133,6 +133,6 @@ int pci_get_interrupt(uint32_t device) pci_write_field(device, PCI_INTERRUPT_LINE, 1, pci_remaps[pirq]); return pci_remaps[pirq]; } else { - return pci_read_field(device, PCI_INTERRUPT_LINE, 1); + return (int) pci_read_field(device, PCI_INTERRUPT_LINE, 1); } }
\ No newline at end of file |