From: acevest Date: Mon, 15 Nov 2021 15:32:08 +0000 (+0800) Subject: ide irq read mbr X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/Bv9ARM.ch06.html?a=commitdiff_plain;h=3d13b00917d45f6782ba9d3bb62f73b702777f2b;p=kernel.git ide irq read mbr --- diff --git a/drivers/ata.c b/drivers/ata.c index 1f070d6..e6e2bb6 100644 --- a/drivers/ata.c +++ b/drivers/ata.c @@ -34,7 +34,7 @@ void ata_test(uint64_t nr) { // 对于同一个IDE通道的两个DRIVE,共享同一组寄存器,它们之间的区分是通过Device寄存器的第4个bit位来实现的。0为Master,1为Slave // // 使用IDENTIFY命令步骤: -// 1. 选择DRIVE构造命令,发送到Device寄存器(发送到master: 0x00, 发送到slave: 0x40) +// 1. 选择DRIVE构造命令,发送到Device寄存器(选择master发送: 0x00, 选择slave发送: 0x40) // 2. 发送IDENTIFY(0xEC)命令到该通道的命令寄存器 // 检查status寄存器: // 1. 若为0,就认为没有IDE @@ -73,15 +73,15 @@ void ata_read_identify(int dev) { // 这里所用的dev是逻辑编号 ATA0、A // TODO REMOVE mbr_buf = kmalloc(SECT_SIZE, 0); // ata_test(0); - + sleep_on_ide(); // ata_pio_read_ext(0, 0, 1, ATA_TIMEOUT, mbr_buf); - // uint16_t *p = (uint16_t *)mbr_buf; - // for (int i = 0; i < 256; i++) { - // if (i % 12 == 0) { - // printk("\n>%03d ", i); - // } - // printk("%04x ", p[i]); - // } + uint16_t *p = (uint16_t *)mbr_buf; + for (int i = 0; i < 256; i++) { + if (i % 12 == 0) { + printk("\n[%03d] ", i); + } + printk("%04x ", p[i]); + } } // ATA_CMD_READ_DMA_EXT diff --git a/drivers/keyboard.c b/drivers/keyboard.c index 4f82446..0bc1458 100644 --- a/drivers/keyboard.c +++ b/drivers/keyboard.c @@ -99,11 +99,12 @@ void kbd_debug(unsigned char scan_code) { if (scan_code == 0x42) // F8 debug_wait_queue_put(7); - // if (scan_code == 0x43) // F9 - // ide_dma_pci_lba48(); + if (scan_code == 0x43) { // F9 + void ata_test(uint64_t nr); + ata_test(0); + } if (scan_code == 0x44) { // F10 - // void ata_test(uint64_t nr); - // ata_test(0); + void ata_send_read_identify_cmd(int dev); ata_send_read_identify_cmd(0); } diff --git a/kernel/wait.c b/kernel/wait.c index bcee2bb..1c50eb2 100644 --- a/kernel/wait.c +++ b/kernel/wait.c @@ -49,7 +49,7 @@ void __wake_up(wait_queue_head_t *head, int nr) { irq_save(flags); list_for_each_entry_safe(p, tmp, &head->task_list, task_list) { list_del(&p->task_list); - printk("wakeup: %s\n", p->task->name); + printk("wakeup: %s\nread sector 0 with LBA48 and DMA", p->task->name); p->task->state = TASK_RUNNING; --nr;