Minor code cleanups.
Fix parenthesis imbalance in keyboard led test.
The printf() call is only used in 32bit mode - make this explicit to
the compiler - it improves the code generation.
Clear the screen after initializing the vga option rom.
+Clean up timer code. Don't use PORT_DIAG as delay mechanism.
+
Disable a20 on jump to 16bit mode.
Do a pci scan for ide controllers - don't just assume ISA ports are
The __call16 code does a long jump to the interrupt trampolines - this
is unnecessary.
-Fix makefiles so that they rebuild the required files automatically.
-
Cleanup setting of ES on GET/SET_BDA
+Audit code for 16bit protected mode accesses.
+
+Support 1ab1 from 16bit protected mode.
+
+Verify option roms wont stomp on seabios stack and bss.
+
Possibly implement 32bit pcibios support.
Allow one to select adding 32 bit code to 0xf000 or in a separate
location.
+See if it is possible to handle interrupts while in 32bit mode.
+
Look at integrating the lgpl vgabios into tree.
+
+Look at usb booting specs. Look at possibly supporting usb
+keyboard/mice.
+
+Add a graphical boot splash screen?
#ifndef __BREGS_H
#define __BREGS_H
+#include "types.h" // u16
+
/****************************************************************
* Registers saved/restored in romlayout.S
int ret = atapi_is_ready(device);
if (ret)
- dprintf(1, "ata_is_ready returned %d\n", ret);
-
- // if not found
- if (device >= CONFIG_MAX_ATA_DEVICES)
- return 2;
+ dprintf(1, "atapi_is_ready returned %d\n", ret);
// Read the Boot Record Volume Descriptor
u8 buffer[2048];
{
u8 shift_flags = GET_BDA(kbd_flag0);
u8 led_flags = GET_BDA(kbd_led);
- if (((shift_flags >> 4) & 0x07) ^ ((led_flags & 0x07) == 0))
+ if ((((shift_flags >> 4) & 0x07) ^ (led_flags & 0x07)) == 0)
return;
outb(0xed, PORT_PS2_DATA);
u8 mouse_flags_1 = GET_EBDA(mouse_flag1);
u8 mouse_flags_2 = GET_EBDA(mouse_flag2);
- if ((mouse_flags_2 & 0x80) != 0x80)
+ if (! (mouse_flags_2 & 0x80))
+ // far call handler not installed
return;
u8 package_count = mouse_flags_2 & 0x07;
u16 X = GET_EBDA(mouse_data[1]);
u16 Y = GET_EBDA(mouse_data[2]);
SET_EBDA(mouse_flag1, 0);
- // check if far call handler installed
- if (! (mouse_flags_2 & 0x80))
- return;
u32 func = GET_EBDA(far_call_pointer);
asm volatile(
-// Raw screen writing code.
+// Raw screen writing and debug output code.
//
// Copyright (C) 2008 Kevin O'Connor <kevin@koconnor.net>
//
, oldparam, oldier, newparam, newier);
}
+// Write a character to the serial port.
static void
debug_serial(char c)
{
outb(c, DEBUG_PORT);
}
+// Show a character on the screen.
static void
screenc(u8 c)
{
+ if (MODE16)
+ // printf is only used in 32bit code.
+ return;
struct bregs br;
memset(&br, 0, sizeof(br));
br.ah = 0x0e;
call16_int(0x10, &br);
}
-// Write a charcter to the framebuffer.
+// Output a character.
static void
putc(u16 action, char c)
{
}
}
-// Write a string to the framebuffer.
+// Ouptut a string.
static void
puts(u16 action, const char *s)
{
putc(action, *s);
}
-// Write a string to the framebuffer.
+// Output a string that is in the CS segment.
static void
puts_cs(u16 action, const char *s)
{
}
}
-// Write an unsigned integer to the screen.
+// Output an unsigned integer.
static void
putuint(u16 action, u32 val)
{
puts(action, d);
}
-// Write a single digit hex character to the screen.
+// Output a single digit hex character.
static inline void
putsinglehex(u16 action, u32 val)
{
putc(action, val);
}
-// Write an integer in hexadecimal to the screen.
+// Output an integer in hexadecimal.
static void
puthex(u16 action, u32 val)
{
regs->ax = 0x0001;
regs->bx = 0x0210;
regs->cx = 0;
+ // XXX - regs->cl should equal max bus number.
regs->edx = 0x20494350; // "PCI "
// XXX - bochs bios code sets edi to point to 32bit code - but no
// reference to this in spec.
// Send ICW1 (select OCW1 + will send ICW4)
outb(0x11, PORT_PIC1_CMD);
outb(0x11, PORT_PIC2_CMD);
- // Send ICW2 (base irqs: 0x08-0x0f for irq0-7, 0x70-0x78 for irq8-15)
+ // Send ICW2 (base irqs: 0x08-0x0f for irq0-7, 0x70-0x77 for irq8-15)
outb(0x08, PORT_PIC1_DATA);
outb(0x70, PORT_PIC2_DATA);
// Send ICW3 (cascaded pic ids)
}
}
+// Call into vga code to turn on console.
+static void
+vga_setup()
+{
+ dprintf(1, "Scan for VGA option rom\n");
+ rom_scan(0xc0000, 0xc7800);
+
+ dprintf(1, "Turning on vga console\n");
+ struct bregs br;
+ memset(&br, 0, sizeof(br));
+ br.ax = 0x0003;
+ call16_int(0x10, &br);
+}
+
// Main setup code.
static void
post()
ram_probe();
- dprintf(1, "Scan for VGA option rom\n");
- rom_scan(0xc0000, 0xc7800);
+ vga_setup();
printf("BIOS - begin\n\n");