aboutsummaryrefslogtreecommitdiff
path: root/mubios/drivers
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-11-08 07:49:23 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-11-08 07:49:23 +0800
commitbb20921d00c770cb30bb85a300423d9062a94d91 (patch)
tree047e61340edaa3c3d4bf0e9d01ba7786bfda5368 /mubios/drivers
parent9bfc57c3684f7aebba0f6865a1ea248f576b947f (diff)
downloadrcc-project-bb20921d00c770cb30bb85a300423d9062a94d91.tar.gz
rcc-project-bb20921d00c770cb30bb85a300423d9062a94d91.tar.xz
[mubios] Multi-sector INT 13h AH=42h
Signed-off-by: Richard Qin <richard.qin.x@gmail.com>
Diffstat (limited to 'mubios/drivers')
-rw-r--r--mubios/drivers/ata.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/mubios/drivers/ata.c b/mubios/drivers/ata.c
index a0cd12a..928a7d1 100644
--- a/mubios/drivers/ata.c
+++ b/mubios/drivers/ata.c
@@ -60,8 +60,8 @@ ata_delay_400ns (void)
io_in8 (ATA_STATUS);
}
-u8
-ata_read_sector28 (u32 lba, u16 *buffer)
+static u8
+ata_read_one_sector28 (u32 lba, u16 *buffer)
{
u8 status;
u16 index;
@@ -91,3 +91,23 @@ ata_read_sector28 (u32 lba, u16 *buffer)
return 0;
}
+
+u8
+ata_read_sectors28 (u32 lba, u16 *buffer, u16 count)
+{
+ u16 sector;
+
+ if (count == 0u)
+ return 1;
+
+ for (sector = 0; sector < count; ++sector)
+ {
+ if (ata_read_one_sector28 (lba, buffer) != 0)
+ return 1;
+
+ lba++;
+ buffer += 256;
+ }
+
+ return 0;
+}