diff options
-rw-r--r-- | src/ata.c | 1 | ||||
-rw-r--r-- | src/boot.c | 3 | ||||
-rw-r--r-- | src/clock.c | 7 | ||||
-rw-r--r-- | src/config.h | 3 | ||||
-rw-r--r-- | src/disk.c | 2 | ||||
-rw-r--r-- | src/floppy.c | 13 | ||||
-rw-r--r-- | src/kbd.c | 12 | ||||
-rw-r--r-- | src/mouse.c | 6 | ||||
-rw-r--r-- | src/output.c | 7 | ||||
-rw-r--r-- | src/post.c | 2 | ||||
-rw-r--r-- | src/system.c | 4 | ||||
-rw-r--r-- | src/util.h | 4 |
12 files changed, 40 insertions, 24 deletions
@@ -926,5 +926,4 @@ ata_detect() // FIXME : should use bios=cmos|auto|disable bits // FIXME : should know about translation bits // FIXME : move hard_drive_post here - } @@ -183,7 +183,8 @@ handle_19() void VISIBLE begin_boot() { - ata_detect(); + if (CONFIG_ATA) + ata_detect(); irq_enable(); struct bregs br; memset(&br, 0, sizeof(br)); diff --git a/src/clock.c b/src/clock.c index 6895876..a8c1d2e 100644 --- a/src/clock.c +++ b/src/clock.c @@ -10,6 +10,9 @@ #include "disk.h" // floppy_tick #include "cmos.h" // inb_cmos +#define DEBUGF1(fmt, args...) bprintf(0, fmt , ##args) +#define DEBUGF(fmt, args...) + static void init_rtc() { @@ -257,7 +260,7 @@ handle_1c(struct bregs *regs) void VISIBLE handle_08(struct bregs *regs) { -// debug_enter(regs); +// debug_isr(regs); floppy_tick(); @@ -338,7 +341,7 @@ handle_1583(struct bregs *regs) void VISIBLE handle_70(struct bregs *regs) { - debug_enter(regs); + debug_isr(regs); // Check which modes are enabled and have occurred. u8 registerB = inb_cmos(CMOS_STATUS_B); diff --git a/src/config.h b/src/config.h index a440201..a984e5c 100644 --- a/src/config.h +++ b/src/config.h @@ -3,10 +3,11 @@ // Configuration definitions. #define CONFIG_FLOPPY_SUPPORT 1 -#define CONFIG_PS2_MOUSE 0 +#define CONFIG_PS2_MOUSE 1 #define CONFIG_ATA 1 #define CONFIG_KBD_CALL_INT15_4F 1 #define CONFIG_ELTORITO_BOOT 0 + #define CONFIG_MAX_ATA_INTERFACES 4 #define CONFIG_MAX_ATA_DEVICES (CONFIG_MAX_ATA_INTERFACES*2) @@ -651,7 +651,7 @@ handle_13(struct bregs *regs) void VISIBLE handle_76(struct bregs *regs) { - debug_enter(regs); + debug_isr(regs); SET_BDA(floppy_harddisk_info, 0xff); eoi_both_pics(); } diff --git a/src/floppy.c b/src/floppy.c index 9131d98..5a7513b 100644 --- a/src/floppy.c +++ b/src/floppy.c @@ -12,6 +12,9 @@ #include "util.h" // irq_disable #include "cmos.h" // inb_cmos +#define DEBUGF1(fmt, args...) bprintf(0, fmt , ##args) +#define DEBUGF(fmt, args...) + #define BX_FLOPPY_ON_CNT 37 /* 2 seconds */ // New diskette parameter table adding 3 parameters from IBM @@ -149,9 +152,6 @@ floppy_pio(u8 *cmd, u8 cmdlen) v &= ~FRS_TIMEOUT; SET_BDA(floppy_recalibration_status, v); - if ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) - BX_PANIC("int13_diskette: ctrl not ready\n"); - return 0; } @@ -201,6 +201,10 @@ floppy_cmd(struct bregs *regs, u16 count, u8 *cmd, u8 cmdlen) if (ret) return ret; + // check port 3f4 for accessibility to status bytes + if ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) + BX_PANIC("int13_diskette: ctrl not ready\n"); + // read 7 return status bytes from controller u8 i; for (i=0; i<7; i++) { @@ -347,6 +351,7 @@ check_drive(struct bregs *regs, u8 drive) { // see if drive exists if (drive > 1 || !get_drive_type(drive)) { + // XXX - return type doesn't match floppy_fail(regs, DISK_RET_ETIMEOUT); return 1; } @@ -712,7 +717,7 @@ floppy_13(struct bregs *regs, u8 drive) void VISIBLE handle_0e(struct bregs *regs) { - //debug_enter(regs); + //debug_isr(regs); if ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) { outb(0x08, PORT_FD_DATA); // sense interrupt status while ((inb(PORT_FD_STATUS) & 0xc0) != 0xc0) @@ -544,15 +544,15 @@ process_key(u8 scancode) void VISIBLE handle_09(struct bregs *regs) { -// debug_enter(regs); - - outb(0x0b, PORT_PIC1); - if ((inb(PORT_PIC1) & 0x02) == 0) - return; + //debug_isr(regs); // disable keyboard outb(0xad, PORT_PS2_STATUS); + outb(0x0b, PORT_PIC1); + if ((inb(PORT_PIC1) & 0x02) == 0) + goto done; + // read key from keyboard controller u8 key = inb(PORT_PS2_DATA); irq_enable(); @@ -564,7 +564,7 @@ handle_09(struct bregs *regs) tr.ah = 0x4f; tr.flags = F_CF; call16_int(0x15, &tr); - if (!tr.flags & F_CF) + if (!(tr.flags & F_CF)) goto done; key = tr.al; } diff --git a/src/mouse.c b/src/mouse.c index e3c1789..fd46219 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -191,7 +191,6 @@ mouse_15c203(struct bregs *regs) // 1 = 50 dpi, 2 counts per millimeter // 2 = 100 dpi, 4 counts per millimeter // 3 = 200 dpi, 8 counts per millimeter - bprintf(0, "ebda_seg=%x\n", GET_BDA(ebda_seg)); u8 comm_byte = inhibit_mouse_int_and_events(); // disable IRQ12 and packets if (regs->bh >= 4) { handle_ret(regs, RET_EUNSUPPORTED); @@ -235,7 +234,6 @@ mouse_15c205(struct bregs *regs) handle_ret(regs, RET_EINTERFACE); return; } - bprintf(0, "ebda_seg=%x\n", GET_BDA(ebda_seg)); SET_EBDA(mouse_flag1, 0x00); SET_EBDA(mouse_flag2, regs->bh); @@ -340,7 +338,7 @@ mouse_15c2XX(struct bregs *regs) void handle_15c2(struct bregs *regs) { - debug_stub(regs); + //debug_stub(regs); if (! CONFIG_PS2_MOUSE) { handle_ret(regs, RET_EUNSUPPORTED); @@ -417,7 +415,7 @@ int74_function() void VISIBLE handle_74(struct bregs *regs) { - debug_enter(regs); + //debug_isr(regs); irq_enable(); int74_function(); diff --git a/src/output.c b/src/output.c index 43eb128..0dcd20d 100644 --- a/src/output.c +++ b/src/output.c @@ -167,6 +167,13 @@ dump_regs(const char *fname, const char *type, struct bregs *regs) , regs->ip, regs->cs, regs->flags); } +void +__debug_isr(const char *fname, struct bregs *regs) +{ + puts_cs(0, fname); + putc(0, '\n'); +} + // Function called on handler startup. void __debug_enter(const char *fname, struct bregs *regs) @@ -317,7 +317,7 @@ static void pic_setup() { outb(0x11, PORT_PIC1); - outb(0x11, PORT_PIC2_DATA); + outb(0x11, PORT_PIC2); outb(0x08, PORT_PIC1_DATA); outb(0x70, PORT_PIC2_DATA); outb(0x04, PORT_PIC1_DATA); diff --git a/src/system.c b/src/system.c index 310a17e..e09797b 100644 --- a/src/system.c +++ b/src/system.c @@ -471,7 +471,7 @@ handle_10(struct bregs *regs) void VISIBLE handle_nmi(struct bregs *regs) { - debug_enter(regs); + debug_isr(regs); // XXX } @@ -479,7 +479,7 @@ handle_nmi(struct bregs *regs) void VISIBLE handle_75(struct bregs *regs) { - debug_enter(regs); + debug_isr(regs); // clear irq13 outb(0, PORT_MATH_CLEAR); @@ -37,7 +37,6 @@ static inline void nop(void) asm volatile("nop"); } -#define DEBUGF(fmt, args...) bprintf(0, fmt , ##args) #define BX_PANIC(fmt, args...) bprintf(0, fmt , ##args) #define BX_INFO(fmt, args...) bprintf(0, fmt , ##args) @@ -104,12 +103,15 @@ void bprintf(u16 action, const char *fmt, ...) void __debug_enter(const char *fname, struct bregs *regs); void __debug_exit(const char *fname, struct bregs *regs); void __debug_stub(const char *fname, struct bregs *regs); +void __debug_isr(const char *fname, struct bregs *regs); #define debug_enter(regs) \ __debug_enter(__func__, regs) #define debug_exit(regs) \ __debug_exit(__func__, regs) #define debug_stub(regs) \ __debug_stub(__func__, regs) +#define debug_isr(regs) \ + __debug_isr(__func__, regs) #define printf(fmt, args...) \ bprintf(1, fmt , ##args ) |