]> Zhao Yanbai Git Server - kernel.git/commitdiff
向ide_drive_t添加present字段
authoracevest <zhaoyanbai@126.com>
Mon, 22 Nov 2021 11:26:02 +0000 (19:26 +0800)
committeracevest <zhaoyanbai@126.com>
Mon, 22 Nov 2021 11:26:02 +0000 (19:26 +0800)
drivers/ata.c

index 8b6c4f6a49c51cfec4ab41d2f660ea17b133a24d..3c2162583e631e8c1ee6c15adee22532f5071061 100644 (file)
@@ -18,6 +18,7 @@
 extern ide_pci_controller_t ide_pci_controller;
 
 typedef struct _ide_drive {
+    int present;
     int dma;
     uint64_t lba48;
     uint64_t max_lba;
@@ -75,7 +76,10 @@ void ide_ata_init() {
         uint8_t status = inb(REG_STATUS(dev));
         if (status == 0 || (status & ATA_STATUS_ERR) || (status & ATA_STATUS_RDY == 0)) {
             printk("ata[%d] not exists: %x\n", i, status);
+            ide_drives[i].present = 0;
             continue;
+        } else {
+            ide_drives[i].present = 1;
         }
 
         printk("ata[%d] exists: %x\n", i, status);