More major bootblock changes:

1) Rewrite vreset.c completely.  Saves about 1k, and now it sets the
screen up much better.  Previously the resulting video mode looked bad on
my CRT, and my LCD wouldn't even recognize it as a valid mode.  Now it
looks reasonably good and my LCD can talk to it.

2) Call vga_reset unconditionally in the setup process to fix the onboard
VGA.  If you have a VGA and use the serial console, this will allow you
to still use the VGA device for getty/wscons.  Tested on a 7248 with VGA
and a 7043 without VGA.

3) Change filesystem.c to use nullfs rather than ufs and cd9660.  We
don't actually need an fs at all, but it would take a major rewrite to
get rid of them completely.  This saves about 6KB on the bootloader.

4) Bump version to 1.7.
This commit is contained in:
garbled 2006-04-13 18:46:46 +00:00
parent 5cf38f035b
commit ccad384049
8 changed files with 419 additions and 738 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.18 2006/04/10 17:58:59 garbled Exp $
# $NetBSD: Makefile,v 1.19 2006/04/13 18:46:46 garbled Exp $
NOMAN= # defined
@ -26,13 +26,12 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp
CPPFLAGS= -nostdinc -I${.OBJDIR} -I${.CURDIR}/../mkbootimage -I${S}
CPPFLAGS+= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes
CPPFLAGS+= -D_STANDALONE -DRELOC=${RELOC} -DUSE_SCAN
CPPFLAGS+= -D_STANDALONE -DRELOC=${RELOC} -DUSE_SCAN -DVGA_RESET
CPPFLAGS+= -D__daddr_t=int32_t
#CPPFLAGS+= -DDBMONITOR
.if (${BASE} == "boot")
CPPFLAGS+= -DCONS_VGA
#CPPFLAGS+= -DCONS_FB
.elif (${BASE} == "boot_com0")
CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3f8
.endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.c,v 1.13 2006/04/10 18:40:06 garbled Exp $ */
/* $NetBSD: boot.c,v 1.14 2006/04/13 18:46:46 garbled Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -81,6 +81,9 @@ boot(void *resp, u_long loadaddr)
* console init
*/
cnname = cninit(&addr, &speed);
#ifdef VGA_RESET
vga_reset((u_char *)0xc0000000);
#endif
/* make bootinfo */
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: boot.h,v 1.6 2006/04/10 18:40:06 garbled Exp $ */
/* $NetBSD: boot.h,v 1.7 2006/04/13 18:46:46 garbled Exp $ */
#define TICKS_PER_SEC (33000000 / 4) /* 33MHz */
#define NS_PER_TICK (1000000000 / TICKS_PER_SEC)
@ -38,8 +38,12 @@ int inclose(struct open_file *);
* io
*/
void outb(int, char);
inline void outw(int, u_int16_t);
u_char inb(int);
u_long local_to_PCI(u_long);
void unlockVideo(int);
int scan_PCI(int);
int PCI_vendor(int);
/*
* kbd

View File

@ -1,4 +1,4 @@
/* $NetBSD: cons.c,v 1.5 2006/04/10 18:40:06 garbled Exp $ */
/* $NetBSD: cons.c,v 1.6 2006/04/13 18:46:46 garbled Exp $ */
/*
* Copyright (c) 1990, 1993
@ -180,7 +180,6 @@ void
vgacninit(struct consdev *cp)
{
vga_reset((u_char *)cp->address);
vga_init((u_char *)cp->address);
kbdreset();
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: filesystem.c,v 1.1 2000/02/29 15:21:49 nonaka Exp $ */
/* $NetBSD: filesystem.c,v 1.2 2006/04/13 18:46:46 garbled Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -37,18 +37,9 @@
*/
#include <lib/libsa/stand.h>
#include <lib/libsa/ufs.h>
#include <lib/libsa/cd9660.h>
#if 0
#include <nfs.h>
#endif
struct fs_ops file_system[] = {
{ ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, ufs_stat },
{ cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, cd9660_stat },
#if 0
{ nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, nfs_stat },
#endif
{ null_open, null_close, null_read, null_write, null_seek, null_stat },
};
int nfsys = sizeof (file_system)/sizeof (struct fs_ops);

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.2 2006/04/10 18:40:06 garbled Exp $ */
/* $NetBSD: io.c,v 1.3 2006/04/13 18:46:46 garbled Exp $ */
/*-
* Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
@ -33,10 +33,34 @@
*/
#include <lib/libsa/stand.h>
#include <sys/bswap.h>
#include "boot.h"
#define PCI_NSLOTS 8
#define PCI_NREGS 5
#define PCI_DEVID 0
#define PCI_CMD 1
#define PCI_CLASS 2
#define PCI_MEMBASE 4
volatile u_char *ISA_io = (u_char *)0x80000000;
volatile u_char *ISA_mem = (u_char *)0xC0000000;
volatile u_char *ISA_mem = (u_char *)0xc0000000;
volatile char *videomem = (char *)0xc00b8000; /* + vram offset */
struct PCI_cinfo {
u_long *config_addr;
u_long regs[PCI_NREGS];
} PCI_slots[PCI_NSLOTS] = {
{ (u_long *)0x80808000, {0xDEADBEEF,} },
{ (u_long *)0x80800800, {0xDEADBEEF,} },
{ (u_long *)0x80801000, {0xDEADBEEF,} },
{ (u_long *)0x80802000, {0xDEADBEEF,} },
{ (u_long *)0x80804000, {0xDEADBEEF,} },
{ (u_long *)0x80810000, {0xDEADBEEF,} },
{ (u_long *)0x80820000, {0xDEADBEEF,} },
{ (u_long *)0x80840000, {0xDEADBEEF,} },
};
void
outb(int port, char val)
@ -45,6 +69,13 @@ outb(int port, char val)
ISA_io[port] = val;
}
inline void
outw(int port, u_int16_t val)
{
outb(port, val>>8);
outb(port+1, val);
}
u_char
inb(int port)
{
@ -58,3 +89,59 @@ local_to_PCI(u_long addr)
return ((addr & 0x7FFFFFFF) | 0x80000000);
}
void
unlockVideo(int slot)
{
volatile u_int8_t *ppci;
ppci = (u_int8_t *)PCI_slots[slot].config_addr;
ppci[4] = 0x0003; /* enable memory and IO Access */
ppci[0x10] = 0x00000; /* Turn off memory mapping */
ppci[0x11] = 0x00000; /* mem base = 0 */
ppci[0x12] = 0x00000;
ppci[0x13] = 0x00000;
__asm__ volatile("eieio");
outb(0x3d4, 0x11);
outb(0x3d5, 0x0e); /* unlock CR0-CR7 */
}
int
scan_PCI(int start)
{
int slot, r;
struct PCI_cinfo *pslot;
int VGAslot = -1;
int highVGAslot = 0;
for (slot = start + 1; slot < PCI_NSLOTS; slot++) {
pslot = &PCI_slots[slot];
for (r = 0; r < PCI_NREGS; r++)
pslot->regs[r] = bswap32(pslot->config_addr[r]);
if (pslot->regs[PCI_DEVID] != 0xffffffff) {
/* we have a card */
if (((pslot->regs[PCI_CLASS] & 0xffffff00) ==
0x03000000) ||
((pslot->regs[PCI_CLASS] & 0xffffff00) ==
0x00010000)) {
/* it's a VGA card */
highVGAslot = slot;
if ((pslot->regs[PCI_CMD] & 0x03)) {
/* fW enabled it */
VGAslot = slot;
break;
}
}
}
}
return VGAslot;
}
int
PCI_vendor(int slotnum)
{
struct PCI_cinfo *pslot = &PCI_slots[slotnum];
return (pslot->regs[PCI_DEVID] & 0xffff);
}

View File

@ -1,4 +1,4 @@
$NetBSD: version,v 1.9 2006/04/10 18:40:06 garbled Exp $
$NetBSD: version,v 1.10 2006/04/13 18:46:46 garbled Exp $
NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE. The format of this
file is important - make sure the entries are appended on end, last item
@ -12,3 +12,5 @@ is taken as the current.
1.5: Support MPC601.
1.6: Remove fd.c, video.c. Compile without DB_MONITOR. Cleanup,
KNF.
1.7: Rewrite vreset.c, make it work and allways run it. Stop using
cd9660 and ufs, replace with nullfs because we don't need one.

File diff suppressed because it is too large Load Diff