static void write_intr(void) { if (win_result()) { bad_rw_intr(); return; } if (--CURRENT->nr_sectors) { CURRENT->sector++; CURRENT->buffer += 512; port_write(HD_DATA,CURRENT->buffer,256); return; } end_request(1); do_hd_request(); }
static void read_intr(void) { if (win_result()) { bad_rw_intr(); return; } port_read(HD_DATA,CURRENT->buffer,256); CURRENT->errors = 0; CURRENT->buffer += 512; CURRENT->sector++; if (--CURRENT->nr_sectors) return; end_request(1); do_hd_request(); }
static void write_intr(void) { if (win_result()) { bad_rw_intr(); return; } if (--this_request->nsector) { port_write(HD_DATA, this_request->bh->b_data + 512, 256); return; } this_request->bh->b_uptodate = 1; this_request->bh->b_dirt = 0; wake_up(&wait_for_request); unlock_buffer(this_request->bh); this_request->hd = -1; this_request = this_request->next; do_request(); }
static void write_intr(void) { if (win_result()) { bad_rw_intr(); do_hd_request(); return; } if (--CURRENT_REQ->nr_sectors) { CURRENT_REQ->start_sector++; CURRENT_REQ->buffer += 512; do_hd = &write_intr; port_write(HD_DATA, CURRENT_REQ->buffer, 256); return; } end_request(1); /* this time request done */ do_hd_request(); /* do other hd request */ }
static void reset_hd(void) { static int i; repeat: if (reset) { reset = 0; i = -1; reset_controller(); } else if (win_result()) { bad_rw_intr(); if (reset) goto repeat; } i++; if (i < NR_HD) { hd_out(i,hd_info[i].sect,hd_info[i].sect,hd_info[i].head-1, hd_info[i].cyl,WIN_SPECIFY,&reset_hd); } else do_hd_request(); }
/* * 这个函数由中断处理程序调用,用来命令hd controller把数据读取到指定内存 */ static void read_intr(void) { if (win_result()) { printk("bad req"); while(1); do_hd_request(); return; } port_read(HD_DATA,CURRENT->buffer,256); CURRENT->errors = 0; CURRENT->buffer += 512; CURRENT->sector++; if (--CURRENT->nr_sectors) { do_hd = &read_intr; return; } }
static void read_intr(void) { if (win_result()) { bad_rw_intr(); return; } if (this_request->nsector == 2) { this_request->nsector--; port_read(HD_DATA, this_request->bh->b_data, 256); } else { port_read(HD_DATA, this_request->bh->b_data + 512, 256); return; } this_request->errors = 0; this_request->bh->b_uptodate = 1; this_request->bh->b_dirt = 0; wake_up(&wait_for_request); unlock_buffer(this_request->bh); this_request->hd = -1; this_request = this_request->next; do_request(); }
static void read_intr(void) { /* check previous read command success or not */ if (win_result()) { bad_rw_intr(); do_hd_request(); return; } /* read data from hard disk from data register */ port_read(HD_DATA, CURRENT_REQ->buffer, 256); CURRENT_REQ->errors = 0; CURRENT_REQ->buffer += 512; CURRENT_REQ->start_sector++; if (--CURRENT_REQ->nr_sectors) { do_hd = &read_intr; return; } end_request(1); do_hd_request(); }
void read_blk_test(void) { char *abc = (char *)&aaaa[0]; int i; struct partition *p; memset(abc, 0x23, 512); if( win_result()) { printk("over\n"); return; } port_read(HD_DATA,abc,256); rmb(); wmb(); for(i=500;i<512;i++) printk("%x ", aaaa[i]); printk("\n"); p = 0x1be + (void *)abc; for(i=1;i<5;i++, p++) { printk("i:%d, start_sect:%d, nr_sects:%d\n", i, p->start_sect, p->nr_sects); } }
static void recal_intr(void) { if (win_result()) bad_rw_intr(); do_hd_request(); }