4 #include <conio.h> /* this is where Open Watcom hides the outp() etc. functions */
13 #include <hw/vga/vga.h>
14 #include <hw/pci/pci.h>
15 #include <hw/dos/dos.h>
16 #include <hw/8254/8254.h> /* 8254 timer */
17 #include <hw/8259/8259.h> /* 8259 PIC interrupts */
18 #include <hw/vga/vgagui.h>
19 #include <hw/vga/vgatty.h>
20 #include <hw/ide/idelib.h>
31 void do_ide_controller_drive_nop_test(struct ide_controller *ide,unsigned char which) {
32 struct vga_msg_box vgabox;
33 struct ide_taskfile *tsk;
35 if (do_ide_controller_user_wait_busy_controller(ide) != 0 || do_ide_controller_user_wait_drive_ready(ide) < 0)
37 idelib_controller_ack_irq(ide); /* <- make sure to ack IRQ */
39 /* fill the registers with a pattern and then issue the NOP command.
40 * the NOP command should come back with unmodified registers */
41 tsk = idelib_controller_get_taskfile(ide,-1/*selected drive*/);
42 tsk->features = 0x00; /* will read back into error reg */
43 tsk->sector_count = 0x12;
47 tsk->command = 0x00; /* <- NOP */
48 idelib_controller_apply_taskfile(ide,0xBE/*base_io+1-5&7*/,IDELIB_TASKFILE_LBA48_UPDATE/*clear LBA48*/);
49 if (ide->flags.io_irq_enable) {
50 do_ide_controller_user_wait_irq(ide,1);
51 idelib_controller_ack_irq(ide); /* <- or else it won't fire again */
53 do_ide_controller_user_wait_busy_controller(ide);
54 do_ide_controller_user_wait_drive_ready(ide);
55 if (!(ide->last_status&1)) {
56 vga_msg_box_create(&vgabox,"Success?? (It's not supposed to!)",0,0);
58 else if ((ide->last_status&0xC9) != 0x41) {
59 sprintf(tmp,"Device rejected with status %02X (not the way it's supposed to)",ide->last_status);
60 vga_msg_box_create(&vgabox,tmp,0,0);
63 idelib_controller_update_taskfile(ide,0xBE,0);
64 if ((tsk->error&0x04) != 0x04) {
65 vga_msg_box_create(&vgabox,"Device rejected with non-abort (not the way it's supposed to)",0,0);
68 unsigned char c=0,cc=0;
70 c=tsk->sector_count; cc += (c == 0x12)?1:0;
71 c=tsk->lba0_3; cc += (c == 0x34)?1:0;
72 c=tsk->lba1_4; cc += (c == 0x56)?1:0;
73 c=tsk->lba2_5; cc += (c == 0x78)?1:0;
76 vga_msg_box_create(&vgabox,"Success",0,0);
78 vga_msg_box_create(&vgabox,"Failed. Registers were modified.",0,0);
82 wait_for_enter_or_escape();
83 vga_msg_box_destroy(&vgabox);