Commit 990cdff2 by triazo

Move print stuff into seperate function

parent 9fc85493
Showing with 30 additions and 16 deletions
......@@ -6,6 +6,36 @@
#include "pci.h"
#include "serial.h"
void pciSerialInfo(bus, device, function, offset)
{
uint32_t address;
uint32_t lbus = (uint32_t)bus;
uint32_t lslot = (uint32_t)slot;
uint32_t lfunc = (uint32_t)func;
address = (uint32_t)((lbus << 16) |
(lslot << 11) |
(lfunc << 8) |
(offset & 0xfc) |
((uint32_t)0x80000000));
outl(PCI_CONFIG_ACCESS, address);
uint32_t data = inl(PCI_CONFIG_DATA);
serial_writestring("address 0x");
serial_hexword(address);
serial_writestring(" returned 0x");
serial_hexword(data);
serial_writestring(" on bus ");
serial_hexbyte(bus);
serial_writestring(" device ");
serial_hexbyte(slot);
serial_writestring(" function ");
serial_hexbyte(func);
serial_writestring(" with offset ");
serial_hexbyte(offset);
serial_writechar('\n');
}
// reads a word from the io port using the pci addressing scheme
uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offset)
{
......@@ -23,22 +53,6 @@ uint32_t pciConfigReadWord(uint8_t bus, uint8_t slot, uint8_t func, uint8_t offs
// return the contents of the address clipped
uint32_t data = inl(PCI_CONFIG_DATA);
if (data != -1)
{
serial_writestring("address 0x");
serial_hexword(address);
serial_writestring(" returned 0x");
serial_hexword(data);
serial_writestring(" on bus ");
serial_hexbyte(bus);
serial_writestring(" device ");
serial_hexbyte(slot);
serial_writestring(" function ");
serial_hexbyte(func);
serial_writestring(" with offset ");
serial_hexbyte(offset);
serial_writechar('\n');
}
return data;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment