From 8a4e0ff10f0ab5a7a9284f385de4346243c8f469 Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Mon, 20 Nov 2023 23:11:12 +0100 Subject: [PATCH] Fix ata device detection After grub loading sector and LBA could have been altered --- drivers/ata.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/ata.c b/drivers/ata.c index 8ac576f..5476e91 100644 --- a/drivers/ata.c +++ b/drivers/ata.c @@ -418,6 +418,10 @@ int ATADetectDevice(struct ata_device *dev) struct ata_controller *ctl = dev->ctl; outb(ctl->base + ATA_PIO_DRIVE, ATA_PIO_DRIVE_IBM | (dev->isSlave ? ATA_PIO_DRIVE_SLAVE : ATA_PIO_DRIVE_MASTER)); + outb(ctl->base + ATA_PIO_SEC_COUNT, 0); + outb(ctl->base + ATA_PIO_LBALO, 0); + outb(ctl->base + ATA_PIO_LBAMID, 0); + outb(ctl->base + ATA_PIO_LBAHI, 0); unsigned st = inb(ctl->base + ATA_PIO_STATUS); if (st & ATA_PIO_STATUS_DRIVE_BUSY) goto no_disk;