void ata_dma_stop(int channel);
+void ide_stat_print(ide_pci_controller_t *ide_ctrl) {
+ int r = atomic_read(&(ide_ctrl->request_cnt));
+ int i = atomic_read(&(ide_ctrl->irq_cnt));
+ int c = atomic_read(&(ide_ctrl->consumed_cnt));
+ int channel = ide_ctrl->channel;
+ printlxy(MPL_IDE0 + channel, MPO_IDE, "IDE%d req %u irq %u consumed %u", channel, r, i, c);
+}
+
void ide_irq_bh_handler(void *arg) {
int channel = (int)arg;
atomic_inc(&ide_ctrl->irq_cnt);
//
- int r = atomic_read(&(ide_ctrl->request_cnt));
- int i = atomic_read(&(ide_ctrl->irq_cnt));
- int c = atomic_read(&(ide_ctrl->consumed_cnt));
- printlxy(MPL_IDE0 + channel, MPO_IDE, "IDE%d req %u irq %u consumed %u", channel, r, i, c);
+ ide_stat_print(ide_ctrl);
// 之前这里是用up()来唤醒磁盘任务
// 但在中断的底半处理,不应该切换任务,因为会引起irq里的reenter问题,导致不能再进底半处理,也无法切换任务
ide_pci_controller[i].pci = pci;
+ ide_pci_controller[i].channel = i;
+
unsigned int irq_line = pci_read_config_byte(pci_cmd(pci, PCI_INTRLINE));
assert(irq_line <= 15);
if (irq_line == 0) {
}
}
-// 保存它们不跨64KB
+// 保证它们不跨64KB
u16 disk_buf1[256] __attribute__((__aligned__(512)));
u16 disk_buf2[256] __attribute__((__aligned__(512)));
void taskA_entry() {
- current->priority = 7;
+ current->priority = 3;
while (1) {
- sysc_wait(7);
+ sysc_wait(197);
uint64_t sect_nr = get_next_deubug_sect_nr();
memset(disk_buf1, 0, 512);