General fixups:

1) Fix support for the powerstack E1.  This machine needs to use the 8259
directly, and cannot use the prep interrupt vector register.  Place a
quirk entry in the table for the machine.
2) Add a new com0_vreset boot image.  The vreset code only works on a few
machines, and breaks others like the 7025-F40.  Its only limitedly useful
when used with the com0, so just make it an optional image the user can
install by hand if they want.
3) Bump the bootloader to 1.8 with the above change.
This commit is contained in:
garbled 2006-06-27 23:26:13 +00:00
parent 22d1eb4faa
commit d0b840b1df
10 changed files with 131 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: platform.h,v 1.13 2006/06/09 01:19:10 garbled Exp $ */
/* $NetBSD: platform.h,v 1.14 2006/06/27 23:26:13 garbled Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -49,6 +49,7 @@ struct platform_quirkdata {
int quirk;
void (*pci_intr_fixup)(void);
void (*reset)(void);
int isa_intr_handler;
};
struct plattab {
@ -63,10 +64,15 @@ struct pciroutinginfo {
#define PLAT_QUIRK_INTRFIXUP (1 << 1)
#define PLAT_QUIRK_RESET (1 << 2)
#define PLAT_QUIRK_ISA_HANDLER (1 << 3)
#define EXT_INTR_I8259 1
#define EXT_INTR_IVR 2
extern struct platform *platform;
extern struct pciroutinginfo *pciroutinginfo;
int find_platform_quirk(const char *model);
void cpu_setup_unknown(struct device *);
void reset_prep(void);
void setup_pciroutinginfo(void);

View File

@ -1,4 +1,4 @@
/* $NetBSD: extintr.c,v 1.23 2006/05/09 03:13:00 garbled Exp $ */
/* $NetBSD: extintr.c,v 1.24 2006/06/27 23:26:13 garbled Exp $ */
/* $OpenBSD: isabus.c,v 1.12 1999/06/15 02:40:05 rahnds Exp $ */
/*-
@ -119,7 +119,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.23 2006/05/09 03:13:00 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.24 2006/06/27 23:26:13 garbled Exp $");
#include "opt_openpic.h"
#include "pci.h"
@ -138,6 +138,7 @@ __KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.23 2006/05/09 03:13:00 garbled Exp $")
#include <machine/psl.h>
#include <machine/trap.h>
#include <machine/platform.h>
#include <machine/residual.h>
#if defined(OPENPIC)
#include <powerpc/openpic.h>
@ -152,15 +153,17 @@ __KERNEL_RCSID(0, "$NetBSD: extintr.c,v 1.23 2006/05/09 03:13:00 garbled Exp $")
static void intr_calculatemasks(void);
static int fakeintr(void *);
static void ext_intr_ivr(void);
static void ext_intr_i8259(void);
#if defined(OPENPIC)
static void ext_intr_openpic(void);
#endif /* OPENPIC */
static void install_extint(void (*)(void));
struct intrsource intrsources[ICU_LEN];
int imen = 0xffffffff;
int imask[NIPL];
struct intrsource intrsources[ICU_LEN];
extern struct platform_quirkdata platform_quirks[];
static int
fakeintr(void *arg)
@ -169,6 +172,63 @@ fakeintr(void *arg)
return 0;
}
/*
* On some machines, specifically the Powerstack E1, we cannot trust the
* IVR register. It returns values offset by 120 for PCI devices, and if
* an interrupt is unhandled, you cannot EOI it in any way. With one of those
* machines with the keyboard removed, we get a single mouse interrupt at
* startup which cannot be handled and the entire machine stops processing
* interrupts.
* This routine is identical to ext_intr_ivr() other than how we get the irq.
*/
static void
ext_intr_i8259(void)
{
u_int8_t irq;
int r_imen, pcpl, msr;
struct cpu_info *ci = curcpu();
struct intrhand *ih;
struct intrsource *is;
pcpl = ci->ci_cpl;
msr = mfmsr();
irq = isa_intr();
is = &intrsources[irq];
r_imen = 1 << irq;
if ((pcpl & r_imen) != 0) {
ci->ci_ipending |= r_imen; /* Masked! Mark this as pending */
imen |= r_imen;
isa_intr_mask(imen);
} else {
splraise(is->is_mask);
mtmsr(msr | PSL_EE);
KERNEL_LOCK(LK_CANRECURSE|LK_EXCLUSIVE);
ih = is->is_hand;
if (ih == NULL)
printf("spurious interrupt %d\n", irq);
while (ih) {
(*ih->ih_fun)(ih->ih_arg);
ih = ih->ih_next;
}
KERNEL_UNLOCK();
mtmsr(msr);
ci->ci_cpl = pcpl;
isa_intr_clr(irq);
uvmexp.intrs++;
is->is_ev.ev_count++;
}
mtmsr(msr | PSL_EE);
splx(pcpl); /* Process pendings. */
mtmsr(msr);
}
/*
* ext_interrupts using the board's interrupt vector register.
*/
@ -664,6 +724,7 @@ init_intr(void)
#if defined(OPENPIC)
unsigned char *baseaddr = (unsigned char *)0xC0006800; /* XXX */
#if NPCI > 0
int i;
struct prep_pci_chipset pc;
pcitag_t tag;
pcireg_t id, address;
@ -706,6 +767,13 @@ init_intr(void)
#endif /* NPCI */
openpic_base = 0;
#endif
i = find_platform_quirk(res->VitalProductData.PrintableModel);
if (i != -1)
if (platform_quirks[i].quirk & PLAT_QUIRK_ISA_HANDLER &&
platform_quirks[i].isa_intr_handler == EXT_INTR_I8259) {
install_extint(ext_intr_i8259);
return;
}
install_extint(ext_intr_ivr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.23 2006/06/21 20:08:11 garbled Exp $ */
/* $NetBSD: mainbus.c,v 1.24 2006/06/27 23:26:13 garbled Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.23 2006/06/21 20:08:11 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.24 2006/06/27 23:26:13 garbled Exp $");
#include "opt_pci.h"
#include "opt_residual.h"
@ -178,6 +178,10 @@ mainbus_attach(struct device *parent, struct device *self, void *aux)
config_found_ia(self, "pcibus", &mba.mba_pba, pcibusprint);
#endif /* NPCI */
#ifdef RESIDUAL_DATA_DUMP
SIMPLEQ_FOREACH(pbi, &prep_pct->pc_pbi, next)
printf("%s\n", prop_dictionary_externalize(pbi->pbi_properties));
#endif
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: platform.c,v 1.19 2006/06/15 18:15:32 garbled Exp $ */
/* $NetBSD: platform.c,v 1.20 2006/06/27 23:26:13 garbled Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.19 2006/06/15 18:15:32 garbled Exp $");
__KERNEL_RCSID(0, "$NetBSD: platform.c,v 1.20 2006/06/27 23:26:13 garbled Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -63,13 +63,14 @@ extern void pci_intr_fixup_ibm_6015(void);
struct platform_quirkdata platform_quirks[] = {
{ "IBM PPS Model 6015", PLAT_QUIRK_INTRFIXUP,
pci_intr_fixup_ibm_6015, NULL },
{ NULL, 0, NULL, NULL }
pci_intr_fixup_ibm_6015, NULL, 0 },
{ "(e1)", PLAT_QUIRK_ISA_HANDLER, NULL, NULL, EXT_INTR_I8259 },
{ NULL, 0, NULL, NULL, 0 }
};
/* find the platform quirk entry for this model, -1 if none */
static int
int
find_platform_quirk(const char *model)
{
int i;
@ -121,8 +122,8 @@ reset_prep(void)
if (platform_quirks[i].quirk & PLAT_QUIRK_RESET &&
platform_quirks[i].reset != NULL)
(*platform_quirks[i].reset)();
} else
reset_prep_generic();
}
reset_prep_generic();
}
/*

View File

@ -1,5 +1,5 @@
# $NetBSD: Makefile,v 1.5 2006/04/13 19:02:19 garbled Exp $
# $NetBSD: Makefile,v 1.6 2006/06/27 23:26:13 garbled Exp $
SUBDIR= common .WAIT boot_com0 boot mkbootimage #installboot
SUBDIR= common .WAIT boot_com0 boot_com0_vreset boot mkbootimage #installboot
.include <bsd.subdir.mk>

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.19 2006/04/13 18:46:46 garbled Exp $
# $NetBSD: Makefile,v 1.20 2006/06/27 23:26:13 garbled Exp $
NOMAN= # defined
@ -26,14 +26,16 @@ 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 -DVGA_RESET
CPPFLAGS+= -D_STANDALONE -DRELOC=${RELOC} -DUSE_SCAN
CPPFLAGS+= -D__daddr_t=int32_t
#CPPFLAGS+= -DDBMONITOR
.if (${BASE} == "boot")
CPPFLAGS+= -DCONS_VGA
CPPFLAGS+= -DCONS_VGA -DVGA_RESET
.elif (${BASE} == "boot_com0")
CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3f8
.elif (${BASE} == "boot_com0_vreset")
CPPFLAGS+= -DCONS_SERIAL -DCOMSPEED=9600 -DCOMPORT=0x3f8 -DVGA_RESET
.endif
STRIPFLAG=

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.3 2006/04/13 18:46:46 garbled Exp $ */
/* $NetBSD: io.c,v 1.4 2006/06/27 23:26:13 garbled Exp $ */
/*-
* Copyright (C) 1995-1997 Gary Thomas (gdt@linuxppc.org)
@ -97,10 +97,12 @@ unlockVideo(int slot)
ppci = (u_int8_t *)PCI_slots[slot].config_addr;
ppci[4] = 0x0003; /* enable memory and IO Access */
#if 0
ppci[0x10] = 0x00000; /* Turn off memory mapping */
ppci[0x11] = 0x00000; /* mem base = 0 */
ppci[0x12] = 0x00000;
ppci[0x13] = 0x00000;
#endif
__asm__ volatile("eieio");
outb(0x3d4, 0x11);

