Split boot/boot_com0/boot_vga.
boot supports framebuffer. boot_com0 supports com0. boot_vga supports vga, not frambuffer.
This commit is contained in:
parent
40f5425d58
commit
33aaae50a1
|
@ -1,5 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.3 2008/05/25 16:27:56 kiyohara Exp $
|
||||
# $NetBSD: Makefile,v 1.4 2008/05/26 16:28:39 kiyohara Exp $
|
||||
|
||||
SUBDIR= boot
|
||||
SUBDIR= common .WAIT boot_com0 boot_vga boot
|
||||
|
||||
.include <bsd.subdir.mk>
|
||||
|
|
|
@ -1,11 +1,50 @@
|
|||
# $NetBSD: Makefile,v 1.24 2008/03/26 14:56:18 kiyohara Exp $
|
||||
# $NetBSD: Makefile,v 1.25 2008/05/26 16:28:39 kiyohara Exp $
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
COMMON= ${.CURDIR}/../common
|
||||
COMMONOBJ!= cd ${COMMON} && ${PRINTOBJDIR}
|
||||
|
||||
.PATH: ${.CURDIR}/../boot ${COMMONOBJ} ${.CURDIR}/../../../powerpc/powerpc
|
||||
|
||||
S= ${.CURDIR}/../../../..
|
||||
L= ${COMMONOBJ}/lib
|
||||
|
||||
PROG= boot
|
||||
NEWVERSWHAT= "BOOT"
|
||||
ELF2PEF= ${.CURDIR}/../../../powerpc/stand/mkbootimage
|
||||
|
||||
BINMODE?= 444
|
||||
COMMONLIBDIR= ${.CURDIR}/../../../../../common
|
||||
|
||||
BASE?= boot
|
||||
PROG= ${BASE}
|
||||
NEWVERSWHAT= "BOOT"
|
||||
|
||||
SRCS= srt0.s
|
||||
SRCS+= boot.c clock.c com.c conf.c cons.c cpu.c devopen.c
|
||||
SRCS+= fd.c filesystem.c inkernel.c io.c kbd.c monitor.c ns16550.c
|
||||
SRCS+= prf.c tgets.c vers.c vga.c video.c vreset.c
|
||||
SRCS+= setjmp.S
|
||||
|
||||
CFLAGS= -Wno-main -ffreestanding
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp
|
||||
|
||||
CPPFLAGS= -nostdinc -I${.OBJDIR} -I${ELF2PEF} -I${S} -I${COMMONLIBDIR}/include
|
||||
CPPFLAGS+= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
|
||||
CPPFLAGS+= -D_STANDALONE -DRELOC=${RELOC} -DUSE_SCAN
|
||||
CPPFLAGS+= -D__daddr_t=int32_t
|
||||
#CPPFLAGS+= -DDBMONITOR
|
||||
|
||||
.if (${BASE} == "boot")
|
||||
CPPFLAGS+= -DCONS_BE
|
||||
.elif (${BASE} == "boot_com0")
|
||||
CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3f8
|
||||
.elif (${BASE} == "boot_vga")
|
||||
CPPFLAGS+= -DCONS_VGA
|
||||
.endif
|
||||
|
||||
STRIPFLAG=
|
||||
BINMODE= 444
|
||||
|
||||
# XXX SHOULD NOT NEED TO DEFINE THESE!
|
||||
LIBCRT0=
|
||||
|
@ -13,70 +52,32 @@ LIBC=
|
|||
LIBCRTBEGIN=
|
||||
LIBCRTEND=
|
||||
|
||||
realall: ${PROG}
|
||||
|
||||
ASRCS+= srt0.s
|
||||
CSRCS+= boot.c clock.c com.c conf.c cons.c cpu.c devopen.c
|
||||
CSRCS+= fd.c filesystem.c inkernel.c io.c tgets.c prf.c monitor.c
|
||||
CSRCS+= kbd.c ns16550.c vreset.c vga.c video.c
|
||||
|
||||
SRCS= ${ASRCS} ${CSRCS}
|
||||
|
||||
CLEANFILES+= vers.c vers.o
|
||||
|
||||
COPTS+= -ffreestanding
|
||||
CPPFLAGS= -I. -I${.CURDIR} -I${.CURDIR}/../elf2pef -I${.CURDIR}/../../..
|
||||
CPPFLAGS+= -I${S} -I${S}/lib/libsa
|
||||
CPPFLAGS+= -D_STANDALONE -DDBMONITOR -DRELOC=${RELOC}
|
||||
CPPFLAGS+= -DUSE_SCAN
|
||||
#CPPFLAGS+= -DCONS_BE
|
||||
CPPFLAGS+= -DCONS_VGA
|
||||
CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3F8
|
||||
|
||||
CFLAGS= -Wno-main
|
||||
AFLAGS= -x assembler-with-cpp -traditional-cpp
|
||||
NOMAN= # defined
|
||||
STRIPFLAG=
|
||||
BINMODE= 444
|
||||
|
||||
RELOC= 0x700000
|
||||
|
||||
CLEANFILES+= vers.c machine powerpc ${PROG}.elf
|
||||
|
||||
LIBS= ${L}/sa/libsa.a ${L}/kern/libkern.a ${L}/z/libz.a
|
||||
|
||||
.if !make(obj) && !make(clean) && !make(cleandir)
|
||||
.BEGIN:
|
||||
@[ -h machine ] || ln -s ${S}/arch/${MACHINE}/include machine
|
||||
@[ -h powerpc ] || ln -s ${S}/arch/powerpc/include powerpc
|
||||
.endif
|
||||
.BEGIN: machine powerpc
|
||||
.NOPATH: machine powerpc
|
||||
CLEANFILES+= machine powerpc
|
||||
|
||||
### find out what to use for libkern
|
||||
KERN_AS= library
|
||||
.include "${S}/lib/libkern/Makefile.inc"
|
||||
LIBKERN= ${KERNLIB}
|
||||
machine::
|
||||
-rm -f $@
|
||||
ln -s ${S}/arch/${MACHINE}/include $@
|
||||
|
||||
### find out what to use for libz
|
||||
Z_AS= library
|
||||
.include "${S}/lib/libz/Makefile.inc"
|
||||
LIBZ= ${ZLIB}
|
||||
powerpc::
|
||||
-rm -f $@
|
||||
ln -s ${S}/arch/powerpc/include $@
|
||||
.endif
|
||||
|
||||
### find out what to use for libsa
|
||||
SA_AS= library
|
||||
SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
|
||||
.include "${S}/lib/libsa/Makefile.inc"
|
||||
LIBSA= ${SALIB}
|
||||
vers.c: ${.CURDIR}/../boot/version
|
||||
${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/../boot/version \
|
||||
"bebox" ${NEWVERSWHAT}
|
||||
|
||||
.PHONY: vers.c
|
||||
vers.c: version
|
||||
${HOST_SH} ${S}/conf/newvers_stand.sh ${.CURDIR}/version "bebox" \
|
||||
${NEWVERSWHAT}
|
||||
|
||||
${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN} vers.o
|
||||
${LD} -o ${PROG} -s -N -T ${.CURDIR}/ld.script -Ttext ${RELOC} ${OBJS} \
|
||||
${LIBSA} ${LIBZ} ${LIBKERN} vers.o
|
||||
|
||||
cleandir distclean: cleanlibdir
|
||||
|
||||
cleanlibdir:
|
||||
-rm -rf lib
|
||||
${PROG}: ${OBJS} ${LIBS}
|
||||
${LD} -o ${PROG}.elf -N -T ${.CURDIR}/../boot/ld.script \
|
||||
-Ttext ${RELOC} ${OBJS} ${LIBS}
|
||||
${STRIP} -o ${PROG} ${PROG}.elf
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: boot.c,v 1.16 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: boot.c,v 1.17 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -32,10 +32,13 @@
|
|||
*/
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
#include <loadfile.h>
|
||||
#include <lib/libsa/loadfile.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
#include <sys/boot_flag.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <machine/bootinfo.h>
|
||||
#include <machine/cpu.h>
|
||||
|
||||
#include "boot.h"
|
||||
|
||||
char *names[] = {
|
||||
|
@ -56,7 +59,8 @@ struct btinfo_clock btinfo_clock;
|
|||
|
||||
extern char bootprog_name[], bootprog_rev[], bootprog_maker[], bootprog_date[];
|
||||
|
||||
void exec_kernel __P((char *, void *));
|
||||
void main(void);
|
||||
void exec_kernel(char *, void *);
|
||||
|
||||
void
|
||||
main()
|
||||
|
@ -135,20 +139,16 @@ main()
|
|||
* Exec kernel
|
||||
*/
|
||||
void
|
||||
exec_kernel(name, bootinfo)
|
||||
char *name;
|
||||
void *bootinfo;
|
||||
exec_kernel(char *name, void *bootinfo)
|
||||
{
|
||||
int howto = 0;
|
||||
char c, *ptr;
|
||||
u_long marks[MARK_MAX];
|
||||
#ifdef DBMONITOR
|
||||
int go_monitor;
|
||||
extern int db_monitor __P((void));
|
||||
#endif /* DBMONITOR */
|
||||
extern int tgets __P((char *buf));
|
||||
|
||||
ret:
|
||||
#endif /* DBMONITOR */
|
||||
printf("\nBoot: ");
|
||||
memset(namebuf, 0, sizeof (namebuf));
|
||||
(void)tgets(namebuf);
|
||||
|
@ -194,7 +194,7 @@ next:
|
|||
}
|
||||
#endif /* DBMONITOR */
|
||||
|
||||
printf("start=0x%x\n\n", marks[MARK_ENTRY]);
|
||||
printf("start=0x%lx\n\n", marks[MARK_ENTRY]);
|
||||
delay(1000);
|
||||
__syncicache((void *)marks[MARK_ENTRY],
|
||||
(u_int)marks[MARK_SYM] - (u_int)marks[MARK_ENTRY]);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: boot.h,v 1.6 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: boot.h,v 1.7 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
#define TICKS_PER_SEC (33000000 / 4) /* 33MHz */
|
||||
#define NS_PER_TICK (1000000000 / TICKS_PER_SEC)
|
||||
|
@ -6,70 +6,84 @@
|
|||
/*
|
||||
* srt0
|
||||
*/
|
||||
extern int endaddr __P((void));
|
||||
extern void run __P((void *, void *, void *, void *, void *));
|
||||
int endaddr(void);
|
||||
void run(void *, void *, void *, void *, void *);
|
||||
|
||||
/*
|
||||
* clock
|
||||
*/
|
||||
extern void delay __P((u_int));
|
||||
void delay(u_int);
|
||||
|
||||
/*
|
||||
* com
|
||||
*/
|
||||
extern int comspeed __P((long));
|
||||
int comspeed(long);
|
||||
|
||||
/*
|
||||
* console
|
||||
*/
|
||||
extern char *cninit __P((int *, int *));
|
||||
extern int cngetc __P((void));
|
||||
extern void cnputc __P((int));
|
||||
extern int cnscan __P((void));
|
||||
char *cninit(int *, int *);
|
||||
int cngetc(void);
|
||||
void cnputc(int);
|
||||
int cnscan(void);
|
||||
|
||||
/*
|
||||
* CPU
|
||||
*/
|
||||
extern volatile int CPU1_alive;
|
||||
extern void cpu1 __P((void));
|
||||
extern void resetCPU1 __P((void));
|
||||
extern void runCPU1 __P((void *));
|
||||
extern void start_CPU1 __P((void));
|
||||
extern void wait_for __P((volatile int *));
|
||||
extern int whichCPU __P((void));
|
||||
volatile int CPU1_alive;
|
||||
void cpu1(void);
|
||||
void resetCPU1(void);
|
||||
unsigned long cpuState(void);
|
||||
void runCPU1(void *);
|
||||
void start_CPU1(void);
|
||||
void wait_for(volatile int *);
|
||||
int whichCPU(void);
|
||||
|
||||
/*
|
||||
* inkernel
|
||||
*/
|
||||
extern void init_in __P((void));
|
||||
void init_in(void);
|
||||
|
||||
/*
|
||||
* io
|
||||
*/
|
||||
extern void outb __P((int, char));
|
||||
extern u_char inb __P((int));
|
||||
extern u_long local_to_PCI __P((u_long));
|
||||
void outb(int, char);
|
||||
void outw(int, u_short);
|
||||
u_char inb(int);
|
||||
u_long local_to_PCI(u_long);
|
||||
|
||||
/*
|
||||
* kbd
|
||||
*/
|
||||
extern int kbd __P((int));
|
||||
extern void kbdreset __P((void));
|
||||
extern int kbd_getc __P((void));
|
||||
int kbd(int);
|
||||
void kbdreset(void);
|
||||
int kbd_getc(void);
|
||||
int kbd_test(void);
|
||||
|
||||
/*
|
||||
* video
|
||||
* monitor
|
||||
*/
|
||||
extern void video_init __P((u_char *));
|
||||
extern void video_putc __P((int));
|
||||
int db_monitor(void);
|
||||
|
||||
/*
|
||||
* tgets
|
||||
*/
|
||||
int tgets(char *);
|
||||
|
||||
/*
|
||||
* vga
|
||||
*/
|
||||
extern void vga_init __P((u_char *));
|
||||
extern void vga_putc __P((int));
|
||||
void vga_init(u_char *);
|
||||
void vga_putc(int);
|
||||
void vga_puts(char *);
|
||||
|
||||
/*
|
||||
* vreset
|
||||
*/
|
||||
extern void vga_reset __P((u_char *));
|
||||
void vga_reset(u_char *);
|
||||
|
||||
/*
|
||||
* video
|
||||
*/
|
||||
void video_init(u_char *);
|
||||
void video_putc(int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: clock.c,v 1.10 2005/12/24 22:50:07 perry Exp $ */
|
||||
/* $NetBSD: clock.c,v 1.11 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
|
||||
|
@ -37,6 +37,8 @@
|
|||
#include <dev/ic/i8253reg.h>
|
||||
#include "boot.h"
|
||||
|
||||
static inline u_quad_t mftb(void);
|
||||
|
||||
static inline u_quad_t
|
||||
mftb()
|
||||
{
|
||||
|
@ -52,8 +54,7 @@ mftb()
|
|||
* Wait for about n microseconds (at least!).
|
||||
*/
|
||||
void
|
||||
delay(n)
|
||||
u_int n;
|
||||
delay(u_int n)
|
||||
{
|
||||
u_quad_t tb;
|
||||
u_long tbh, tbl, scratch;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: com.c,v 1.4 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: com.c,v 1.5 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994, 1995, 1996, 1997
|
||||
|
@ -64,12 +64,16 @@
|
|||
* @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
*/
|
||||
#ifdef CONS_SERIAL
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
|
||||
#include "boot.h"
|
||||
|
||||
#define COM_FREQ 1843200 /* 16-bit baud rate divisor */
|
||||
#define COM_TOLERANCE 30 /* baud rate tolerance, in 0.1% units */
|
||||
|
||||
int
|
||||
comspeed(speed)
|
||||
long speed;
|
||||
comspeed(long speed)
|
||||
{
|
||||
#define divrnd(n, q) (((n)*2/(q)+1)/2) /* divide and round off */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: cons.c,v 1.8 2008/03/01 05:21:50 tsutsui Exp $ */
|
||||
/* $NetBSD: cons.c,v 1.9 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -76,23 +76,33 @@
|
|||
* @(#)cons.c 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
#include <sys/param.h>
|
||||
#include "boot.h"
|
||||
#include "cons.h"
|
||||
|
||||
#ifdef CONS_BE
|
||||
void becnprobe(), becninit(), becnputchar();
|
||||
int becngetchar(), becnscan();
|
||||
void becnprobe(struct consdev *);
|
||||
void becninit(struct consdev *);
|
||||
void becnputchar(void *, register int);
|
||||
int becngetchar(void *);
|
||||
int becnscan(void *);
|
||||
#endif
|
||||
|
||||
#ifdef CONS_VGA
|
||||
void vgacnprobe(), vgacninit(), vgacnputchar();
|
||||
int vgacngetchar(), vgacnscan();
|
||||
void vgacnprobe(struct consdev *);
|
||||
void vgacninit(struct consdev *);
|
||||
void vgacnputchar(void *, register int);
|
||||
int vgacngetchar(void *);
|
||||
int vgacnscan(void *);
|
||||
#endif
|
||||
|
||||
#ifdef CONS_SERIAL
|
||||
void siocnprobe(), siocninit(), siocnputchar();
|
||||
int siocngetchar(), siocnscan();
|
||||
void siocnprobe(struct consdev *);
|
||||
void siocninit(struct consdev *);
|
||||
void siocnputchar(void *, register int);
|
||||
int siocngetchar(void *);
|
||||
int siocnscan(void *);
|
||||
# include "ns16550.h"
|
||||
# ifndef COMPORT
|
||||
# define COMPORT COM1
|
||||
|
@ -121,9 +131,7 @@ struct consdev constab[] = {
|
|||
struct consdev *cn_tab;
|
||||
|
||||
char *
|
||||
cninit(addr, speed)
|
||||
int *addr;
|
||||
int *speed;
|
||||
cninit(int *addr, int *speed)
|
||||
{
|
||||
register struct consdev *cp;
|
||||
|
||||
|
@ -147,15 +155,16 @@ cninit(addr, speed)
|
|||
int
|
||||
cngetc()
|
||||
{
|
||||
|
||||
if (cn_tab)
|
||||
return ((*cn_tab->cn_getc)(cn_tab->cn_dev));
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
cnputc(c)
|
||||
int c;
|
||||
cnputc(int c)
|
||||
{
|
||||
|
||||
if (cn_tab)
|
||||
(*cn_tab->cn_putc)(cn_tab->cn_dev, c);
|
||||
}
|
||||
|
@ -163,6 +172,7 @@ cnputc(c)
|
|||
int
|
||||
cnscan()
|
||||
{
|
||||
|
||||
if (cn_tab)
|
||||
return ((*cn_tab->cn_scan)(cn_tab->cn_dev));
|
||||
return -1;
|
||||
|
@ -173,82 +183,80 @@ cnscan()
|
|||
* BeBox default console
|
||||
*/
|
||||
void
|
||||
becnprobe(cp)
|
||||
struct consdev *cp;
|
||||
becnprobe(struct consdev *cp)
|
||||
{
|
||||
|
||||
cp->cn_pri = CN_INTERNAL;
|
||||
}
|
||||
|
||||
void
|
||||
becninit(cp)
|
||||
struct consdev *cp;
|
||||
becninit(struct consdev *cp)
|
||||
{
|
||||
|
||||
video_init((u_char *)cp->address);
|
||||
kbdreset();
|
||||
}
|
||||
|
||||
int
|
||||
becngetchar(dev)
|
||||
void *dev;
|
||||
becngetchar(void *dev)
|
||||
{
|
||||
|
||||
return (kbd_getc());
|
||||
}
|
||||
|
||||
void
|
||||
becnputchar(dev, c)
|
||||
void *dev;
|
||||
register int c;
|
||||
becnputchar(void *dev, register int c)
|
||||
{
|
||||
|
||||
video_putc(c);
|
||||
}
|
||||
|
||||
int
|
||||
becnscan(dev)
|
||||
void *dev;
|
||||
becnscan(void *dev)
|
||||
{
|
||||
|
||||
return (kbd(1));
|
||||
}
|
||||
#endif /* CONS_VGA */
|
||||
#endif /* CONS_BE */
|
||||
|
||||
#ifdef CONS_VGA
|
||||
/*
|
||||
* VGA console
|
||||
*/
|
||||
void
|
||||
vgacnprobe(cp)
|
||||
struct consdev *cp;
|
||||
vgacnprobe(struct consdev *cp)
|
||||
{
|
||||
|
||||
cp->cn_pri = CN_NORMAL;
|
||||
}
|
||||
|
||||
void
|
||||
vgacninit(cp)
|
||||
struct consdev *cp;
|
||||
vgacninit(struct consdev *cp)
|
||||
{
|
||||
|
||||
vga_reset((u_char *)cp->address);
|
||||
vga_init((u_char *)cp->address);
|
||||
kbdreset();
|
||||
}
|
||||
|
||||
int
|
||||
vgacngetchar(dev)
|
||||
void *dev;
|
||||
vgacngetchar(void *dev)
|
||||
{
|
||||
|
||||
return (kbd_getc());
|
||||
}
|
||||
|
||||
void
|
||||
vgacnputchar(dev, c)
|
||||
void *dev;
|
||||
register int c;
|
||||
vgacnputchar(void *dev, register int c)
|
||||
{
|
||||
|
||||
vga_putc(c);
|
||||
}
|
||||
|
||||
int
|
||||
vgacnscan(dev)
|
||||
void *dev;
|
||||
vgacnscan(void *dev)
|
||||
{
|
||||
|
||||
return (kbd(1));
|
||||
}
|
||||
#endif /* CONS_VGA */
|
||||
|
@ -258,41 +266,39 @@ vgacnscan(dev)
|
|||
* serial console
|
||||
*/
|
||||
void
|
||||
siocnprobe(cp)
|
||||
struct consdev *cp;
|
||||
siocnprobe(struct consdev *cp)
|
||||
{
|
||||
|
||||
cp->cn_pri = CN_REMOTE;
|
||||
}
|
||||
|
||||
void
|
||||
siocninit(cp)
|
||||
struct consdev *cp;
|
||||
siocninit(struct consdev *cp)
|
||||
{
|
||||
|
||||
cp->cn_dev = (void *)NS16550_init(cp->address, cp->speed);
|
||||
}
|
||||
|
||||
int
|
||||
siocngetchar(dev)
|
||||
void *dev;
|
||||
siocngetchar(void *dev)
|
||||
{
|
||||
|
||||
return (NS16550_getc((struct NS16550 *)dev));
|
||||
}
|
||||
|
||||
void
|
||||
siocnputchar(dev, c)
|
||||
void *dev;
|
||||
register int c;
|
||||
siocnputchar(void *dev, register int c)
|
||||
{
|
||||
|
||||
if (c == '\n')
|
||||
NS16550_putc((struct NS16550 *)dev, '\r');
|
||||
NS16550_putc((struct NS16550 *)dev, c);
|
||||
}
|
||||
|
||||
int
|
||||
siocnscan(dev, cp)
|
||||
void *dev;
|
||||
struct consdev *cp;
|
||||
siocnscan(void *dev)
|
||||
{
|
||||
|
||||
return (NS16550_scankbd((struct NS16550 *)dev));
|
||||
}
|
||||
#endif /* CONS_SERIAL */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: devopen.c,v 1.8 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: devopen.c,v 1.9 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993 John Brezak
|
||||
|
@ -35,7 +35,12 @@
|
|||
|
||||
#define ispart(c) ((c) >= 'a' && (c) <= 'h')
|
||||
|
||||
int
|
||||
static int atoi(char *);
|
||||
static int devlookup(char *);
|
||||
static int devparse(const char *, int *, int *, int *, int *, int *, char **);
|
||||
|
||||
|
||||
static int
|
||||
atoi(char *cp)
|
||||
{
|
||||
int val = 0;
|
||||
|
@ -45,7 +50,7 @@ atoi(char *cp)
|
|||
return val;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
devlookup(char *d)
|
||||
{
|
||||
struct devsw *dp = devsw;
|
||||
|
@ -67,7 +72,7 @@ devlookup(char *d)
|
|||
* Parse a device spec in one of two forms.
|
||||
* dev(ctlr, unit, part)file
|
||||
*/
|
||||
int
|
||||
static int
|
||||
devparse(const char *fname, int *dev, int *adapt, int *ctlr, int *unit,
|
||||
int *part, char **file)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fd.c,v 1.7 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: fd.c,v 1.8 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1997-1998 Kazuki Sakamoto (sakamoto@NetBSD.org)
|
||||
|
@ -163,30 +163,34 @@ FD_UNIT fd_unit[CTLR_MAX][UNIT_MAX];
|
|||
/*
|
||||
* function declaration
|
||||
*/
|
||||
int fdc_out __P((int, int));
|
||||
int fdc_in __P((int, u_char *));
|
||||
int fdc_intr_wait __P((void));
|
||||
int fd_check __P((FD_UNIT *));
|
||||
void motor_on __P((int, int));
|
||||
void motor_off __P((int, int));
|
||||
void fdReset __P((int));
|
||||
void fdRecalibrate __P((int, int));
|
||||
void fdSpecify __P((int));
|
||||
void fdDriveStatus __P((int, int, int, int *));
|
||||
int fdSeek __P((int, int, int));
|
||||
int fdSenseInt __P((int, int *));
|
||||
int fdReadWrite __P((FD_UNIT *, int, int, int, int, u_char *));
|
||||
void irq_init __P((void));
|
||||
int irq_polling __P((int, int));
|
||||
void dma_setup __P((u_char *, int, int, int));
|
||||
int dma_finished __P((int));
|
||||
int fdinit(FD_UNIT *);
|
||||
int fdopen(struct open_file *, int, int, int);
|
||||
int fdclose(struct open_file *);
|
||||
int fdioctl(struct open_file *, u_long, void *);
|
||||
int fdstrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
int fdc_out(int, int);
|
||||
int fdc_in(int, u_char *);
|
||||
int fdc_intr_wait(void);
|
||||
int fd_check(FD_UNIT *);
|
||||
void motor_on(int, int);
|
||||
void motor_off(int, int);
|
||||
void fdReset(int);
|
||||
void fdRecalibrate(int, int);
|
||||
void fdSpecify(int);
|
||||
void fdDriveStatus(int, int, int, int *);
|
||||
int fdSeek(int, int, int);
|
||||
int fdSenseInt(int, int *);
|
||||
int fdReadWrite(FD_UNIT *, int, int, int, int, u_char *);
|
||||
void irq_init(void);
|
||||
int irq_polling(int, int);
|
||||
void dma_setup(u_char *, int, int, int);
|
||||
int dma_finished(int);
|
||||
|
||||
/*===========================================================================*
|
||||
* fdinit *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdinit(un)
|
||||
FD_UNIT *un;
|
||||
fdinit(FD_UNIT *un)
|
||||
{
|
||||
int ctlr = un->ctlr;
|
||||
u_char result;
|
||||
|
@ -217,18 +221,17 @@ fdinit(un)
|
|||
* fdopen *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdopen(f, ctlr, unit, part)
|
||||
struct open_file *f;
|
||||
int ctlr, unit, part;
|
||||
fdopen(struct open_file *f, int ctlr, int unit, int part)
|
||||
{
|
||||
FD_UNIT *un;
|
||||
int *stat = un->stat;
|
||||
int *stat;
|
||||
|
||||
if (ctlr >= CTLR_MAX)
|
||||
return (ENXIO);
|
||||
if (unit >= UNIT_MAX)
|
||||
return (ENXIO);
|
||||
un = &fd_unit[ctlr][unit];
|
||||
stat = un->stat;
|
||||
|
||||
if (!(un->un_flags & INT_ALIVE)) {
|
||||
if (fdinit(un) != SUCCESS)
|
||||
|
@ -257,8 +260,7 @@ fdopen(f, ctlr, unit, part)
|
|||
* fdclose *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdclose(f)
|
||||
struct open_file *f;
|
||||
fdclose(struct open_file *f)
|
||||
{
|
||||
FD_UNIT *un = f->f_devdata;
|
||||
|
||||
|
@ -273,11 +275,9 @@ fdclose(f)
|
|||
* fdioctl *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdioctl(f, cmd, arg)
|
||||
struct open_file *f;
|
||||
u_long cmd;
|
||||
void *arg;
|
||||
fdioctl(struct open_file *f, u_long cmd, void *arg)
|
||||
{
|
||||
|
||||
switch (cmd) {
|
||||
default:
|
||||
return (EIO);
|
||||
|
@ -290,13 +290,8 @@ fdioctl(f, cmd, arg)
|
|||
* fdstrategy *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdstrategy(devdata, func, blk, size, buf, rsize)
|
||||
void *devdata; /* device uniq data */
|
||||
int func; /* function (read or write) */
|
||||
daddr_t blk; /* block number */
|
||||
size_t size; /* request size in bytes */
|
||||
void *buf; /* buffer */
|
||||
size_t *rsize; /* bytes transferred */
|
||||
fdstrategy(void *devdata, int func, daddr_t blk, size_t size, void *buf,
|
||||
size_t *rsize)
|
||||
{
|
||||
int sectrac, cyl, head, sec;
|
||||
FD_UNIT *un = devdata;
|
||||
|
@ -305,7 +300,7 @@ fdstrategy(devdata, func, blk, size, buf, rsize)
|
|||
int *stat = un->stat;
|
||||
long nblock, blknum;
|
||||
int fd_skip = 0;
|
||||
char *cbuf = (char *)buf;
|
||||
u_char *cbuf = (u_char *)buf;
|
||||
|
||||
if (un->un_flags & INT_BUSY) {
|
||||
return (ENXIO);
|
||||
|
@ -355,8 +350,7 @@ bad:
|
|||
* this function is Check floppy disk Type
|
||||
*/
|
||||
int
|
||||
fd_check(un)
|
||||
FD_UNIT *un;
|
||||
fd_check(FD_UNIT *un)
|
||||
{
|
||||
int ctlr = un->ctlr;
|
||||
int unit = un->unit;
|
||||
|
@ -401,9 +395,7 @@ bad:
|
|||
* fdc_out *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdc_out(ctlr, cmd)
|
||||
int ctlr; /* controller no */
|
||||
int cmd; /* cmd */
|
||||
fdc_out(int ctlr, int cmd)
|
||||
{
|
||||
volatile int status;
|
||||
int time_out;
|
||||
|
@ -425,9 +417,7 @@ fdc_out(ctlr, cmd)
|
|||
* fdc_in *
|
||||
*===========================================================================*/
|
||||
int
|
||||
fdc_in(ctlr, data)
|
||||
int ctlr; /* controller no */
|
||||
u_char *data;
|
||||
fdc_in(int ctlr, u_char *data)
|
||||
{
|
||||
volatile int status;
|
||||
int time_out;
|
||||
|
@ -457,6 +447,7 @@ fdc_in(ctlr, data)
|
|||
int
|
||||
fdc_intr_wait()
|
||||
{
|
||||
|
||||
return (irq_polling(FDC_IRQ, INT_TIMEOUT)); /* wait interrupt */
|
||||
}
|
||||
|
||||
|
@ -464,28 +455,27 @@ fdc_intr_wait()
|
|||
* fdc command function *
|
||||
*===========================================================================*/
|
||||
void
|
||||
motor_on(ctlr, unit)
|
||||
int ctlr;
|
||||
int unit;
|
||||
motor_on(int ctlr, int unit)
|
||||
{
|
||||
|
||||
outb(FDC_DOR(ctlr), DOR_RESET | DOR_DMAEN | unit
|
||||
| (1 << (unit + 4))); /* reset & unit motor on */
|
||||
DELAY(1); /* wait 100msec */
|
||||
}
|
||||
|
||||
void
|
||||
motor_off(ctlr, unit)
|
||||
int ctlr;
|
||||
int unit;
|
||||
motor_off(int ctlr, int unit)
|
||||
{
|
||||
outb(FDC_DOR(ctlr), DOR_RESET); /* reset & motor off */
|
||||
|
||||
outb(FDC_DOR(ctlr), DOR_RESET); /* reset & motor off */
|
||||
if (fdc_intr_wait() == FAIL) /* wait interrupt */
|
||||
printf("fdc: motor off failed.\n");
|
||||
}
|
||||
|
||||
void
|
||||
fdReset(ctlr)
|
||||
fdReset(int ctlr)
|
||||
{
|
||||
|
||||
outb(FDC_DOR(ctlr), 0); /* fdc reset */
|
||||
DELAY(3);
|
||||
outb(FDC_DOR(ctlr), DOR_RESET);
|
||||
|
@ -493,10 +483,9 @@ fdReset(ctlr)
|
|||
}
|
||||
|
||||
void
|
||||
fdRecalibrate(ctlr, unit)
|
||||
int ctlr;
|
||||
int unit;
|
||||
fdRecalibrate(int ctlr, int unit)
|
||||
{
|
||||
|
||||
fdc_out(ctlr, CMD_RECALIBRATE);
|
||||
fdc_out(ctlr, unit);
|
||||
|
||||
|
@ -505,19 +494,17 @@ fdRecalibrate(ctlr, unit)
|
|||
}
|
||||
|
||||
void
|
||||
fdSpecify(ctlr)
|
||||
int ctlr;
|
||||
fdSpecify(int ctlr)
|
||||
{
|
||||
|
||||
fdc_out(ctlr, CMD_SPECIFY);
|
||||
fdc_out(ctlr, SPECIFY1);
|
||||
fdc_out(ctlr, SPECIFY2);
|
||||
}
|
||||
|
||||
void
|
||||
fdDriveStatus(ctlr, unit, head, stat)
|
||||
int ctlr;
|
||||
register int unit, head;
|
||||
register int *stat;
|
||||
fdDriveStatus(int ctlr, register int unit, register int head,
|
||||
register int *stat)
|
||||
{
|
||||
u_char result;
|
||||
|
||||
|
@ -528,10 +515,7 @@ fdDriveStatus(ctlr, unit, head, stat)
|
|||
}
|
||||
|
||||
int
|
||||
fdSeek(ctlr, unit, cyl)
|
||||
int ctlr;
|
||||
int unit;
|
||||
int cyl;
|
||||
fdSeek(int ctlr, int unit, int cyl)
|
||||
{
|
||||
int ret_val = 0;
|
||||
|
||||
|
@ -548,9 +532,7 @@ fdSeek(ctlr, unit, cyl)
|
|||
}
|
||||
|
||||
int
|
||||
fdSenseInt(ctlr, stat)
|
||||
int ctlr;
|
||||
int *stat;
|
||||
fdSenseInt(int ctlr, int *stat)
|
||||
{
|
||||
u_char result;
|
||||
|
||||
|
@ -565,13 +547,7 @@ fdSenseInt(ctlr, stat)
|
|||
}
|
||||
|
||||
int
|
||||
fdReadWrite(un, func, cyl, head, sec, adrs)
|
||||
FD_UNIT *un;
|
||||
int func;
|
||||
int cyl;
|
||||
int head;
|
||||
int sec;
|
||||
u_char *adrs;
|
||||
fdReadWrite(FD_UNIT *un, int func, int cyl, int head, int sec, u_char *adrs)
|
||||
{
|
||||
int i;
|
||||
int ctlr = un->ctlr;
|
||||
|
@ -699,9 +675,7 @@ irq_init()
|
|||
* irq polling check *
|
||||
*===========================================================================*/
|
||||
int
|
||||
irq_polling(irq_no, timeout)
|
||||
int irq_no;
|
||||
int timeout;
|
||||
irq_polling(int irq_no, int timeout)
|
||||
{
|
||||
int irc_no;
|
||||
int data;
|
||||
|
@ -762,11 +736,7 @@ irq_polling(irq_no, timeout)
|
|||
* dma_setup *
|
||||
*===========================================================================*/
|
||||
void
|
||||
dma_setup(buf, size, func, chan)
|
||||
u_char *buf;
|
||||
int size;
|
||||
int func;
|
||||
int chan;
|
||||
dma_setup(u_char *buf, int size, int func, int chan)
|
||||
{
|
||||
u_long pbuf = local_to_PCI((u_long)buf);
|
||||
|
||||
|
@ -790,8 +760,8 @@ dma_setup(buf, size, func, chan)
|
|||
}
|
||||
|
||||
int
|
||||
dma_finished(chan)
|
||||
int chan;
|
||||
dma_finished(int chan)
|
||||
{
|
||||
|
||||
return ((inb(DMA_SR) & 0x0f) == (1 << chan));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: filesystem.c,v 1.6 2008/04/28 20:23:15 martin Exp $ */
|
||||
/* $NetBSD: filesystem.c,v 1.7 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -30,18 +30,9 @@
|
|||
*/
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
#include <ufs.h>
|
||||
#include <cd9660.h>
|
||||
#if 0
|
||||
#include <nfs.h>
|
||||
#endif
|
||||
|
||||
struct fs_ops file_system[] = {
|
||||
FS_OPS(ufs),
|
||||
FS_OPS(cd9660),
|
||||
#if 0
|
||||
FS_OPS(nfs),
|
||||
#endif
|
||||
FS_OPS(null),
|
||||
};
|
||||
|
||||
int nfsys = sizeof (file_system)/sizeof (struct fs_ops);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: inkernel.c,v 1.7 2008/04/28 20:23:15 martin Exp $ */
|
||||
/* $NetBSD: inkernel.c,v 1.8 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -36,22 +36,26 @@
|
|||
|
||||
#define KERNENTRY (RELOC - 0x200000)
|
||||
|
||||
int inopen(struct open_file *);
|
||||
int inclose(struct open_file *);
|
||||
int instrategy(void *, int, daddr_t, size_t, void *, size_t *);
|
||||
|
||||
void
|
||||
init_in()
|
||||
{
|
||||
int p;
|
||||
|
||||
for (p = endaddr(); p < KERNENTRY; p += sizeof (int)) {
|
||||
if (*(int *)p != ENTRY ||
|
||||
if (*(int *)p != BEBOX_ENTRY ||
|
||||
*(int *)(p + sizeof (int)) != 0 ||
|
||||
*(int *)(p + sizeof (int) * 2) != 0)
|
||||
continue;
|
||||
|
||||
p += sizeof (int) * 3;
|
||||
if (memcmp((char *)p, magic, MAGICSIZE) == 0) {
|
||||
kern_len = *(int *)(p + MAGICSIZE);
|
||||
if (memcmp((char *)p, bebox_magic, BEBOX_MAGICSIZE) == 0) {
|
||||
kern_len = *(int *)(p + BEBOX_MAGICSIZE);
|
||||
memcpy((char *)KERNENTRY,
|
||||
(char *)(p + MAGICSIZE + KERNLENSIZE),
|
||||
(char *)(p + BEBOX_MAGICSIZE + KERNLENSIZE),
|
||||
kern_len);
|
||||
break;
|
||||
}
|
||||
|
@ -59,29 +63,24 @@ init_in()
|
|||
}
|
||||
|
||||
int
|
||||
inopen(p)
|
||||
struct open_file *p;
|
||||
inopen(struct open_file *p)
|
||||
{
|
||||
|
||||
if (kern_len)
|
||||
return (0);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
int
|
||||
inclose(p)
|
||||
struct open_file *p;
|
||||
inclose(struct open_file *p)
|
||||
{
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
instrategy(devdata, func, blk, size, buf, rsize)
|
||||
void *devdata; /* device uniq data */
|
||||
int func; /* function (read or write) */
|
||||
daddr_t blk; /* block number */
|
||||
size_t size; /* request size in bytes */
|
||||
void *buf; /* buffer */
|
||||
size_t *rsize; /* bytes transferred */
|
||||
instrategy(void *devdata, int func, daddr_t blk, size_t size, void *buf,
|
||||
size_t *rsize)
|
||||
{
|
||||
|
||||
memcpy(buf, (char *)KERNENTRY + blk * DEV_BSIZE, size);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: io.c,v 1.5 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: io.c,v 1.6 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
|
||||
|
@ -39,23 +39,30 @@ volatile u_char *ISA_io = (u_char *)0x80000000;
|
|||
volatile u_char *ISA_mem = (u_char *)0xC0000000;
|
||||
|
||||
void
|
||||
outb(port, val)
|
||||
int port;
|
||||
char val;
|
||||
outb(int port, char val)
|
||||
{
|
||||
|
||||
ISA_io[port] = val;
|
||||
}
|
||||
|
||||
u_char
|
||||
inb(port)
|
||||
int port;
|
||||
void
|
||||
outw(int port, u_short val)
|
||||
{
|
||||
return (ISA_io[port]);
|
||||
|
||||
outb(port, val >> 8);
|
||||
outb(port + 1, val);
|
||||
}
|
||||
|
||||
u_char
|
||||
inb(int port)
|
||||
{
|
||||
|
||||
return ISA_io[port];
|
||||
}
|
||||
|
||||
u_long
|
||||
local_to_PCI(addr)
|
||||
u_long addr;
|
||||
local_to_PCI(u_long addr)
|
||||
{
|
||||
return ((addr & 0x7FFFFFFF) | 0x80000000);
|
||||
|
||||
return (addr & 0x7FFFFFFF) | 0x80000000;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: monitor.c,v 1.8 2008/04/28 20:23:15 martin Exp $ */
|
||||
/* $NetBSD: monitor.c,v 1.9 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -30,6 +30,9 @@
|
|||
*/
|
||||
|
||||
#include <lib/libsa/stand.h>
|
||||
#include <lib/libkern/libkern.h>
|
||||
|
||||
#include "boot.h"
|
||||
|
||||
extern int errno;
|
||||
extern char *name;
|
||||
|
@ -41,7 +44,7 @@ void db_cmd_mt(int, char **);
|
|||
void db_cmd_put(int, char **);
|
||||
void db_cmd_help(int, char **);
|
||||
|
||||
extern void exec_kernel(char *, void *);
|
||||
int db_atob(char *);
|
||||
|
||||
struct {
|
||||
char *name;
|
||||
|
@ -311,13 +314,14 @@ out:
|
|||
#define STR(x) #x
|
||||
|
||||
#define FUNC(x) \
|
||||
unsigned int mf ## x(void); \
|
||||
void mt ## x(unsigned int); \
|
||||
unsigned int mf ## x() { \
|
||||
unsigned int tmp; \
|
||||
__asm volatile (STR(mf ## x %0) : STR(=r)(tmp)); \
|
||||
return (tmp); \
|
||||
} \
|
||||
void mt ## x(data) \
|
||||
unsigned int data; \
|
||||
void mt ## x(unsigned int data) \
|
||||
{ \
|
||||
__asm volatile (STR(mt ## x %0) :: STR(r)(data)); \
|
||||
} \
|
||||
|
@ -325,7 +329,7 @@ unsigned int data; \
|
|||
#define DEF(x) \
|
||||
{ #x, mf ## x, mt ## x }
|
||||
|
||||
FUNC(msr);
|
||||
FUNC(msr)
|
||||
|
||||
struct {
|
||||
char *op;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: version,v 1.6 2001/11/09 19:53:16 scw Exp $
|
||||
$NetBSD: version,v 1.7 2008/05/26 16:28:39 kiyohara Exp $
|
||||
|
||||
1.1: Boot program for BeBox; initial revision
|
||||
1.2: check BUS FREQ, add clock information
|
||||
|
@ -6,3 +6,5 @@ $NetBSD: version,v 1.6 2001/11/09 19:53:16 scw Exp $
|
|||
1.4: loadfile() update: ELF symbols no longer need backward seeks.
|
||||
1.5: loadfile() update to avoid backwards seeks for ELF Program
|
||||
Headers.
|
||||
1.6: Support framebuffer and vga.
|
||||
Split boot{,_com0,vga}.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vga.c,v 1.7 2005/12/11 12:17:04 christos Exp $ */
|
||||
/* $NetBSD: vga.c,v 1.8 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
|
||||
|
@ -44,13 +44,12 @@
|
|||
#define CGA_BASE 0x3D4
|
||||
#define CGA_BUF 0xB8000
|
||||
|
||||
u_char background = 0; /* Black */
|
||||
u_char foreground = 7; /* White */
|
||||
static u_char background = 0; /* Black */
|
||||
static u_char foreground = 7; /* White */
|
||||
|
||||
u_int addr_6845;
|
||||
u_short *Crtat;
|
||||
int lastpos;
|
||||
int scroll;
|
||||
|
||||
/*
|
||||
* The current state of virtual displays
|
||||
|
@ -86,6 +85,12 @@ struct screen {
|
|||
u_short pccolor; /* color/attributes for tty output */
|
||||
u_short pccolor_so; /* color/attributes, standout mode */
|
||||
|
||||
static void cursor(void);
|
||||
static void initscreen(void);
|
||||
void fillw(u_short, u_short *, int);
|
||||
void video_on(void);
|
||||
void video_off(void);
|
||||
|
||||
/*
|
||||
* cursor() sets an offset (0-1999) into the 80x25 text area
|
||||
*/
|
||||
|
@ -124,10 +129,7 @@ initscreen()
|
|||
}
|
||||
|
||||
void
|
||||
fillw(val, buf, num)
|
||||
u_short val;
|
||||
u_short *buf;
|
||||
int num;
|
||||
fillw(u_short val, u_short *buf, int num)
|
||||
{
|
||||
/* Need to byte swap value */
|
||||
u_short tmp;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vreset.c,v 1.10 2008/03/26 15:09:50 kiyohara Exp $ */
|
||||
/* $NetBSD: vreset.c,v 1.11 2008/05/26 16:28:39 kiyohara Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
|
||||
|
@ -67,8 +67,8 @@ struct VgaRegs
|
|||
#define NREGS 54
|
||||
#define ENDMK 0xFFFF /* End marker */
|
||||
|
||||
#define S3Vendor 0x5333
|
||||
#define CirrusVendor 0x1013
|
||||
#define S3Vendor 0x5333
|
||||
#define CirrusVendor 0x1013
|
||||
#define DiamondVendor 0x100E
|
||||
#define MatroxVendor 0x102B
|
||||
|
||||
|
@ -440,6 +440,7 @@ void enablePCIvideo(int);
|
|||
static int scanPCI(void);
|
||||
static int PCIVendor(int);
|
||||
int delayLoop(int);
|
||||
void writeAttr(u_char, u_char, u_char);
|
||||
void setTextRegs(struct VgaRegs *);
|
||||
void setTextCLUT(void);
|
||||
void loadFont(u_char *);
|
||||
|
@ -448,13 +449,6 @@ void unlockS3(void);
|
|||
static void printslots(void);
|
||||
#endif
|
||||
|
||||
static inline void
|
||||
outw(int port, u_short val)
|
||||
{
|
||||
outb(port, val >> 8);
|
||||
outb(port+1, val);
|
||||
}
|
||||
|
||||
void
|
||||
vga_reset(u_char *ISA_mem)
|
||||
{
|
||||
|
@ -679,7 +673,7 @@ unlockS3(void)
|
|||
/* ============ */
|
||||
|
||||
|
||||
#define NSLOTS 4
|
||||
#define NSLOTS 5
|
||||
#define NPCIREGS 5
|
||||
|
||||
/*
|
||||
|
@ -691,10 +685,11 @@ struct PCI_ConfigInfo {
|
|||
u_long * config_addr;
|
||||
u_long regs[NPCIREGS];
|
||||
} PCI_slots [NSLOTS] = {
|
||||
{ (u_long *)0x80800800, { 0xDE, 0xAD, 0xBE, 0xEF } },
|
||||
{ (u_long *)0x80801000, { 0xDE, 0xAD, 0xBE, 0xEF } },
|
||||
{ (u_long *)0x80802000, { 0xDE, 0xAD, 0xBE, 0xEF } },
|
||||
{ (u_long *)0x80804000, { 0xDE, 0xAD, 0xBE, 0xEF } },
|
||||
{ (u_long *)0x80808000, { 0xDE, 0xAD, 0xBE, 0xEF } },
|
||||
{ (u_long *)0x80810000, { 0xDE, 0xAD, 0xBE, 0xEF } }
|
||||
};
|
||||
|
||||
|
||||
|
@ -705,14 +700,14 @@ struct PCI_ConfigInfo {
|
|||
void
|
||||
enablePCIvideo(int slot)
|
||||
{
|
||||
volatile u_char * ppci;
|
||||
volatile u_char *ppci;
|
||||
|
||||
ppci = (u_char *)PCI_slots[slot].config_addr;
|
||||
ppci[4] = 0x0003; /* enable memory and I/O accesses */
|
||||
ppci = (u_char *)PCI_slots[slot].config_addr;
|
||||
ppci[4] = 0x0003; /* enable memory and I/O accesses */
|
||||
__asm volatile("eieio");
|
||||
|
||||
outb(0x3d4, 0x11);
|
||||
outb(0x3d5, 0x0e); /* unlock CR0-CR7 */
|
||||
outb(0x3d5, 0x0e); /* unlock CR0-CR7 */
|
||||
}
|
||||
|
||||
#define DEVID 0
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2008/05/26 16:28:39 kiyohara Exp $
|
||||
|
||||
BASE=boot_com0
|
||||
|
||||
.include "../boot/Makefile"
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.1 2008/05/26 16:28:39 kiyohara Exp $
|
||||
|
||||
BASE=boot_vga
|
||||
|
||||
.include "../boot/Makefile"
|
|
@ -0,0 +1,52 @@
|
|||
# $NetBSD: Makefile,v 1.1 2008/05/26 16:36:09 kiyohara Exp $
|
||||
|
||||
S= ${.CURDIR}/../../../..
|
||||
|
||||
NOMAN= # defined
|
||||
|
||||
CPPFLAGS+= -D_STANDALONE
|
||||
CPPFLAGS+= -D__daddr_t=int32_t
|
||||
CPPFLAGS+= -I. -I${S} -I${.OBJDIR}
|
||||
CPPFLAGS+= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
|
||||
|
||||
CFLAGS= -Os -mmultiple -ffreestanding
|
||||
|
||||
CLEANFILES+= machine powerpc
|
||||
|
||||
.if !make(obj) && !make(clean) && !make(cleandir)
|
||||
.PHONY: machine-links
|
||||
beforedepend: machine-links
|
||||
|
||||
machine-links:
|
||||
-rm -f machine
|
||||
ln -s ${S}/arch/${MACHINE}/include machine
|
||||
-rm -f ${MACHINE_ARCH}
|
||||
ln -s ${S}/arch/${MACHINE_ARCH}/include ${MACHINE_ARCH}
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
### find out what to use for libkern
|
||||
KERN_AS= library
|
||||
.include "${S}/lib/libkern/Makefile.inc"
|
||||
LIBKERN= ${KERNLIB}
|
||||
|
||||
### find out what to use for libz
|
||||
Z_AS= library
|
||||
.include "${S}/lib/libz/Makefile.inc"
|
||||
LIBZ= ${ZLIB}
|
||||
|
||||
### find out what to use for libsa
|
||||
SA_AS= library
|
||||
SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes SA_INCLUDE_NET=no
|
||||
.include "${S}/lib/libsa/Makefile.inc"
|
||||
LIBSA= ${SALIB}
|
||||
|
||||
LIBS= ${LIBSA} ${LIBZ} ${LIBKERN}
|
||||
|
||||
realall: machine-links ${LIBS}
|
||||
|
||||
cleandir distclean: cleanlibdir
|
||||
|
||||
cleanlibdir:
|
||||
-rm -rf lib
|
Loading…
Reference in New Issue