summaryrefslogtreecommitdiff
path: root/src/kernel/ide.c
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-13 03:19:57 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-13 03:19:57 -0400
commit1e4a254674f668839e5de273916024c16814b045 (patch)
tree6774f4d4398a29c4aafb4120070975d864ffcde4 /src/kernel/ide.c
parentb8284137d4e0eec11c78bc14047243fce6a51373 (diff)
downloadportland-os-1e4a254674f668839e5de273916024c16814b045.tar.gz
(basic, not much tested) keyboard, better panic
Diffstat (limited to 'src/kernel/ide.c')
-rw-r--r--src/kernel/ide.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/kernel/ide.c b/src/kernel/ide.c
index 70b1dee..4b6443a 100644
--- a/src/kernel/ide.c
+++ b/src/kernel/ide.c
@@ -24,11 +24,11 @@ static uint8_t wait_for_ready(uint16_t base_port) {
for (spinner_t n = -1; n; --n) {
uint8_t s = inb(base_port | ATA_REG_STATUS);
if (s & ATA_STATUS_ERROR)
- panic("Error status in IDE driver.");
+ PANIC("Error status in IDE driver.");
if (s & ATA_STATUS_DRIVE_READY)
return s;
}
- panic("Spun out in IDE driver.");
+ PANIC("Spun out in IDE driver.");
}
//returns the status after waiting
@@ -38,7 +38,7 @@ static uint8_t wait_for_error_or_ready(uint16_t base_port) {
if (s & (ATA_STATUS_DRIVE_READY | ATA_STATUS_ERROR))
return s;
}
- panic("Spun out in IDE driver.");
+ PANIC("Spun out in IDE driver.");
}
//returns the status after waiting
@@ -48,9 +48,9 @@ static uint8_t wait_for_data_ready_not_busy(uint16_t base_port) {
if (!(s & ATA_STATUS_BUSY) && (s & ATA_STATUS_DATA_READY))
return s;
if (s & ATA_STATUS_ERROR)
- panic("Error status in IDE driver.");
+ PANIC("Error status in IDE driver.");
}
- panic("Spun out in IDE driver.");
+ PANIC("Spun out in IDE driver.");
}
static uint32_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count, void *buffer) {
@@ -62,9 +62,9 @@ static uint32_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count
return 0;
if (start & 0xf0000000)
- panic("IDE ATA driver does not support reads starting past 256MiB currently.");
+ PANIC("IDE ATA driver does not support reads starting past 256MiB currently.");
if (count & 0xffffff00)
- panic("IDE ATA driver does not support reads over 128kiB in length currently.");
+ PANIC("IDE ATA driver does not support reads over 128kiB in length currently.");
uint32_t lba = start & 0x00ffffff;
@@ -92,7 +92,7 @@ static uint32_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count
}
static uint32_t ide_ata_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
- panic("IDE ATA writing not implemented yet");
+ PANIC("IDE ATA writing not implemented yet.");
return 0;
}
@@ -104,11 +104,11 @@ static uint32_t ide_atapi_rs(const struct drive *d, uint32_t start, uint32_t cou
if (!count)
return 0;
-
+ PANIC("IDE ATAPI reading not implemented yet.");
}
static uint32_t ide_atapi_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
- panic("IDE ATAPI writing not implemented yet");
+ PANIC("IDE ATAPI writing not implemented yet.");
return 0;
}
@@ -122,7 +122,7 @@ struct id_space {
static void test_drive(uint16_t base_port, uint16_t alt_port, bool slave) {
if (n_ide_drives == MAX_IDE_DRIVES)
- panic("Maximum number of IDE drives reached.");
+ PANIC("Maximum number of IDE drives reached.");
struct ide_drive_info *next = ide_drives + n_ide_drives;
struct drive next_d;
@@ -161,7 +161,7 @@ static void test_drive(uint16_t base_port, uint16_t alt_port, bool slave) {
else {
uint16_t code = inb(base_port | 0x4) + (inb(base_port | 0x5) << 8);
if (!code) {
- panic("PATA identification aborted.");
+ PANIC("PATA identification aborted.");
}
if (code == 0xeb14) {
next_d.drive_type = "IDE PATAPI";
@@ -181,7 +181,7 @@ static void test_drive(uint16_t base_port, uint16_t alt_port, bool slave) {
//in the future, maybe add support for 48-bit LBA, and/or CHS addressing
if (!ids.max_lba)
- panic("Encountered ATA drive that doesn't support 28-bit LBA");
+ PANIC("Encountered ATA drive that doesn't support 28-bit LBA.");
next_d.n_sectors = ids.max_lba;
commit_drive(next_d);