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

@@ -10,8 +10,8 @@
#include <drivers/pci.h>
#include <libc/stdbool.h>
#include <libk.h>
#include <libc/libc.h>
#include <cpu/timer.h>
#include <libc/kprintf.h>
#define ATA_SR_BSY 0x80 // Busy
#define ATA_SR_DRDY 0x40 // Drive ready
@@ -299,14 +299,10 @@ unsigned char ide_print_error(unsigned int drive, unsigned char err) {
kprint("- Write Protected\n ");
err = 8;
}
kprint(" - [");
kprint((const char *[]) {"Primary", "Secondary"}[ide_devices[drive].channel]);
kprint(" ");
kprint((const char *[]) {"Master", "Slave"}[ide_devices[drive].drive]);
kprint("] ");
kprint(&ide_devices[drive].model);
kprint("\n");
printf(" - [%s %s] %s\n",
((const char *[]) {"Primary", "Secondary"}[ide_devices[drive].channel]),
((const char *[]) {"Master", "Slave"}[ide_devices[drive].drive]),
&ide_devices[drive].model);
return err;
}
@@ -472,21 +468,21 @@ u8 ide_pci_initialize(pci_device *device) {
count++;
}
// 4- Print Summary:
return PCI_INIT_OK;
}
void ide_print_devices() {
for (int i = 0; i < 4; i++) {
if (ide_devices[i].reserved == 1) {
char tmp[64];
itoa(ide_devices[i].size / 1024 / 2, tmp, 10);
kprint("Found ");
kprint((const char *[]) {"ATA", "ATAPI"}[ide_devices[i].type]);
kprint(" Drive ");
kprint(tmp);
kprint("MB - ");
kprint(ide_devices[i].model);
kprint("\n");
printf("Drive %d: %s Drive %dMB - %s\n",
i,
((const char *[]) {"ATA", "ATAPI"}[ide_devices[i].type]),
ide_devices[i].size / 1024 / 2,
ide_devices[i].model);
} else {
printf("Drive %d disconnected\n", i);
}
}
return PCI_INIT_OK;
}
void ide_register() {
@@ -587,7 +583,7 @@ u8 ide_read_ata_access(u8 direction, u8 drive, u32 lba, u8 numsects, void *targe
// if (lba_mode == 2 && dma == 1 && direction == 1) cmd = ATA_CMD_WRITE_DMA_EXT;
ide_write(channel, ATA_REG_COMMAND, cmd); // Send the Command.
void* cur_addr = target;
void *cur_addr = target;
// read response
if (dma) {
if (direction == 0);