static void write_intr(void) { struct request *req = hd_req; int i; int retries = 100000; do { i = (unsigned) inb_p(HD_STATUS); if (i & BUSY_STAT) continue; if (!OK_STATUS(i)) break; if ((blk_rq_sectors(req) <= 1) || (i & DRQ_STAT)) goto ok_to_write; } while (--retries > 0); dump_status("write_intr", i); bad_rw_intr(); hd_request(); return; ok_to_write: if (hd_end_request(0, 512)) { SET_HANDLER(&write_intr); outsw(HD_DATA, req->buffer, 256); return; } #if (HD_DELAY > 0) last_req = read_timer(); #endif hd_request(); }
static void recal_intr(void) { check_status(); #if (HD_DELAY > 0) last_req = read_timer(); #endif hd_request(); }
static void read_intr(void) { struct request *req; int i, retries = 100000; do { i = (unsigned) inb_p(HD_STATUS); if (i & BUSY_STAT) continue; if (!OK_STATUS(i)) break; if (i & DRQ_STAT) goto ok_to_read; } while (--retries > 0); dump_status("read_intr", i); bad_rw_intr(); hd_request(); return; ok_to_read: req = CURRENT; insw(HD_DATA,req->buffer,256); req->sector++; req->buffer += 512; req->errors = 0; i = --req->nr_sectors; --req->current_nr_sectors; #ifdef DEBUG printk("%s: read: sector %ld, remaining = %ld, buffer=%p\n", req->rq_disk->disk_name, req->sector, req->nr_sectors, req->buffer+512); #endif if (req->current_nr_sectors <= 0) end_request(req, 1); if (i > 0) { SET_HANDLER(&read_intr); return; } (void) inb_p(HD_STATUS); #if (HD_DELAY > 0) last_req = read_timer(); #endif if (elv_next_request(QUEUE)) hd_request(); return; }
static void write_intr(void) { struct request *req = CURRENT; int i; int retries = 100000; do { i = (unsigned) inb_p(HD_STATUS); if (i & BUSY_STAT) continue; if (!OK_STATUS(i)) break; if ((req->nr_sectors <= 1) || (i & DRQ_STAT)) goto ok_to_write; } while (--retries > 0); dump_status("write_intr", i); bad_rw_intr(); hd_request(); return; ok_to_write: req->sector++; i = --req->nr_sectors; --req->current_nr_sectors; req->buffer += 512; if (!i || (req->bio && req->current_nr_sectors <= 0)) end_request(req, 1); if (i > 0) { SET_HANDLER(&write_intr); outsw(HD_DATA,req->buffer,256); local_irq_enable(); } else { #if (HD_DELAY > 0) last_req = read_timer(); #endif hd_request(); } return; }
static void read_intr(void) { struct request *req; int i, retries = 100000; do { i = (unsigned) inb_p(HD_STATUS); if (i & BUSY_STAT) continue; if (!OK_STATUS(i)) break; if (i & DRQ_STAT) goto ok_to_read; } while (--retries > 0); dump_status("read_intr", i); bad_rw_intr(); hd_request(); return; ok_to_read: req = hd_req; insw(HD_DATA, req->buffer, 256); #ifdef DEBUG printk("%s: read: sector %ld, remaining = %u, buffer=%p\n", req->rq_disk->disk_name, blk_rq_pos(req) + 1, blk_rq_sectors(req) - 1, req->buffer+512); #endif if (hd_end_request(0, 512)) { SET_HANDLER(&read_intr); return; } (void) inb_p(HD_STATUS); #if (HD_DELAY > 0) last_req = read_timer(); #endif hd_request(); }
/* * This is another of the error-routines I don't know what to do with. The * best idea seems to just set reset, and start all over again. */ static void hd_times_out(unsigned long dummy) { char *name; do_hd = NULL; if (!hd_req) return; spin_lock_irq(hd_queue->queue_lock); reset = 1; name = hd_req->rq_disk->disk_name; printk("%s: timeout\n", name); if (++hd_req->errors >= MAX_ERRORS) { #ifdef DEBUG printk("%s: too many errors\n", name); #endif hd_end_request_cur(-EIO); } hd_request(); spin_unlock_irq(hd_queue->queue_lock); }
/* * This is another of the error-routines I don't know what to do with. The * best idea seems to just set reset, and start all over again. */ static void hd_times_out(unsigned long dummy) { char *name; do_hd = NULL; if (!CURRENT) return; disable_irq(HD_IRQ); local_irq_enable(); reset = 1; name = CURRENT->rq_disk->disk_name; printk("%s: timeout\n", name); if (++CURRENT->errors >= MAX_ERRORS) { #ifdef DEBUG printk("%s: too many errors\n", name); #endif end_request(CURRENT, 0); } local_irq_disable(); hd_request(); enable_irq(HD_IRQ); }
static void reset_hd(void) { static int i; repeat: if (reset) { reset = 0; i = -1; reset_controller(); } else { check_status(); if (reset) goto repeat; } if (++i < NR_HD) { struct hd_i_struct *disk = &hd_info[i]; disk->special_op = disk->recalibrate = 1; hd_out(disk,disk->sect,disk->sect,disk->head-1, disk->cyl,WIN_SPECIFY,&reset_hd); if (reset) goto repeat; } else hd_request(); }
static void do_hd_request (request_queue_t * q) { disable_irq(HD_IRQ); hd_request(); enable_irq(HD_IRQ); }
static void do_hd_request(struct request_queue *q) { hd_request(); }
static void do_hd_request(struct request_queue *q) { disable_irq(HD_IRQ); hd_request(); enable_irq(HD_IRQ); }