aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/fs/ata.c
diff options
context:
space:
mode:
authorMarvin Borner2020-04-15 21:17:41 +0200
committerMarvin Borner2020-04-15 21:17:41 +0200
commite07894d21a0101b10ee6ad851773b725cbb9150d (patch)
tree75631b318a9403395fbb3b40abdade8a475cd30b /src/kernel/fs/ata.c
parentaa3d1b4689e6dadd982fe1e5ca8af69ca39c617d (diff)
Used macro magic to implement function-based logs
Diffstat (limited to 'src/kernel/fs/ata.c')
-rw-r--r--src/kernel/fs/ata.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/kernel/fs/ata.c b/src/kernel/fs/ata.c
index 52d1040..952261f 100644
--- a/src/kernel/fs/ata.c
+++ b/src/kernel/fs/ata.c
@@ -3,6 +3,7 @@
#include <kernel/fs/ata.h>
#include <kernel/lib/lib.h>
#include <kernel/lib/stdlib.h>
+#include <kernel/lib/stdio.h>
#include <kernel/memory/alloc.h>
#include <kernel/pci/pci.h>
#include <kernel/interrupts/interrupts.h>
@@ -239,14 +240,14 @@ void ata_device_detect(ata_dev_t *dev, int primary)
outb(dev->command, COMMAND_IDENTIFY);
if (!inb(dev->status)) {
- log("ata_detect_device: device does not exist");
+ log("Device does not exist");
return;
}
uint8_t lba_lo = inb(dev->lba_lo);
uint8_t lba_hi = inb(dev->lba_high);
if (lba_lo != 0 || lba_hi != 0) {
- log("ata_detect_device: not ata device");
+ log("Device is not ata-compatible");
return;
}
uint8_t drq = 0, err = 0;
@@ -255,7 +256,7 @@ void ata_device_detect(ata_dev_t *dev, int primary)
err = inb(dev->status) & STATUS_ERR;
}
if (err) {
- log("ata_detect_device: err when polling");
+ log("Error while polling");
return;
}
@@ -268,6 +269,7 @@ void ata_device_detect(ata_dev_t *dev, int primary)
pci_write_field(ata_device, PCI_COMMAND, pci_command_reg);
}
+ log("Detected drive: %d", dev->drive);
vfs_mount(dev->mountpoint, create_ata_device(dev));
}
@@ -279,7 +281,10 @@ void ata_find(uint32_t device, uint16_t vendor_id, uint16_t device_id, void *ext
void ata_init()
{
+ log("0x%x", ata_device);
pci_scan(&ata_find, -1, &ata_device);
+ serial_printf("0x%x - ", ata_device);
+ log("0x%x", ata_device);
irq_install_handler(32 + 14, ata_handler);