View File

@ -1,4 +1,4 @@
$NetBSD: version,v 1.10 2006/04/13 18:46:46 garbled Exp $
$NetBSD: version,v 1.11 2006/06/27 23:26:13 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
@ -14,3 +14,5 @@ is taken as the current.
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.
1.8: Do not allways run vreset. When resetting, only do the pci
stuff when we find an actual pci card.

View File

@ -1,4 +1,4 @@
/* $NetBSD: vreset.c,v 1.5 2006/04/13 18:46:46 garbled Exp $ */
/* $NetBSD: vreset.c,v 1.6 2006/06/27 23:26:13 garbled Exp $ */
/*-
* Copyright (c) 2006 The NetBSD Foundation, Inc.
* All rights reserved.
@ -167,7 +167,7 @@ static const u_int8_t vga_atc[] = {
void
vga_reset(u_char *ISA_mem)
{
int slot;
int slot, cardfound;
/* check if we are in text mode, if so, punt */
outb(VGA_GR_PORT, 0x06);
@ -177,13 +177,16 @@ vga_reset(u_char *ISA_mem)
/* guess not, we lose. */
slot = -1;
while ((slot = scan_PCI(slot)) > -1) {
unlockVideo(slot);
cardfound = 0;
switch (PCI_vendor(slot)) {
case PCI_VENDOR_CIRRUS:
unlockVideo(slot);
outw(VGA_SR_PORT, 0x0612); /* unlock ext regs */
outw(VGA_SR_PORT, 0x0700); /* reset ext sequence mode */
cardfound++;
break;
case PCI_VENDOR_PARADISE:
unlockVideo(slot);
outw(VGA_GR_PORT, 0x0f05); /* unlock registers */
outw(VGA_SR_PORT, 0x0648);
outw(VGA_CR_PORT, 0x2985);
@ -206,24 +209,29 @@ vga_reset(u_char *ISA_mem)
outw(VGA_CR_PORT, 0x2a95);
}
outw(VGA_CR_PORT, 0x34a0);
cardfound++;
break;
case PCI_VENDOR_S3:
unlockVideo(slot);
unlock_S3();
cardfound++;
break;
default:
break;
}
outw(VGA_SR_PORT, 0x0120); /* disable video */
set_text_regs();
set_text_clut(0);
load_font(ISA_mem);
set_text_regs();
outw(VGA_SR_PORT, 0x0100); /* re-enable video */
clear_video_memory();
if (cardfound) {
outw(VGA_SR_PORT, 0x0120); /* disable video */
set_text_regs();
set_text_clut(0);
load_font(ISA_mem);
set_text_regs();
outw(VGA_SR_PORT, 0x0100); /* re-enable video */
clear_video_memory();
if (PCI_vendor(slot) == PCI_VENDOR_S3)
outb(0x3c2, 0x63); /* ??? */
delay(1000);
if (PCI_vendor(slot) == PCI_VENDOR_S3)
outb(0x3c2, 0x63); /* ??? */
delay(1000);
}
}
return;
}

View File

@ -0,0 +1,5 @@
# $NetBSD: Makefile,v 1.1 2006/06/27 23:26:13 garbled Exp $
BASE=boot_com0_vreset
.include "../boot/Makefile"