feat: moved all required prints to printf

This commit is contained in:
2021-02-06 17:04:32 +01:00
parent 7ff33d611c
commit 9440fae968
4 changed files with 39 additions and 61 deletions

View File

@@ -7,9 +7,8 @@
#include <types.h>
#include <drivers/ports.h>
#include <libc/libc.h>
#include <kprint.h>
#include <libk.h>
#include <libc/kprintf.h>
#define PCI_CONFIG_ENABLE (1 << 31)
@@ -96,18 +95,6 @@ u8 pci_get_header_type(u8 bus, u8 slot, u8 func) {
return pci_config_read_byte(bus, slot, func, PCI_CONFIG_HEADER_TYPE);
}
void print_u8(u8 val) {
char buf[3];
itoa(val, buf, 16);
kprint(buf);
}
void print_u16(u16 val) {
char buf[5];
itoa(val, buf, 16);
kprint(buf);
}
void pci_pick_driver(pci_device *device) {
for (int i = 0; i < MAX_PCI_DRIVERS; ++i) {
if (pci_drivers[i] == NULL) {
@@ -198,32 +185,11 @@ void pci_init_drivers() {
void pci_print_info() {
for (int i = 0; i < last_pci_device_index; ++i) {
kprint("PCI BSF: ");
print_u8(pci_devices[i].bus);
kprint("/");
print_u8(pci_devices[i].slot);
kprint("/");
print_u8(pci_devices[i].func);
kprint(", Class/Sub/If: ");
print_u8(pci_devices[i].class);
kprint("/");
print_u8(pci_devices[i].subclass);
kprint("/");
print_u8(pci_devices[i].programInterface);
kprint(", V/D: ");
print_u16(pci_devices[i].vendorId);
kprint("/");
print_u16(pci_devices[i].deviceId);
kprint(" driver_info: ");
if (pci_devices[i].pci_driver == NULL) {
kprint("NULL");
} else {
kprint(pci_devices[i].pci_driver->name);
}
kprint("\n");
printf("PCI BSF: %2x/%2x/%2x, CSI: %2x/%2x/%2x, V/D: %4x/%4x, driver: %s\n",
pci_devices[i].bus, pci_devices[i].slot, pci_devices[i].func,
pci_devices[i].class, pci_devices[i].subclass, pci_devices[i].programInterface,
pci_devices[i].vendorId, pci_devices[i].deviceId,
(pci_devices[i].pci_driver == NULL ? "none" : pci_devices[i].pci_driver->name));
}
}