summaryrefslogtreecommitdiff
path: root/src/kernel/ide.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/ide.c')
-rw-r--r--src/kernel/ide.c34
1 files changed, 10 insertions, 24 deletions
diff --git a/src/kernel/ide.c b/src/kernel/ide.c
index a32f149..a4ba34c 100644
--- a/src/kernel/ide.c
+++ b/src/kernel/ide.c
@@ -14,25 +14,13 @@ struct ide_drive_info {
bool slave;
};
-struct ide_drive_info ide_drives[MAX_IDE_DRIVES];
-drive_id_t n_ide_drives = 0;
+static struct ide_drive_info ide_drives[MAX_IDE_DRIVES];
+static drive_id_t n_ide_drives = 0;
typedef uint16_t spinner_t;
//returns the status after waiting
-uint8_t wait_after_cmd(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.");
- if (!(s & ATA_STATUS_BUSY))
- return s;
- }
- panic("Spun out in IDE driver.");
-}
-
-//returns the status after waiting
-uint8_t wait_for_ready(uint16_t base_port) {
+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)
@@ -44,7 +32,7 @@ uint8_t wait_for_ready(uint16_t base_port) {
}
//returns the status after waiting
-uint8_t wait_for_error_or_ready(uint16_t base_port) {
+static uint8_t wait_for_error_or_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_DRIVE_READY | ATA_STATUS_ERROR))
@@ -54,7 +42,7 @@ uint8_t wait_for_error_or_ready(uint16_t base_port) {
}
//returns the status after waiting
-uint8_t wait_for_data_ready_not_busy(uint16_t base_port) {
+static uint8_t wait_for_data_ready_not_busy(uint16_t base_port) {
for (spinner_t n = -1; n; --n) {
uint8_t s = inb(base_port | ATA_REG_STATUS);
if (!(s & ATA_STATUS_BUSY) && (s & ATA_STATUS_DATA_READY))
@@ -65,7 +53,7 @@ uint8_t wait_for_data_ready_not_busy(uint16_t base_port) {
panic("Spun out in IDE driver.");
}
-uint8_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count, void *buffer) {
+static uint8_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count, void *buffer) {
if (start >= d->n_sectors)
return 0;
if (start + count > d->n_sectors)
@@ -103,17 +91,17 @@ uint8_t ide_ata_rs(const struct drive *d, uint32_t start, uint32_t count, void *
return count;
}
-uint8_t ide_ata_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
+static uint8_t ide_ata_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
panic("IDE ATA writing not implemented yet");
return 0;
}
-uint8_t ide_atapi_rs(const struct drive *d, uint32_t start, uint32_t count, void *buffer) {
+static uint8_t ide_atapi_rs(const struct drive *d, uint32_t start, uint32_t count, void *buffer) {
//panic("IDE ATAPI reading not implemented yet");
return 0;
}
-uint8_t ide_atapi_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
+static uint8_t ide_atapi_ws(const struct drive *d, uint32_t start, uint32_t count, const void *buffer) {
panic("IDE ATAPI writing not implemented yet");
return 0;
}
@@ -124,9 +112,7 @@ struct id_space {
uint8_t skip2[512 - (120 + 4)];
} __attribute__ ((__packed__ ));
-void vga_printsz(char *s);
-
-void test_drive(uint16_t base_port, uint16_t alt_port, bool slave) {
+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.");