From: acevest Date: Mon, 22 Nov 2021 11:26:02 +0000 (+0800) Subject: 向ide_drive_t添加present字段 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=7bcf206fb51793f401bb3ed1b9180df8ba153970;p=kernel.git 向ide_drive_t添加present字段 --- diff --git a/drivers/ata.c b/drivers/ata.c index 8b6c4f6..3c21625 100644 --- a/drivers/ata.c +++ b/drivers/ata.c @@ -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);