From 1eebb3fde337e1d063214fe132ba00a555166fa0 Mon Sep 17 00:00:00 2001 From: uwe Date: Thu, 22 Nov 2001 04:18:28 +0000 Subject: [PATCH] Add patches for Mr.Coffee with OBP2. Miscellaneous cosmetic changes. --- sys/arch/sparc/stand/boot/prompatch.c | 58 ++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/sys/arch/sparc/stand/boot/prompatch.c b/sys/arch/sparc/stand/boot/prompatch.c index fc8ee1554202..2c9bc580cf37 100644 --- a/sys/arch/sparc/stand/boot/prompatch.c +++ b/sys/arch/sparc/stand/boot/prompatch.c @@ -1,4 +1,4 @@ -/* $NetBSD: prompatch.c,v 1.2 2001/09/26 20:53:09 eeh Exp $ */ +/* $NetBSD: prompatch.c,v 1.3 2001/11/22 04:18:28 uwe Exp $ */ /* * Copyright (c) 2001 Valeriy E. Ushakov @@ -52,15 +52,37 @@ struct prom_patch { }; +/* + * Patches for JavaStation 1 with OBP 2.x + */ +static struct patch_entry patch_js1_obp2[] = { + +/* + * Give "su" (com port) "interrupts" property. + */ +{ "su: adding \"interrupts\"", + "\" /obio/su\" open-dev" + " d# 13 \" interrupts\" integer-attribute" + " close-dev" +}, + +/* + * TODO: Create "8042" (pckbc) node. + * Delete "zs" + */ + +{ NULL, NULL } +}; + /* * Patches for JavaStation 1 with OBP 3.* (OpenFirmware). * PROM in these machines is crippled in many ways. */ -static struct patch_entry patch_js1_of[] = { +static struct patch_entry patch_js1_ofw[] = { /* - * JS1/OF has no cpu node in the device tree. Create one to save us a + * JS1/OFW has no cpu node in the device tree. Create one to save us a * _lot_ of headache in cpu.c and mainbus_attach. Mostly copied from * OBP2. While clock-frequency is usually at the root node, add it * here for brevity as kernel checks cpu node for this property anyway. @@ -128,12 +150,13 @@ static struct patch_entry patch_js1_of[] = { }, { NULL, NULL } -}; /* patch_js1_of */ +}; /* patch_js1_ofw */ static struct prom_patch prom_patch_tab[] = { - { "SUNW,JDM1", PROM_OPENFIRM, patch_js1_of }, + { "SUNW,JavaStation-1", PROM_OBP_V2, patch_js1_obp2 }, + { "SUNW,JDM1", PROM_OPENFIRM, patch_js1_ofw }, { NULL, 0, NULL } }; @@ -141,8 +164,7 @@ static struct prom_patch prom_patch_tab[] = { /* * Check if this machine needs tweaks to its PROM. It's simpler to * fix PROM than to invent workarounds in the kernel code. We do this - * patching in the secondary boot to avoid wasting space in the - * kernel. + * patching in the secondary boot to avoid wasting space in the kernel. */ void prom_patch(void) @@ -151,6 +173,9 @@ prom_patch(void) char *propval; struct prom_patch *p; + if (prom_version() == PROM_OLDMON) + return; /* don't bother - no forth in this */ + propval = PROM_getpropstringA(prom_findroot(), "name", namebuf, sizeof(namebuf)); if (propval == NULL) @@ -160,9 +185,24 @@ prom_patch(void) if (p->promvers == prom_version() && strcmp(p->name, namebuf) == 0) { struct patch_entry *e; + const char *promstr = "???"; - printf("Patching PROM v%d for %s\n", - p->promvers, p->name); + switch (prom_version()) { + case PROM_OBP_V0: + promstr = "OBP0"; + break; + case PROM_OBP_V2: + promstr = "OBP2"; + break; + case PROM_OBP_V3: + promstr = "OBP3"; + break; + case PROM_OPENFIRM: + promstr = "OFW"; + break; + } + + printf("Patching %s for %s\n", promstr, p->name); for (e = p->patches; e->message != NULL; ++e) { printf("%s", e->message); prom_interpret(e->patch);