static void hd_out(struct hd_i_struct *disk, unsigned int nsect, unsigned int sect, unsigned int head, unsigned int cyl, unsigned int cmd, void (*intr_addr)(void)) { unsigned short port; #if (HD_DELAY > 0) while (read_timer() - last_req < HD_DELAY) /* nothing */; #endif if (reset) return; if (!controller_ready(disk->unit, head)) { reset = 1; return; } SET_HANDLER(intr_addr); outb_p(disk->ctl,HD_CMD); port=HD_DATA; outb_p(disk->wpcom>>2,++port); outb_p(nsect,++port); outb_p(sect,++port); outb_p(cyl,++port); outb_p(cyl>>8,++port); outb_p(0xA0|(disk->unit<<4)|head,++port); outb_p(cmd,++port); }
static void hd_out(unsigned int drive, unsigned int nsect, unsigned int start_sect, unsigned int head, unsigned int cyl, unsigned int cmd, void (*intr_addr)(void)) { register int port; if (drive > 1 || head > 15) panic("Trying to write bad sector"); if (!controller_ready()) panic("HD controller not ready"); /* setup interrupt handler */ do_hd = intr_addr; /* send contorl command first */ outb_p(hd_info[drive].ctl, HD_CMD); /* fill param */ port = HD_DATA; outb_p(hd_info[drive].wpcom >> 2, ++port); outb_p(nsect, ++port); outb_p(start_sect, ++port); outb_p(cyl, ++port); outb_p(cyl >> 8, ++port); outb_p(0xa0 | (drive << 4) | head, ++port); /* issue cmd(WIN_READ/WIN_WRITE/...) */ outb(cmd, ++port); }
static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect, unsigned int head,unsigned int cyl,unsigned int cmd, void (*intr_addr)(void)) { register int port asm("dx"); /*fp=fopen(log.txt); if (drive == 0 ) { //printk("0!\n"); fputc('0',fp); }else if (drive == 1) { //printk("1!"); fputc('1',fp); }*/ if (drive>1 || head>15) panic("Trying to write bad sector"); if (!controller_ready()) panic("HD controller not ready"); do_hd = intr_addr; outb_p(hd_info[drive].ctl,HD_CMD); port=HD_DATA; outb_p(hd_info[drive].wpcom>>2,++port); outb_p(nsect,++port); outb_p(sect,++port); outb_p(cyl,++port); outb_p(cyl>>8,++port); outb_p(0xA0|(drive<<4)|head,++port); outb(cmd,++port); //fclose(fp); }
static void hd_out(unsigned int drive, unsigned int nsect, unsigned int sect, unsigned int head, unsigned int cyl, unsigned int cmd, void (*intr_addr)(void)) { register int port asm("dx"); if (drive > 1 || head > 5) panic("Trying to write bad sector"); if (!controller_ready()) panic("HD controller not ready"); do_hd = intr_addr; outb(_CTL, HD_CMD); port = HD_DATA; outb_p(_WPCOM, ++port); outb_p(nsect, ++port); outb_p(sect, ++port); outb_p(cyl, ++port); outb_p(cyl >> 8, ++port); outb_p(0xB0 | (drive << 4) | head, ++port); outb(cmd, ++port); }
static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect, unsigned int head,unsigned int cyl,unsigned int cmd, void (*intr_addr)(void)) { register int port asm("dx"); if (drive>1 || head>15) panic("Trying to write bad sector"); if (!controller_ready()) panic("HD controller not ready"); SET_INTR(intr_addr); outb_p(hd_info[drive].ctl,HD_CMD); port=HD_DATA; outb_p(hd_info[drive].wpcom>>2,++port); outb_p(nsect,++port); outb_p(sect,++port); outb_p(cyl,++port); outb_p(cyl>>8,++port); outb_p(0xA0|(drive<<4)|head,++port); outb(cmd,++port); }
static void hd_out(unsigned int drive,unsigned int nsect,unsigned int sect, unsigned int head,unsigned int cyl,unsigned int cmd, void (*intr_addr)(void)) { unsigned short port; if (drive>1 || head>15) panic("Trying to write bad sector"); if (reset || !controller_ready()) { reset = 1; return; } SET_INTR(intr_addr); outb_p(hd_info[drive].ctl,HD_CMD); port=HD_DATA; outb_p(hd_info[drive].wpcom>>2,++port); outb_p(nsect,++port); outb_p(sect,++port); outb_p(cyl,++port); outb_p(cyl>>8,++port); outb_p(0xA0|(drive<<4)|head,++port); outb(cmd,++port); }