summaryrefslogtreecommitdiff
path: root/src/pc80
diff options
context:
space:
mode:
Diffstat (limited to 'src/pc80')
-rw-r--r--src/pc80/Config.lb7
-rw-r--r--src/pc80/isa-dma.c43
-rw-r--r--src/pc80/keyboard.c11
-rw-r--r--src/pc80/mc146818rtc_early.c11
-rw-r--r--src/pc80/serial.c3
-rw-r--r--src/pc80/serial.inc7
6 files changed, 71 insertions, 11 deletions
diff --git a/src/pc80/Config.lb b/src/pc80/Config.lb
index 0237fa96af..26d548b897 100644
--- a/src/pc80/Config.lb
+++ b/src/pc80/Config.lb
@@ -1,9 +1,8 @@
uses CONFIG_IDE_STREAM
-uses CONFIG_KEYBOARD
uses CONFIG_LEGACY_VGABIOS
object mc146818rtc.o
-#object isa-dma.o
+object isa-dma.o
#object i8259.o CONFIG_I8259
#object udelay_timer2.o CONFIG_UDELAY_TIMER2
#object beep.o CONFIG_BEEP
@@ -16,9 +15,7 @@ if CONFIG_IDE_STREAM
dir ide
end
-if CONFIG_KEYBOARD
- object keyboard.o
-end
+object keyboard.o
if CONFIG_LEGACY_VGABIOS
object vgabios.o
diff --git a/src/pc80/isa-dma.c b/src/pc80/isa-dma.c
new file mode 100644
index 0000000000..45cfb88a97
--- /dev/null
+++ b/src/pc80/isa-dma.c
@@ -0,0 +1,43 @@
+#include <arch/io.h>
+
+/* DMA controller registers */
+#define DMA1_CMD_REG 0x08 /* command register (w) */
+#define DMA1_STAT_REG 0x08 /* status register (r) */
+#define DMA1_REQ_REG 0x09 /* request register (w) */
+#define DMA1_MASK_REG 0x0A /* single-channel mask (w) */
+#define DMA1_MODE_REG 0x0B /* mode register (w) */
+#define DMA1_CLEAR_FF_REG 0x0C /* clear pointer flip-flop (w) */
+#define DMA1_TEMP_REG 0x0D /* Temporary Register (r) */
+#define DMA1_RESET_REG 0x0D /* Master Clear (w) */
+#define DMA1_CLR_MASK_REG 0x0E /* Clear Mask */
+#define DMA1_MASK_ALL_REG 0x0F /* all-channels mask (w) */
+
+#define DMA2_CMD_REG 0xD0 /* command register (w) */
+#define DMA2_STAT_REG 0xD0 /* status register (r) */
+#define DMA2_REQ_REG 0xD2 /* request register (w) */
+#define DMA2_MASK_REG 0xD4 /* single-channel mask (w) */
+#define DMA2_MODE_REG 0xD6 /* mode register (w) */
+#define DMA2_CLEAR_FF_REG 0xD8 /* clear pointer flip-flop (w) */
+#define DMA2_TEMP_REG 0xDA /* Temporary Register (r) */
+#define DMA2_RESET_REG 0xDA /* Master Clear (w) */
+#define DMA2_CLR_MASK_REG 0xDC /* Clear Mask */
+#define DMA2_MASK_ALL_REG 0xDE /* all-channels mask (w) */
+
+#define DMA_MODE_READ 0x44 /* I/O to memory, no autoinit, increment, single mode */
+#define DMA_MODE_WRITE 0x48 /* memory to I/O, no autoinit, increment, single mode */
+#define DMA_MODE_CASCADE 0xC0 /* pass thru DREQ->HRQ, DACK<-HLDA only */
+
+#define DMA_AUTOINIT 0x10
+
+
+void isa_dma_init(void)
+{
+ /* slave at 0x00 - 0x0f */
+ /* master at 0xc0 - 0xdf */
+ /* 0x80 - 0x8f DMA page registers */
+ /* DMA: 0x00, 0x02, 0x4, 0x06 base address for DMA channel */
+ outb(0, DMA1_RESET_REG);
+ outb(0, DMA2_RESET_REG);
+ outb(DMA_MODE_CASCADE, DMA2_MODE_REG);
+ outb(0, DMA2_MASK_REG);
+}
diff --git a/src/pc80/keyboard.c b/src/pc80/keyboard.c
index a7ecf8cbd3..d293f714de 100644
--- a/src/pc80/keyboard.c
+++ b/src/pc80/keyboard.c
@@ -1,8 +1,11 @@
+#include <console/console.h>
+#include <pc80/keyboard.h>
+#include <device/device.h>
#include <arch/io.h>
/* much better keyboard init courtesy ollie@sis.com.tw
TODO: Typematic Setting, the keyboard is too slow for me */
-void pc_keyboard_init()
+static void pc_keyboard_init(struct pc_keyboard *keyboard)
{
volatile unsigned char regval;
@@ -49,3 +52,9 @@ void pc_keyboard_init()
return;
}
+void init_pc_keyboard(unsigned port0, unsigned port1, struct pc_keyboard *kbd)
+{
+ if ((port0 == 0x60) && (port1 == 0x64)) {
+ pc_keyboard_init(kbd);
+ }
+}
diff --git a/src/pc80/mc146818rtc_early.c b/src/pc80/mc146818rtc_early.c
index 35f3f5910f..0c7d822718 100644
--- a/src/pc80/mc146818rtc_early.c
+++ b/src/pc80/mc146818rtc_early.c
@@ -97,3 +97,14 @@ static int do_normal_boot(void)
return (byte & (1<<1));
}
+
+static unsigned read_option(unsigned start, unsigned size, unsigned def)
+{
+#if USE_OPTION_TABLE == 1
+ unsigned byte;
+ byte = cmos_read(start/8);
+ return (byte >> (start & 7U)) & ((1U << size) - 1U);
+#else
+ return def;
+#endif
+}
diff --git a/src/pc80/serial.c b/src/pc80/serial.c
index c2788d6ec7..89ac425c56 100644
--- a/src/pc80/serial.c
+++ b/src/pc80/serial.c
@@ -77,8 +77,7 @@ static void uart_init(void)
#if USE_OPTION_TABLE == 1
static const unsigned char divisor[] = { 1,2,3,6,12,24,48,96 };
unsigned ttys0_div, ttys0_index;
- outb(RTC_BOOT_BYTE + 1, 0x70);
- ttys0_index = inb(0x71);
+ ttys0_index = read_option(CMOS_VSTART_baud_rate, CMOS_VLEN_baud_rate, 0);
ttys0_index &= 7;
ttys0_div = divisor[ttys0_index];
outb(ttys0_div & 0xff, TTYS0_BASE + UART_DLL);
diff --git a/src/pc80/serial.inc b/src/pc80/serial.inc
index b0f12699e1..7b80697c85 100644
--- a/src/pc80/serial.inc
+++ b/src/pc80/serial.inc
@@ -67,8 +67,7 @@ div:
mov %ah, %al ; \
outb %al, %dx
-
-serial0:
+serial_init:
/* Set 115.2Kbps,8n1 */
/* Set 8bit, 1 stop bit, no parity, DLAB */
mov $TTYS0_LCR, %dx
@@ -102,5 +101,7 @@ serial0:
mov $TTYS0_LCR, %dx
mov $(TTYS0_LCS & 0x7f), %al
out %al, %dx
+ RETSP
-
+serial0:
+ CALLSP(serial_init)