Fix bug in post causing PIC2 to not be initialized properly.
Only run ata_detect if CONFIG_ATA enabled.
Improve debugging aids - introduce debug_isr(); move DEBUGF to each file.
Enable mouse by default.
Fix bug in floppy causing extra test of PORT_FD_STATUS on recalibrate.
Always disable/enable kbd in handle_09 event.
// FIXME : should use bios=cmos|auto|disable bits
// FIXME : should know about translation bits
// FIXME : move hard_drive_post here
-
}
void VISIBLE
begin_boot()
{
- ata_detect();
+ if (CONFIG_ATA)
+ ata_detect();
irq_enable();
struct bregs br;
memset(&br, 0, sizeof(br));
#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()
{
void VISIBLE
handle_08(struct bregs *regs)
{
-// debug_enter(regs);
+// debug_isr(regs);
floppy_tick();
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);
// 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)
void VISIBLE
handle_76(struct bregs *regs)
{
- debug_enter(regs);
+ debug_isr(regs);
SET_BDA(floppy_harddisk_info, 0xff);
eoi_both_pics();
}
#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
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;
}
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++) {
{
// 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;
}
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)
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();
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;
}
// 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);
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);
void
handle_15c2(struct bregs *regs)
{
- debug_stub(regs);
+ //debug_stub(regs);
if (! CONFIG_PS2_MOUSE) {
handle_ret(regs, RET_EUNSUPPORTED);
void VISIBLE
handle_74(struct bregs *regs)
{
- debug_enter(regs);
+ //debug_isr(regs);
irq_enable();
int74_function();
, 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)
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);
void VISIBLE
handle_nmi(struct bregs *regs)
{
- debug_enter(regs);
+ debug_isr(regs);
// XXX
}
void VISIBLE
handle_75(struct bregs *regs)
{
- debug_enter(regs);
+ debug_isr(regs);
// clear irq13
outb(0, PORT_MATH_CLEAR);
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)
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 )