added serial debug and epia support

This commit is contained in:
Andrew Ip 2003-05-22 12:52:38 +00:00
commit 810d0c1e06
2 changed files with 63 additions and 0 deletions

View file

@ -12,6 +12,7 @@ PIRQ_W=
PIRQ_M=pirq/pirq-MS7308E.bin
PIRQ_P=pirq/pirq-P6STMT.bin
PIRQ_T=pirq/pirq-ThinkPad.T23.bin
PIRQ_EPIA=pirq/pirq-EPIA.bin
BOCHS_R=bochs
BOCHS_B=bochs/bios
@ -25,6 +26,7 @@ BIOS_X=${BOCHS_X}/rombios.bin
VIDEO64W=video/video.bios-WINFAST64kb.bin
VIDEO64M=
VIDEO64P=video/video.bios-P6STMT-64kb.bin
VIDEO64EPIA=video/video.bios-EPIA-64kb.bin
PAYLOAD=payload
@ -36,6 +38,8 @@ all: clean build #install
#-------------------------------------------------
epia: loader.o bios
cat ${ELF129} ${LOADER} ${PIRQ_EPIA} ${BIOS_B} ${VIDEO64EPIA} > ${PAYLOAD}
build: loader.o bios
cat ${ELF129} ${LOADER} ${PIRQ_M} ${BIOS_B} ${VIDEO64P} > ${PAYLOAD}

View file

@ -131,6 +131,7 @@
#define DEBUG_ROMBIOS 1
#define DEBUG_SERIAL 1
#define DEBUG_ATA 1
#define DEBUG_INT13_HD 0
#define DEBUG_INT13_CD 0
@ -1425,17 +1426,75 @@ wrch(c)
ASM_END
}
#if DEBUG_SERIAL
/* Data */
#define UART_RBR 0x00
#define UART_TBR 0x00
/* Control */
#define UART_IER 0x01
#define UART_IIR 0x02
#define UART_FCR 0x02
#define UART_LCR 0x03
#define UART_MCR 0x04
#define UART_DLL 0x00
#define UART_DLM 0x01
/* Status */
#define UART_LSR 0x05
#define UART_MSR 0x06
#define UART_SCR 0x07
int uart_can_tx_byte(base_port)
Bit16u base_port;
{
return inb(base_port + UART_LSR) & 0x20;
}
void uart_wait_to_tx_byte(base_port)
Bit16u base_port;
{
while(!uart_can_tx_byte(base_port))
;
}
void uart_wait_until_sent(base_port)
Bit16u base_port;
{
while(!(inb(base_port + UART_LSR) & 0x40))
;
}
void uart_tx_byte(base_port, data)
Bit16u base_port;
Bit8u data;
{
uart_wait_to_tx_byte(base_port);
outb(base_port + UART_TBR, data);
/* Make certain the data clears the fifos */
uart_wait_until_sent(base_port);
}
#endif
void
send(action, c)
Bit16u action;
Bit8u c;
{
#if DEBUG_SERIAL // hcyun
if ( c == '\n') uart_tx_byte(0x3f8, '\r');
uart_tx_byte(0x3f8, c);
#else
if (action & BIOS_PRINTF_DEBUG) outb(DEBUG_PORT, c);
if (action & BIOS_PRINTF_INFO) outb(INFO_PORT, c);
if (action & BIOS_PRINTF_SCREEN) {
if (c == '\n') wrch('\r');
wrch(c);
}
#endif
}
void