diff options
Diffstat (limited to 'sys')
25 files changed, 2699 insertions, 0 deletions
diff --git a/sys/arch/hppa/stand/Makefile b/sys/arch/hppa/stand/Makefile new file mode 100644 index 00000000000..e9c0b25ef05 --- /dev/null +++ b/sys/arch/hppa/stand/Makefile @@ -0,0 +1,5 @@ +# $OpenBSD: Makefile,v 1.1 1998/06/23 18:46:40 mickey Exp $ + +SUBDIR = libsa libkern libz mkboot boot + +.include <bsd.subdir.mk> diff --git a/sys/arch/hppa/stand/Makefile.inc b/sys/arch/hppa/stand/Makefile.inc new file mode 100644 index 00000000000..1da307b9927 --- /dev/null +++ b/sys/arch/hppa/stand/Makefile.inc @@ -0,0 +1,58 @@ +# $OpenBSD: Makefile.inc,v 1.1 1998/06/23 18:46:40 mickey Exp $ + +CFLAGS=${DEBUG} -O2 -Wall -Werror +CPPFLAGS+=-I${S} -I. -I${.CURDIR} +SACFLAGS=-nostdinc -fno-builtin +SACFLAGS+=-mdisable-fpregs -mfast-indirect-calls -mpa-risc-1-0 +SACFLAGS+=-D_STANDALONE -I${SADIR}/libsa +DEBUGFLAGS=-DDEBUG +# DEBUGFLAGS+=-DEXEC_DEBUG +# DEBUGFLAGS+=-DALLOC_TRACE +# DEBUGFLAGS+=-DBOOTP_DEBUG -DNETIF_DEBUG -DETHER_DEBUG +# DEBUGFLAGS+=-DNFS_DEBUG -DRPC_DEBUG -DRARP_DEBUG +LINKADDR=0x500000 +LOADADDR=0x500000 +HEAP_LIMIT=0x600000 +#ROM_SIZE=32768 +CLEANFILES+= machine + +.if !make(libdep) && !make(sadep) && !make(salibdir) && !make(kernlibdir) && !make(obj) && !(defined(PROG) && ${PROG} == "mkboot") +.BEGIN: + @([ -h machine ] || ln -s $(S)/arch/hppa/include machine) +.endif + +.if $(CC) != $(HOSTCC) +.S.o .s.o: + @echo "${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ + ${AS} -o ${.TARGET}" + @${CPP} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${AINC} ${.IMPSRC} | \ + ${AS} -o ${.TARGET}.o + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o + +.c.o: + ${CC} -S ${CFLAGS} ${CPPFLAGS} ${CFLAGS:M-[ID]*} ${.IMPSRC} + ${AS} $*.s -o ${.TARGET}.o + @rm $*.s + @${LD} -x -r ${.TARGET}.o -o ${.TARGET} + @rm -f ${.TARGET}.o +.endif + +.if exists(${SADIR}/libsa/libsa.a) +LIBSA=${SADIR}/libsa/libsa.a +.else +LIBSA=${SADIR}/libsa/${__objdir}/libsa.a +.endif +.if exists(${SADIR}/libkern/libkern.a) +LIBKERN=${SADIR}/libkern/libkern.a +.else +LIBKERN=${SADIR}/libkern/${__objdir}/libkern.a +.endif +.if exists(${SADIR}/libz/libz.a) +LIBZ=${SADIR}/libz/libz.a +.else +LIBZ=${SADIR}/libz/${__objdir}/libz.a +.endif + +# NO_NET=no_net +BINDIR= /usr/mdec diff --git a/sys/arch/hppa/stand/boot/Makefile b/sys/arch/hppa/stand/boot/Makefile new file mode 100644 index 00000000000..26145f9984c --- /dev/null +++ b/sys/arch/hppa/stand/boot/Makefile @@ -0,0 +1,29 @@ +# $OpenBSD: Makefile,v 1.1 1998/06/23 18:46:41 mickey Exp $ + +PROG= boot +SRCS= srt0.S boot.c cmd.c vars.c bootarg.c conf.c +#AFLAGS+=-Wa,-R +# AFLAGS+=-Wa,-a +LD?= ld +LDFLAGS+=-Bstatic -nostartfiles -nostdlib -N -Ttext $(LINKADDR) +LDFLAGS+=-T ${.CURDIR}/ld.script +#LDFLAGS+=-O -N -S -H -R$(LINKADDR) -e begin -t +SIZE?= size +MAN= boot.8 +MLINKS= boot.8 boot.conf.8 +S =${.CURDIR}/../../../.. +SADIR= ${.CURDIR}/.. + +LDADD= ${LIBSA} ${LIBZ} ${LIBKERN} +DPADD= ${LIBSA} ${LIBZ} ${LIBKERN} + +.PATH: ${S}/stand/boot + +${PROG}: $(OBJS) $(DPADD) + $(LD) $(LDFLAGS) -o $(PROG) $(OBJS) $(LDADD) + @${SIZE} $(PROG) + +.include <bsd.prog.mk> + +CPPFLAGS+=${DEBUGFLAGS} -DRELOC=$(LOADADDR) +CFLAGS+=$(SACFLAGS) diff --git a/sys/arch/hppa/stand/boot/boot.8 b/sys/arch/hppa/stand/boot/boot.8 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/sys/arch/hppa/stand/boot/boot.8 diff --git a/sys/arch/hppa/stand/boot/conf.c b/sys/arch/hppa/stand/boot/conf.c new file mode 100644 index 00000000000..42f1fe95cd9 --- /dev/null +++ b/sys/arch/hppa/stand/boot/conf.c @@ -0,0 +1,75 @@ +/* $OpenBSD: conf.c,v 1.1 1998/06/23 18:46:41 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> +#include <libsa.h> +#include <lib/libsa/ufs.h> +#include <lib/libsa/cd9660.h> +#ifdef notdef +#include <lib/libsa/nfs.h> +#include <lib/libsa/netif.h> +#endif +#include <dev/cons.h> + +const char version[] = "0.01"; +int debug; + +struct fs_ops file_system[] = { + { ufs_open, ufs_close, ufs_read, ufs_write, ufs_seek, + ufs_stat, ufs_readdir }, +#ifdef notdef + { nfs_open, nfs_close, nfs_read, nfs_write, nfs_seek, + nfs_stat, nfs_readdir }, +#endif + { cd9660_open, cd9660_close, cd9660_read, cd9660_write, cd9660_seek, + cd9660_stat, cd9660_readdir }, +}; +int nfsys = NENTS(file_system); + +#ifdef notdef +struct netif_driver *netif_drivers[] = { + NULL +}; +int n_netif_drivers = NENTS(netif_drivers); +#endif + +struct devsw devsw[] = { + { "ct", ctstrategy, ctopen, ctclose, noioctl }, + { "dk", dkstrategy, dkopen, dkclose, noioctl }, +}; +int ndevs = NENTS(devsw); + +struct consdev constab[] = { + { ite_probe, ite_init, ite_getc, ite_putc }, + { NULL } +}; +struct consdev *cn_tab; diff --git a/sys/arch/hppa/stand/boot/ld.script b/sys/arch/hppa/stand/boot/ld.script new file mode 100644 index 00000000000..1730d71fd09 --- /dev/null +++ b/sys/arch/hppa/stand/boot/ld.script @@ -0,0 +1,45 @@ +/* $OpenBSD: ld.script,v 1.1 1998/06/23 18:46:41 mickey Exp $ */ + +OUTPUT_ARCH(hppa) +ENTRY(begin) +SECTIONS +{ + /* Read-only sections, merged into text segment: */ + . = + SIZEOF_HEADERS; + .text : + { + *(.text) + *(.rodata) + *(.rodata1) + *($CODE$) + } + _etext = .; + PROVIDE (etext = .); + /* Read-write sections, merged into data segment: */ + /* . = (. + 0x0FFF) & 0xFFFFF000; */ + .data : + { + *(.data) + *(.data1) + *(.sdata) + *(.sdata2) + *(.dynamic) + CONSTRUCTORS + } + _edata = .; + PROVIDE (edata = .); + . = (. + 0x0FFF) & 0xFFFFF000; + stack_base = .; + . += 8192; + __bss_start = .; + .bss : + { + *(.sbss) *(.scommon) + *(.dynbss) + *(.bss) + *(COMMON) + } + _end = . ; + PROVIDE (end = .); +} + diff --git a/sys/arch/hppa/stand/boot/srt0.S b/sys/arch/hppa/stand/boot/srt0.S new file mode 100644 index 00000000000..93240f22d82 --- /dev/null +++ b/sys/arch/hppa/stand/boot/srt0.S @@ -0,0 +1,211 @@ +/* $OpenBSD: srt0.S,v 1.1 1998/06/23 18:46:41 mickey Exp $ */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +/* + * pmk1.1 + */ +; +; Copyright (c) 1990 mt Xinu, Inc. All rights reserved. +; Copyright (c) 1990 University of Utah. All rights reserved. +; +; This file may be freely distributed in any form as long as +; this copyright notice is included. +; THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR +; IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +; WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. +; +; Utah $Hdr: srt0.c 1.3 94/12/13$ +; + +; +; Startup code for standalone HP700 system. +; + +#include <sys/reboot.h> + +; +; Define our Stack Unwind spaces/variables. +; + .SPACE $TEXT$ +; .SUBSPA $UNWIND_START$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=56 + .EXPORT $UNWIND_START +$UNWIND_START +; .SUBSPA $UNWIND_END$,QUAD=0,ALIGN=8,ACCESS=0x2c,SORT=73 + .EXPORT $UNWIND_END +$UNWIND_END + + + .space $PRIVATE$ + .subspa $DATA$ + .import howto,data + .import rstaddr,data + .import stack_base,data + +; +; Execution begins here. +; +; We are called by the PDC as: +; +; begin(interactive, endaddr) +; +; Where: +; +; interactive - 0 if not interactive, 1 if interactive. +; + .SPACE $TEXT$ +; .SUBSPA $FIRST$ + .EXPORT begin,entry + .IMPORT boot,code + .IMPORT pdc_init,code + .IMPORT end,DATA + +begin + blr %r0,%r5 ; Get address of 'boff' into 'r5', + ldo begin-boff(%r5),%r5 ; and subtract to get 'begin'. +boff + ldil L%RELOC,%r4 + ldo R%RELOC(%r4),%r4 + ldo start-begin(%r4),%rp + ldil L%edata,%r3 + ldo R%edata(%r3),%r3 ; Get address of edata. + ldil L%begin,%r1 + ldo R%begin(%r1),%r1 ; Get address of begin + sub %r3,%r1,%r3 ; Subtract to get # to bytes to copy +copyloop ; do + ldwm 4(%r5),%r1 ; *r4++ = *r5++; + addib,>= -4,%r3,copyloop ; while (--r3 >= 0); + stwm %r1,4(%r4) + + ; here we zero the .bss + ldil L%end, %r3 ; the end af all + ldil L%__bss_start, %r4 ; .bss is here + sub %r3,%r4,%r3 +zeroloop + addib,>= -4,%r3,zeroloop ; while (--r3 >= 0); + stwm %r0,4(%r4) ; *r4++ = 0; + + ldil L%$global$,%dp + ldo R%$global$(%dp),%dp + ldil L%start,%r1 + ldo R%start(%r1),%r1 + sub %dp,%r1,%dp ; Subtract to get difference + add %rp,%dp,%dp ; and relocate it. + +; +; We have relocated ourself to RELOC. If we are running on a machine +; with separate instruction and data caches, we must flush our data +; cache before trying to execute the code starting at rp. +; + ldil L%RELOC,%r22 ; Set %t1 to start of relocated code. + ldo R%RELOC(%r22),%r22 + ldil L%edata,%r21 ; Set r21 to address of edata + ldo R%edata(%r21),%r21 + ldil L%begin,%r1 ; set %r1 to address of begin + ldo R%begin(%r1),%r1 + sub %r21,%r1,%r21 ; Subtract to get length + mtsp %r0,%sr0 ; Set sr0 to kernel space. + ldo -1(%r21),%r21 + fdc %r21(0,%r22) +loop addib,>,n -16,%r21,loop ; Decrement by cache line size (16). + fdc %r21(0,%r22) + fdc 0(0,%r22) ; Flush first word at addr to handle + sync ; arbitrary cache line boundary. + nop ; Prevent prefetching. + nop + nop + nop + nop + nop + nop + bv %r0(%rp) ; Jump to relocated start + stw %rp,rstaddr-$global$(%dp) ; saving address for _rtt. + +start + ldil L%stack_base,%sp + ldo R%stack_base(%sp),%sp + dep %r0,31,6,%sp ; and ensure maximum alignment. + +; bl pdc_init,%rp ; Initialize PDC and related variables +; ldo 64(%sp),%sp ; and push our first stack frame. + + b boot ; Call boot(), + ldw rstaddr-$global$(%dp),%rp ; a return will go back to start(). + +; +; rtt - restart boot device selection (after ^C, etc). +; + .IMPORT howto,DATA + .IMPORT rstaddr,DATA + .EXPORT _rtt +_rtt + ldi RB_ASKNAME+RB_SINGLE,%r1 ; Restarts get RB_SINGLE|RB_ASKNAME + stw %r1,howto-$global$(%dp) ; and save in 'howto'. + ldw rstaddr-$global$(%dp),%rp ; Load restart address into 'rp' + bv,n %r0(%rp) ; and branch to it. + or %r0,%r0,%r0 +#if 0 + .EXPORT execute,entry + .IMPORT pdc,DATA + .PROC + .CALLINFO + .ENTRY +execute + mtsm %r0 ; Disable traps and interrupts. + mtctl %r0,%cr17 ; Clear two-level IIA Space Queue + mtctl %r0,%cr17 ; effectively setting kernel space. + mtctl %arg0,%cr18 ; Stuff entry point into head of IIA + ldo 4(%arg0),%arg0 ; Offset Queue, and entry point + 4 + mtctl %arg0,%cr18 ; into tail of IIA Offset Queue. + ldi 0x9,%arg0 ; Set PSW Q & I bits (collect intrpt + mtctl %arg0,%ipsw ; state, allow external intrpts). + copy %arg2,%arg0 + .EXIT + rfi ; Begin execution of kernel. + nop + .PROCEND + + .export getdp +getdp .proc + .callinfo + + bv 0(%rp) + or %dp,%r0,%ret0 + + .procend + + .export getsp +getsp .proc + .callinfo + + bv 0(%rp) + or %sp,%r0,%ret0 + + .procend +#endif + .SPACE $PRIVATE$ +; .SUBSPA $GLOBAL$ + .EXPORT $global$ +$global$ + .WORD 0 + + .end diff --git a/sys/arch/hppa/stand/libsa/Makefile b/sys/arch/hppa/stand/libsa/Makefile new file mode 100644 index 00000000000..d4187b9b3fc --- /dev/null +++ b/sys/arch/hppa/stand/libsa/Makefile @@ -0,0 +1,51 @@ +# $OpenBSD: Makefile,v 1.1 1998/06/23 18:46:42 mickey Exp $ +# $NOWHERE: Makefile,v 2.1 1998/06/22 19:34:45 mickey Exp $ + +.include "${.CURDIR}/../Makefile.inc" + +LIB= sa + +S=${.CURDIR}/../../../.. +SADIR=${.CURDIR}/.. +DIR_SA= $S/lib/libsa + +NOPROFILE=noprofile +NOPIC=nopic + +#AS=cat ; +#AS+= -R +#AS+= -a + +# hppa stuff +SRCS= machdep.c pdc.c itecons.c dk.c dev_hppa.c exec_hppa.c time.c \ + ct.c dk.c cache_s.s cache_c.c + +# stand routines +SRCS+= alloc.c exit.c exec.c getfile.c gets.c globals.c strcmp.c strlen.c \ + strncmp.c memcmp.c memcpy.c memset.c printf.c strerror.c strncpy.c \ + strtol.c ctime.c + +# io routines +SRCS+= close.c closeall.c dev.c disklabel.c dkcksum.c fstat.c ioctl.c lseek.c \ + open.c read.c stat.c write.c cread.c readdir.c cons.c + +# network routines +SRCS+= arp.c ether.c in_cksum.c net.c netif.c rpc.c + +# network info services +SRCS+= bootp.c bootparam.c rarp.c + +# boot filesystems +SRCS+= ufs.c nfs.c cd9660.c + +.PATH: ${DIR_SA} + +all: ${SALIB} + +install: + +.include <bsd.lib.mk> + +CPPFLAGS+=-DHEAP_LIMIT=${HEAP_LIMIT} ${DEBUGFLAGS} +CPPFLAGS+=-I${S}/stand/boot +CFLAGS+=${SACFLAGS} -D__INTERNAL_LIBSA_CREAD diff --git a/sys/arch/hppa/stand/libsa/cache_c.c b/sys/arch/hppa/stand/libsa/cache_c.c new file mode 100644 index 00000000000..8867755af21 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/cache_c.c @@ -0,0 +1,128 @@ +/* $OpenBSD: cache_c.c,v 1.1 1998/06/23 18:46:41 mickey Exp $ */ +/* $NOWHERE: cache_c.c,v 2.1 1998/06/22 19:34:46 mickey Exp $ */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +/* + * pmk1.1 + */ +/* + * (c) Copyright 1988 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ +/* + * HISTORY + * $Log: cache_c.c,v $ + * Revision 1.1 1998/06/23 18:46:41 mickey + * Initial revision + * + * Revision 2.1 1998/06/22 19:34:46 mickey + * add cache manipulating routines + * + * Revision 1.1.2.1 1996/08/19 07:46:48 bruel + * First revision + * [1996/08/02 09:17:19 bruel] + * + * Revision 1.1.1.2 1996/08/02 09:17:19 bruel + * First revision + * + * Revision 1.1.2.2 91/11/20 16:21:21 sharpe + * Initial version from DSEE + * [91/11/20 16:08:06 sharpe] + * + */ + +/* + * Stolen - Lock, stock, and barrel from tmm's pmap* . + */ + +#include "libsa.h" +#include <machine/pdc.h> + +void +fall(c_base, c_count, c_loop, c_stride, rot) + int c_base, c_count, c_loop, c_stride; + void (*rot)(); +{ + int addr, count, loop; /* Internal vars */ + + addr = c_base; + for (count = 0; count < c_count; count++) { + for (loop = 0; loop < c_loop; loop++) { + (*rot)(0, addr); + } + addr += c_stride; + } + +} + +/* + * fcacheall - Flush all caches. + * + * This routine is just a wrapper around the real cache flush routine. + * + * Parameters: + * None. + * + * Returns: + * Hopefully. + */ +extern int (*pdc)(); +struct pdc_cache pdc_cacheinfo __attribute__ ((aligned(8))); + +void +fcacheall() +{ + extern int fice(); + extern int fdce(); + int err; + + err = (*pdc)(PDC_CACHE, PDC_CACHE_DFLT, &pdc_cacheinfo); + if (err) { +#ifdef DEBUG + if (debug) + printf("fcacheall: PDC_CACHE failed (%d).\n", err); +#endif + return; + } + + /* + * Flush the instruction, then data cache. + */ + fall(pdc_cacheinfo.ic_base, pdc_cacheinfo.ic_count, pdc_cacheinfo.ic_loop, + pdc_cacheinfo.ic_stride, fice); + sync_caches(); + fall(pdc_cacheinfo.dc_base, pdc_cacheinfo.dc_count, pdc_cacheinfo.dc_loop, + pdc_cacheinfo.dc_stride, fdce); + sync_caches(); +} + diff --git a/sys/arch/hppa/stand/libsa/cache_s.s b/sys/arch/hppa/stand/libsa/cache_s.s new file mode 100644 index 00000000000..0812143d4a6 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/cache_s.s @@ -0,0 +1,220 @@ +/* $OpenBSD: cache_s.s,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: cache_s.s,v 2.1 1998/06/22 19:34:46 mickey Exp $ */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +/* + * pmk1.1 + */ +/* + * (c) Copyright 1988 HEWLETT-PACKARD COMPANY + * + * To anyone who acknowledges that this file is provided "AS IS" + * without any express or implied warranty: + * permission to use, copy, modify, and distribute this file + * for any purpose is hereby granted without fee, provided that + * the above copyright notice and this notice appears in all + * copies, and that the name of Hewlett-Packard Company not be + * used in advertising or publicity pertaining to distribution + * of the software without specific, written prior permission. + * Hewlett-Packard Company makes no representations about the + * suitability of this software for any purpose. + */ +/* + * HISTORY + * $Log: cache_s.s,v $ + * Revision 1.1 1998/06/23 18:46:42 mickey + * Initial revision + * + * Revision 2.1 1998/06/22 19:34:46 mickey + * add cache manipulating routines + * + * Revision 1.1.2.1 1996/08/19 07:47:16 bruel + * First revision + * [1996/08/02 09:17:26 bruel] + * + * Revision 1.1.1.2 1996/08/02 09:17:26 bruel + * First revision + * + * Revision 1.1.2.2 91/11/20 16:21:39 sharpe + * Initial version from DSEE + * [91/11/20 16:08:35 sharpe] + * + */ + +/* + * FlushDCache(start,size) + * Stolen from pmap_fdcache. + * void FlushDCache(space, start, end) - Flush the data cache. + * + * This routine flushes the given range of virtual addresses, from start (inclusive) + * to end (exclusive) from the data cache. + * + */ + .space $TEXT$ + .subspa $CODE$ + + .export FlushDCache,entry + .proc + .callinfo +FlushDCache + .entry + + comb,= %arg1,%r0,FDCdone /* If len=0, then done */ + ldi 0x10,%r21 + ldi 0x0f,%r22 + add %arg0,%arg1,%r20 + andcm %arg0,%r22,%arg0 /* Truncate lower bound to stridesize boundary */ + sub %r20,%arg0,%arg1 + ldi 0xff,%r22 + add %arg1,%r22,%arg1 + andcm %arg1,%r22,%arg1 + add %arg0,%arg1,%r20 /* Round up upper bound */ + fdc,m %r21(%arg0) +FDCloop + fdc,m %r21(%arg0) /* Flush block */ + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + fdc,m %r21(%arg0) + comb,<<,n %arg0,%r20,FDCloop /* Continue until fstart = fend */ + fdc,m %r21(%arg0) +FDCdone + bv 0(%rp) /* return */ + nop + .exit + .procend + + .export FlushICache,entry + .proc + .callinfo +FlushICache + .entry + + comb,= %arg1,%r0,PICdone /* If len=0, then done */ + ldi 0x10,%r21 + ldi 0x0f,%r22 + add %arg0,%arg1,%r20 + andcm %arg0,%r22,%arg0 /* Truncate lower bound to stridesize boundary */ + sub %r20,%arg0,%arg1 + ldi 0xff,%r22 + add %arg1,%r22,%arg1 + andcm %arg1,%r22,%arg1 + add %arg0,%arg1,%r20 /* Round up upper bound */ + fic,m %r21(%arg0) +PICloop + fic,m %r21(%arg0) /* Flush block */ + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + fic,m %r21(%arg0) + comb,<<,n %arg0,%r20,PICloop /* Continue until fstart = fend */ + fic,m %r21(%arg0) +PICdone + bv 0(%rp) /* return */ + nop + .exit + .procend + +/* + * void sync_caches - Synchronize the cache. + * + * This routine executes a sync instruction and executes 7 nops. + * Intended to be used with kdb when setting breakpoints. + * Stolen from pmap_as.s. + */ + .export sync_caches,entry + .proc + .callinfo +sync_caches + .entry + + sync /* Sync access */ + nop /* voodoo */ + nop + nop + nop + nop + nop + bv 0(%rp) + nop + .exit + .procend + +/* + * void fdce(space, offset) - Perform fdce operation. + * + * This routine is called by pmap_fcacheall to whack the data cache. Must + * be only used inside an architectured loop. + */ + .export fdce,entry + .proc + .callinfo +fdce + .entry + + fdce 0(0,%arg1) /* Space does not make a difference */ + sync + bv 0(%rp) + nop + .exit + .procend + +/* + * void fice(space, offset) - Perform fice operation. + * + * This routine is called by pmap_fcacheall to whack the instruction cache. + * Must be only used inside an architectured loop + */ + .export fice,entry + .proc + .callinfo +fice + .entry + fice 0(0,%arg1) /* Space does not make a difference */ + sync + bv 0(%rp) + .exit + .procend + + .end + diff --git a/sys/arch/hppa/stand/libsa/ct.c b/sys/arch/hppa/stand/libsa/ct.c new file mode 100644 index 00000000000..f5b3421b92e --- /dev/null +++ b/sys/arch/hppa/stand/libsa/ct.c @@ -0,0 +1,167 @@ +/* $OpenBSD: ct.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: ct.c,v 2.2 1998/06/22 18:41:34 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "libsa.h" + +#include <sys/param.h> +#include <sys/disklabel.h> +#include <sys/reboot.h> +#include <machine/pdc.h> +#include <machine/iodc.h> +#include <machine/iomod.h> + +#include "dev_hppa.h" + +int (*ctiodc)(); /* cartridge tape IODC entry point */ +int ctcode[IODC_MAXSIZE/sizeof(int)]; + +/* hp800-specific comments: + * + * Tape driver ALWAYS uses "Alternate Boot Device", which is assumed to ALWAYS + * be the boot device in pagezero (meaning we booted from it). + * + * NOTE about skipping file, below: It's assumed that a read gets 2k (a page). + * This is done because, even though the cartridge tape has record sizes of 1k, + * and an EOF takes one record, reads through the IODC must be in 2k chunks, + * and must start on a 2k-byte boundary. This means that ANY TAPE FILE TO BE + * SKIPPED OVER IS GOING TO HAVE TO BE AN ODD NUMBER OF 1 KBYTE RECORDS so the + * read of the subsequent file can start on a 2k boundary. If a real error + * occurs, the record count is reset below, so this isn't a problem. + */ +int ctbyteno; /* block number on tape to access next */ +int ctworking; /* flag: have we read anything successfully? */ + +int +#ifdef __STDC__ +ctopen(struct open_file *f, ...) +#else +ctopen(f) + struct open_file *f; +#endif +{ + struct hppa_dev *dp = f->f_devdata; + int i, ret, part = B_PARTITION(dp->bootdev); + + if (ctiodc == 0) { + + if ((ret = (*pdc)(PDC_IODC, PDC_IODC_READ, pdcbuf, ctdev.pz_hpa, + IODC_IO, ctcode, IODC_MAXSIZE)) < 0) { + printf("ct: device ENTRY_IO Read ret'd %d\n", ret); + return (EIO); + } else + ctdev.pz_iodc_io = ctiodc = (int (*)()) ctcode; + } + + if (ctiodc != NULL) + if ((ret = (*ctiodc)(ctdev.pz_hpa, IODC_IO_BOOTIN, ctdev.pz_spa, + ctdev.pz_layers, pdcbuf,0, btbuf,0,0)) < 0) + printf("ct: device rewind ret'd %d\n", ret); + + ctbyteno = 0; + for (i = part; --i >= 0; ) { + ctworking = 0; + for (;;) { + ret = iodc_rw(btbuf, ctbyteno, IONBPG, F_READ, &ctdev); + ctbyteno += IONBPG; + if (ret <= 0) + break; + ctworking = 1; + } + if (ret < 0 && (ret != -4 || !ctworking)) { + printf("ct: error %d after %d %d-byte records\n", + ret, ctbyteno >> IOPGSHIFT, IONBPG); + ctbyteno = 0; + ctworking = 0; + return (EIO); + } + } + ctworking = 0; + return (0); +} + +/*ARGSUSED*/ +int +ctclose(f) + struct open_file *f; +{ + ctbyteno = 0; + ctworking = 0; + + return 0; +} + +int +ctstrategy(devdata, rw, dblk, size, buf, rsize) + void *devdata; + int rw; + daddr_t dblk; + size_t size; + void *buf; + size_t *rsize; +{ + int ret; + + if ((ret = iodc_rw(buf, ctbyteno, size, rw, &ctdev)) < 0) { + if (ret == -4 && ctworking) + ret = 0; + + ctworking = 0; + } else { + ctworking = 1; + ctbyteno += ret; + } + + return (ret); +} diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.c b/sys/arch/hppa/stand/libsa/dev_hppa.c new file mode 100644 index 00000000000..8f7583bb257 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/dev_hppa.c @@ -0,0 +1,195 @@ +/* $OpenBSD: dev_hppa.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: dev_hppa.c,v 2.1 1998/06/17 20:51:54 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include "libsa.h" +#include <sys/param.h> +#include <sys/disklabel.h> +#include <sys/reboot.h> +#include <dev/cons.h> + +#include "dev_hppa.h" + +struct pz_device ctdev; /* cartridge tape (boot) device path */ + +extern int debug; + +const char cdevs[][4] = { + "ite", "", "", "", "", "", "", "", + "", "", "", "", "" +}; +const int ncdevs = NENTS(cdevs); + +const struct pdc_devs { + char name[3]; + int dev_type; +} pdc_devs[] = { + { "ct", 0 }, + { "", -1 }, + { "rd", -1 }, + { "sw", -1 }, + { "fl", 1 }, + { "sd", 1 }, +}; + +/* pass dev_t to the open routines */ +int +devopen(f, fname, file) + struct open_file *f; + const char *fname; + char **file; +{ + register const struct pdc_devs *dp = pdc_devs; + register int rc = 1; + + *file = (char *)fname; + +#ifdef DEBUG + if (debug) + printf("devopen:"); +#endif + + for (dp = pdc_devs; dp < &pdc_devs[NENTS(pdc_devs)]; dp++) + if (strncmp(fname, dp->name, sizeof(dp->name)-1)) + break; + + if (dp >= &pdc_devs[NENTS(pdc_devs)] || dp->dev_type < 0) + return ENODEV; + + if ((rc = (*devsw[dp->dev_type].dv_open)(f, file)) == 0) { + f->f_dev = &devsw[dp->dev_type]; + return 0; + } + + if ((f->f_flags & F_NODEV) == 0) + f->f_dev = &devsw[dp->dev_type]; + + return rc; +} + +void +devboot(bootdev, p) + dev_t bootdev; + char *p; +{ + register const char *q; +#ifdef _TEST + *p++ = '/'; + *p++ = 'd'; + *p++ = 'e'; + *p++ = 'v'; + *p++ = '/'; + *p++ = 'r'; +#endif + /* quick copy device name */ + for (q = pdc_devs[B_TYPE(bootdev)].name; (*p++ = *q++);); + *p++ = '0' + B_UNIT(bootdev); + *p++ = 'a' + B_PARTITION(bootdev); + *p = '\0'; +} + +int pch_pos; + +void +putchar(c) + int c; +{ + switch(c) { + case '\177': /* DEL erases */ + cnputc('\b'); + cnputc(' '); + case '\b': + cnputc('\b'); + if (pch_pos) + pch_pos--; + break; + case '\t': + do + cnputc(' '); + while(++pch_pos % 8); + break; + case '\n': + case '\r': + cnputc(c); + pch_pos=0; + break; + default: + cnputc(c); + pch_pos++; + break; + } +} + +int +getchar() +{ + register int c = cngetc(); + + if (c == '\r') + c = '\n'; + + if ((c < ' ' && c != '\n') || c == '\177') + return(c); + + putchar(c); + + return(c); +} + +char ttyname_buf[8]; +char * +ttyname(fd) + int fd; +{ + sprintf(ttyname_buf, "%s%d", cdevs[major(cn_tab->cn_dev)], + minor(cn_tab->cn_dev)); + return (ttyname_buf); +} + +dev_t +ttydev(name) + char *name; +{ + int i, unit = -1; + char *no = name + strlen(name) - 1; + + while (no >= name && *no >= '0' && *no <= '9') + unit = (unit < 0 ? 0 : (unit * 10)) + *no-- - '0'; + if (no < name || unit < 0) + return (NODEV); + for (i = 0; i < ncdevs; i++) + if (strncmp(name, cdevs[i], no - name + 1) == 0) + return (makedev(i, unit)); + return (NODEV); +} diff --git a/sys/arch/hppa/stand/libsa/dev_hppa.h b/sys/arch/hppa/stand/libsa/dev_hppa.h new file mode 100644 index 00000000000..d7dd2ec23dd --- /dev/null +++ b/sys/arch/hppa/stand/libsa/dev_hppa.h @@ -0,0 +1,43 @@ +/* $OpenBSD: dev_hppa.h,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ + +struct hppa_dev { + dev_t bootdev; + + struct disklabel label; +}; + +#define CN_HPA PAGE0->mem_cons.pz_hpa +#define CN_SPA PAGE0->mem_cons.pz_spa +#define CN_LAYER PAGE0->mem_cons.pz_layers +#define CN_IODC PAGE0->mem_cons.pz_iodc_io +#define CN_CLASS PAGE0->mem_cons.pz_class + +#define KY_HPA PAGE0->mem_kbd.pz_hpa +#define KY_SPA PAGE0->mem_kbd.pz_spa +#define KY_LAYER PAGE0->mem_kbd.pz_layers +#define KY_IODC PAGE0->mem_kbd.pz_iodc_io +#define KY_CLASS PAGE0->mem_kbd.pz_class + +#define BT_HPA PAGE0->mem_boot.pz_hpa +#define BT_SPA PAGE0->mem_boot.pz_spa +#define BT_LAYER PAGE0->mem_boot.pz_layers +#define BT_IODC PAGE0->mem_boot.pz_iodc_io +#define BT_CLASS PAGE0->mem_boot.pz_class + +#define MINIOSIZ 64 /* minimum buffer size for IODC call */ +#define MAXIOSIZ (64 * 1024) /* maximum buffer size for IODC call */ +#define BTIOSIZ (8 * 1024) /* size of boot device I/O buffer */ + +#define IONBPG (2 * 1024) /* page alignment for I/O buffers */ +#define IOPGSHIFT 11 /* LOG2(IONBPG) */ +#define IOPGOFSET (IONBPG-1) /* byte offset into I/O buffer */ + +#define ANYSLOT (-1) +#define NOSLOT (-2) + +extern char btbuf[]; +extern int pdcbuf[]; /* PDC returns, pdc.c */ +extern struct pz_device ctdev; /* cartridge tape (boot) device path */ + +int iodc_rw __P((char *, u_int, u_int, int func, struct pz_device *)); + diff --git a/sys/arch/hppa/stand/libsa/dk.c b/sys/arch/hppa/stand/libsa/dk.c new file mode 100644 index 00000000000..c2bc29be6a3 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/dk.c @@ -0,0 +1,265 @@ +/* $OpenBSD: dk.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "libsa.h" + +#include <sys/param.h> +#include <sys/disklabel.h> +#include <sys/reboot.h> +#include <machine/pdc.h> +#include <machine/iodc.h> +#include <machine/iomod.h> + +#include "dev_hppa.h" + +int (*btiodc)(); /* boot IODC entry point */ + +char btbuf[BTIOSIZ] __attribute ((aligned (MINIOSIZ))); +int HP800; + +void +btinit() +{ + int err; + static int firstime = 1; + + btiodc = (int (*)()) ((unsigned int)PAGE0->mem_free + IODC_MAXSIZE); + + if (firstime) { + /* + * If we _rtt(), we will call btinit() again. + * We only want to do ctdev initialization once. + */ + bcopy((char *)&PAGE0->mem_boot, (char *)&ctdev, + sizeof(struct pz_device)); + firstime = 0; + } + + /* + * Initialize "HP800" to boolean value (T=HP800 F=HP700). + */ + if (!HP800) { + struct pdc_model model; + err = (*pdc)(PDC_MODEL, PDC_MODEL_INFO, &model, 0,0,0,0,0); + if (err < 0) { + HP800 = 1; /* default: HP800 */ + printf("Proc model info ret'd %d (assuming %s)\n", + err, HP800? "HP800": "HP700"); + } + HP800 = (((model.hvers >> 4) & 0xfff) < 0x200); + } +} + +int +dkreset(slot, unit) + int slot, unit; +{ + struct device_path bootdp; + int err, srchtype; + + /* + * Save a copy of the previous boot device path. + */ + bcopy((char *)&PAGE0->mem_boot.pz_dp, (char *)&bootdp, + sizeof(struct device_path)); + + /* + * Read the boot device initialization code into memory. + */ + err = (*pdc)(PDC_IODC, PDC_IODC_READ, pdcbuf, BT_HPA, IODC_INIT, + btiodc, IODC_MAXSIZE); + if (err < 0) { + printf("Boot module ENTRY_INIT Read ret'd %d\n", err); + goto bad; + } + + /* + * Plod over boot devices looking for one with the same unit + * number as that which is in `unit'. + */ + srchtype = IODC_INIT_FIRST; + while (1) { + err = (*btiodc)(BT_HPA,srchtype,BT_SPA,BT_LAYER,pdcbuf,0,0,0,0); + if (err < 0) { + if (err == -9) { + BT_IODC = 0; + return(EUNIT); + } + printf("Boot module ENTRY_INIT Search ret'd %d\n", err); + goto bad; + } + + srchtype = IODC_INIT_NEXT; /* for next time... */ + + if (pdcbuf[1] != PCL_RANDOM) /* only want disks */ + continue; + + if (HP800) { + if (slot != ANYSLOT && slot != BT_LAYER[0]) + continue; + + if (BT_LAYER[1] == unit) { + BT_CLASS = pdcbuf[1]; + break; + } + } else { + if (slot != NOSLOT) + continue; + + if (BT_LAYER[0] == unit) { + BT_CLASS = pdcbuf[1]; + break; + } + } + } + + /* + * If this is not the "currently initialized" boot device, + * initialize the new boot device we just found. + * + * N.B. We do not need/want to initialize the entire module + * (e.g. CIO, SCSI), and doing so may blow away our console. + * if the user specified a boot module other than the + * console module, we initialize both the module and device. + */ + if (bcmp((char *)&PAGE0->mem_boot.pz_dp, (char *)&bootdp, + sizeof(struct device_path)) != 0) { + err = (*btiodc)(BT_HPA,(!HP800||BT_HPA==CN_HPA||BT_HPA==KY_HPA)? + IODC_INIT_DEV: IODC_INIT_ALL, + BT_SPA, BT_LAYER, pdcbuf, 0,0,0,0); + if (err < 0) { + printf("Boot module/device IODC Init ret'd %d\n", err); + goto bad; + } + } + + err = (*pdc)(PDC_IODC, PDC_IODC_READ, pdcbuf, BT_HPA, IODC_IO, + btiodc, IODC_MAXSIZE); + if (err < 0) { + printf("Boot device ENTRY_IO Read ret'd %d\n", err); + goto bad; + } + + BT_IODC = btiodc; + return (0); +bad: + BT_IODC = 0; + return(-1); +} + +const char * +dk_disklabel(dp, label) + struct hppa_dev *dp; + struct disklabel *label; +{ + char buf[DEV_BSIZE]; + size_t ret; + + if (dkstrategy(dp, F_READ, LABELOFFSET, DEV_BSIZE, buf, &ret) || + ret != DEV_BSIZE) + return "cannot read disklbael"; + + return (getdisklabel(buf, label)); +} + +int +#ifdef __STDC__ +dkopen(struct open_file *f, ...) +#else +dkopen(f, va_alist) + struct open_file *f; +#endif +{ + struct disklabel *lp; + struct hppa_dev *dp; + const char *st; + int i; + + if (f->f_devdata == 0) + f->f_devdata = alloc(sizeof *dp); + dp = f->f_devdata; + + bzero(dp, sizeof *dp); + + { + int adapt, ctlr, unit, part, type; + va_list ap; + +#ifdef __STDC__ + va_start(ap, f); +#else + va_start(ap); +#endif + adapt = va_arg(ap, int); + ctlr = va_arg(ap, int); + unit = va_arg(ap, int); + part = va_arg(ap, int); + type = va_arg(ap, int); + va_end(ap); + + dp->bootdev = MAKEBOOTDEV(type, adapt, ctlr, unit, part); + } + lp = &dp->label; + + if ((st = dk_disklabel(dp, lp)) != NULL) { + printf ("%s\n", st); + return ERDLAB; + } + + i = B_PARTITION(dp->bootdev); + if ((unsigned int)i >= lp->d_npartitions || + lp->d_partitions[i].p_size == 0) { + return (EPART); + } + + return (0); +} + +int +dkstrategy(devdata, rw, blk, size, buf, rsize) + void *devdata; + int rw; + daddr_t blk; + size_t size; + void *buf; + size_t *rsize; +{ + int ret; + + ret = iodc_rw(buf, blk, size, rw, &PAGE0->mem_boot); + if (ret < 0) { + printf("dk: iodc ret'd %d\n", ret); + return (-1); + } + + *rsize = ret; + return (ret); +} + +int +dkclose(f) + struct open_file *f; +{ + return 0; +} diff --git a/sys/arch/hppa/stand/libsa/exec_hppa.c b/sys/arch/hppa/stand/libsa/exec_hppa.c new file mode 100644 index 00000000000..9cafb12b97c --- /dev/null +++ b/sys/arch/hppa/stand/libsa/exec_hppa.c @@ -0,0 +1,64 @@ +/* $OpenBSD: exec_hppa.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: exec_hppa.c,v 2.2 1998/06/22 19:34:46 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * This product includes software developed by Tobias Weingartner. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include <sys/param.h> +#include <sys/exec.h> +#include <sys/reboot.h> +#include <dev/cons.h> +#include <stand/boot/bootarg.h> +#include <sys/disklabel.h> +#include "libsa.h" + +#define round_to_size(x) (((int)(x) + sizeof(int) - 1) & ~(sizeof(int) - 1)) + +typedef void (*startfuncp) __P((int, int, int, caddr_t)) + __attribute__ ((noreturn)); + +void +machdep_start(startaddr, howto, loadaddr, ssym, esym) + char *startaddr, *loadaddr, *ssym, *esym; + int howto; +{ + size_t ac = BOOTARG_LEN; + caddr_t av = (caddr_t)BOOTARG_OFF; + makebootargs(av, &ac); + + fcacheall(); + + /* stack and the gung is ok at this point, so, no need for asm setup */ + (*(startfuncp)startaddr)(BOOTARG_APIVER, round_to_size(esym), ac, av); + /* not reached */ +} diff --git a/sys/arch/hppa/stand/libsa/itecons.c b/sys/arch/hppa/stand/libsa/itecons.c new file mode 100644 index 00000000000..533189d93c2 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/itecons.c @@ -0,0 +1,222 @@ +/* $OpenBSD: itecons.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include "libsa.h" + +#include <sys/param.h> +#include <sys/disklabel.h> +#include <machine/pdc.h> +#include <machine/iodc.h> +#include <machine/iomod.h> +#include <dev/cons.h> + +#include "dev_hppa.h" + +int (*cniodc)(); /* console IODC entry point */ +int (*kyiodc)(); /* keyboard IODC entry point */ + +/* + * Console. + */ + +char cnbuf[MINIOSIZ] __attribute__ ((aligned (MINIOSIZ))); +int kycode[IODC_MAXSIZE/sizeof(int)]; + +int +cnspeed(dev, sp) + dev_t dev; + int sp; +{ + return 9600; +} + +void +ite_probe(cn) + struct consdev *cn; +{ + cniodc = (int (*)()) PAGE0->mem_free; + + if ((*pdc) (PDC_IODC, PDC_IODC_READ, pdcbuf, CN_HPA, IODC_INIT, + cniodc, IODC_MAXSIZE) < 0 || + (*cniodc)(CN_HPA, (CN_HPA==BT_HPA)? IODC_INIT_DEV: IODC_INIT_ALL, + CN_SPA, CN_LAYER, pdcbuf, 0,0,0,0) < 0 || + (*pdc) (PDC_IODC, PDC_IODC_READ, pdcbuf, CN_HPA, IODC_IO, + cniodc, IODC_MAXSIZE) < 0) { + /* morse code with the LED's?!! */ + CN_IODC = KY_IODC = NULL; + } else { + cn->cn_pri = CN_INTERNAL; + cn->cn_dev = makedev(0, 0); + } +} + +void +ite_init(cn) + struct consdev *cn; +{ + /* + * If the keyboard is separate from the console output device, + * we load the keyboard code at `kycode'. + * + * N.B. In this case, since the keyboard code is part of the + * boot code, it will be overwritten when we load a kernel. + */ + if (CN_CLASS != PCL_DUPLEX || KY_CLASS == PCL_KEYBD) { + + kyiodc = (int (*)()) kycode; + + if ((*pdc) (PDC_IODC, PDC_IODC_READ, pdcbuf, KY_HPA, + IODC_INIT, kyiodc, IODC_MAXSIZE) < 0 || + (*kyiodc)(KY_HPA, (KY_HPA == BT_HPA || KY_HPA == CN_HPA)? + IODC_INIT_DEV: IODC_INIT_ALL, + KY_SPA, KY_LAYER, pdcbuf, 0,0,0,0) < 0 || + (*pdc) (PDC_IODC, PDC_IODC_READ, pdcbuf, KY_HPA, + IODC_IO, kyiodc, IODC_MAXSIZE)) + kyiodc = NULL; + } else { + kyiodc = cniodc; + + bcopy((char *)&PAGE0->mem_cons, (char *)&PAGE0->mem_kbd, + sizeof(struct pz_device)); + } + + CN_IODC = cniodc; + KY_IODC = kyiodc; +#ifdef DEBUG + if (!kyiodc) + printf("ite_init: no kbd\n"); +#endif +} + +void +ite_putc(dev, c) + dev_t dev; + int c; +{ + if (cniodc == NULL) + return; + + *cnbuf = c; + + (*cniodc)(CN_HPA, IODC_IO_CONSOUT, CN_SPA, CN_LAYER, + pdcbuf, 0, cnbuf, 1, 0); +} + +/* + * since i don't know how to 'just check the char available' + * i store the key into the stash removing on read op later; + */ +int +ite_getc(dev) + dev_t dev; +{ + static int stash = 0; + register int err; + register int c, l; + + if (kyiodc == NULL) + return(0x100); + + if (stash) { + if (dev & 0x80) + return stash; + else { + c = stash; + stash = 0; + return stash; + } + } + + do { + err = (*kyiodc)(KY_HPA, IODC_IO_CONSIN, KY_SPA, KY_LAYER, + pdcbuf, 0, cnbuf, 1, 0); + l = pdcbuf[0]; + stash = c = cnbuf[0]; +#ifdef DEBUG + if (debug && err < 0) + printf("KBD input error: %d", err); +#endif + + /* if we are doing ischar() report immidiatelly */ + if (dev & 0x80 && l == 0) { +#ifdef DEBUG + if (debug > 2) + printf("ite_getc(0x%x): no char %d(%x)\n", + dev, l, c); +#endif + return (0); + } + } while(!l); + +#if DEBUG + if (debug && l > 1) + printf("KBD input got too much (%d)\n", l); + + if (debug > 3) + printf("kbd: \'%c\' (0x%x)\n", c, c); +#endif + if (!(dev & 0x80)) + stash = 0; + + return (c); +} + +void +ite_pollc(dev, on) + dev_t dev; + int on; +{ + +} + diff --git a/sys/arch/hppa/stand/libsa/libsa.h b/sys/arch/hppa/stand/libsa/libsa.h new file mode 100644 index 00000000000..becb1fcdfa3 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/libsa.h @@ -0,0 +1,60 @@ +/* $OpenBSD: libsa.h,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: libsa.h,v 2.2 1998/06/22 19:34:47 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <lib/libsa/stand.h> + +void pdc_init __P((void)); +void getbinfo __P((void)); + +int ctstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); +int ctopen __P((struct open_file *, ...)); +int ctclose __P((struct open_file *)); +int ctioctl __P((struct open_file *, u_long, void *)); + +int dkstrategy __P((void *, int, daddr_t, size_t, void *, size_t *)); +int dkopen __P((struct open_file *, ...)); +int dkclose __P((struct open_file *)); +int dkioctl __P((struct open_file *, u_long, void *)); + +void ite_probe __P((struct consdev *)); +void ite_init __P((struct consdev *)); +int ite_getc __P((dev_t)); +void ite_putc __P((dev_t, int)); +void ite_pollc __P((dev_t, int)); + +void machdep __P((void)); +void devboot __P((dev_t, char *)); +void fcacheall __P((void)); +void sync_caches __P((void)); + +extern int debug; diff --git a/sys/arch/hppa/stand/libsa/machdep.c b/sys/arch/hppa/stand/libsa/machdep.c new file mode 100644 index 00000000000..421c190de86 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/machdep.c @@ -0,0 +1,47 @@ +/* $OpenBSD: machdep.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: machdep.c,v 2.0 1998/06/17 20:49:17 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "libsa.h" + +int howto, bootdev; + +void +machdep() +{ + pdc_init(); +#ifdef notyet + debug_init(); +#endif + cninit(); + getbinfo(); +} diff --git a/sys/arch/hppa/stand/libsa/pdc.c b/sys/arch/hppa/stand/libsa/pdc.c new file mode 100644 index 00000000000..686dc1492a9 --- /dev/null +++ b/sys/arch/hppa/stand/libsa/pdc.c @@ -0,0 +1,208 @@ +/* $OpenBSD: pdc.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ + +/* + * Copyright 1996 1995 by Open Software Foundation, Inc. + * All Rights Reserved + * + * Permission to use, copy, modify, and distribute this software and + * its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notice appears in all copies and + * that both the copyright notice and this permission notice appear in + * supporting documentation. + * + * OSF DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE. + * + * IN NO EVENT SHALL OSF BE LIABLE FOR ANY SPECIAL, INDIRECT, OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM + * LOSS OF USE, DATA OR PROFITS, WHETHER IN ACTION OF CONTRACT, + * NEGLIGENCE, OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION + * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ +/* + * Copyright (c) 1990 mt Xinu, Inc. All rights reserved. + * Copyright (c) 1990 University of Utah. All rights reserved. + * + * This file may be freely distributed in any form as long as + * this copyright notice is included. + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Utah $Hdr: pdc.c 1.8 92/03/14$ + */ + +#include <sys/time.h> +#include "libsa.h" +#include <sys/reboot.h> +#include <sys/disklabel.h> + +#include "dev_hppa.h" + +#include <machine/pdc.h> +#include <machine/iodc.h> +#include <machine/iomod.h> +#include <machine/nvm.h> + +#define MIN(a,b) ((a) < (b) ? (a) : (b)) + +/* + * Interface routines to initialize and access the PDC. + */ + +int (*pdc)(); +int pdcbuf[64] __attribute ((aligned(8))); /* PDC return buffer */ +struct stable_storage sstor; /* contents of Stable Storage */ +int sstorsiz; /* size of Stable Storage */ +unsigned int rstaddr; +struct bootdata bd; +int bdsize = sizeof(struct bootdata); +unsigned int chasdata; + +extern unsigned int howto, bootdev; + +/* + * Initialize PDC and related variables. + */ +void +pdc_init() +{ + int err; + + /* + * Initialize important global variables (defined above). + */ + pdc = PAGE0->mem_pdc; + + err = (*pdc)(PDC_STABLE, PDC_STABLE_SIZE, pdcbuf, 0, 0); + if (err >= 0) { + sstorsiz = MIN(pdcbuf[0],sizeof(sstor)); + err = (*pdc)(PDC_STABLE, PDC_STABLE_READ, 0, &sstor, sstorsiz); + } + + /* + * Now that we (may) have an output device, if we encountered + * an error reading Stable Storage (above), let them know. + */ + if (err) + printf("Stable storage PDC_STABLE Read Ret'd %d\n", err); + + /* + * Clear the FAULT light (so we know when we get a real one) + */ + chasdata = PDC_OSTAT(PDC_OSTAT_BOOT) | 0xCEC0; + (void) (*pdc)(PDC_CHASSIS, PDC_CHASSIS_DISP, chasdata); +} + +/* + * Read in `bootdev' and `howto' from Non-Volatile Memory. + */ +void +getbinfo() +{ + int err; + + /* + * Try to read bootdata from NVM through PDC. + * If successful, set `howto' and `bootdev'. + */ + if ((err = (*pdc)(PDC_NVM, PDC_NVM_READ, NVM_BOOTDATA, &bd, bdsize)) < 0) { + /* + * First, determine if this machine has Non-Volatile Memory. + * If not, just return (until we come up with a new plan)! + */ + if (err == -1) /* Nonexistent procedure */ + return; + printf("NVM bootdata Read ret'd %d\n", err); + } else { + if (bd.cksum == NVM_BOOTCKSUM(bd)) { + /* + * The user may override the PDC auto-boot, setting + * an interactive boot. We give them this right by + * or'ing the bootaddr flags into `howto'. + */ + howto |= bd.flags; + bootdev = bd.device; + } else { + printf("NVM bootdata Bad Checksum (%x)\n", bd.cksum); + } + } + + /* + * Reset the bootdata to defaults (if necessary). + */ + if (bd.flags != RB_AUTOBOOT || bd.device != 0) { + bd.flags = RB_AUTOBOOT; + bd.device = 0; + bd.cksum = NVM_BOOTCKSUM(bd); + if ((err = (*pdc)(PDC_NVM, PDC_NVM_WRITE, NVM_BOOTDATA, + &bd, bdsize)) < 0) + printf("NVM bootdata Write ret'd %d\n", err); + } +} + +/* + * Generic READ/WRITE through IODC. Takes pointer to PDC device + * information, returns (positive) number of bytes actually read or + * the (negative) error condition, or zero if at "EOF". + */ +int +iodc_rw(maddr, daddr, count, func, pzdev) + char * maddr; /* io->i_ma = labelbuf */ + unsigned int daddr; + unsigned int count; /* io->i_cc = DEV_BSIZE */ + int func; + struct pz_device *pzdev; +{ + register int offset; + register int xfer_cnt = 0; + register int ret; + + if (pzdev == 0) /* default: use BOOT device */ + pzdev = &PAGE0->mem_boot; + + if (pzdev->pz_iodc_io == 0) + return(-1); + + /* + * IODC arguments are constrained in a number of ways. If the + * request doesn't fit one or more of these constraints, we have + * to do the transfer to a buffer and copy it. + */ + if ((((int)maddr)&(MINIOSIZ-1))||(count&IOPGOFSET)||(daddr&IOPGOFSET)) + for (; count > 0; count -= ret, maddr += ret, daddr += ret) { + offset = daddr & IOPGOFSET; + if ((ret = (*pzdev->pz_iodc_io)(pzdev->pz_hpa, + (func == F_READ)? IODC_IO_BOOTIN: + IODC_IO_BOOTOUT, + pzdev->pz_spa, pzdev->pz_layers, pdcbuf, + daddr - offset, btbuf, BTIOSIZ, + BTIOSIZ)) < 0) + return (ret); + if ((ret = pdcbuf[0]) == 0) + break; + if ((ret -= offset) > count) + ret = count; + bcopy(btbuf + offset, maddr, ret); + xfer_cnt += ret; + } + else + for (; count > 0; count -= ret, maddr += ret, daddr += ret) { + if ((offset = count) > MAXIOSIZ) + offset = MAXIOSIZ; + if ((ret = (*pzdev->pz_iodc_io)(pzdev->pz_hpa, + (func == F_READ)? IODC_IO_BOOTIN: + IODC_IO_BOOTOUT, + pzdev->pz_spa, pzdev->pz_layers, + pdcbuf, daddr, maddr, offset, + count)) < 0) + return (ret); + if ((ret = pdcbuf[0]) == 0) + break; + xfer_cnt += ret; + } + + return (xfer_cnt); +} diff --git a/sys/arch/hppa/stand/libsa/time.c b/sys/arch/hppa/stand/libsa/time.c new file mode 100644 index 00000000000..81311f9fb9d --- /dev/null +++ b/sys/arch/hppa/stand/libsa/time.c @@ -0,0 +1,62 @@ +/* $OpenBSD: time.c,v 1.1 1998/06/23 18:46:42 mickey Exp $ */ +/* $NOWHERE: time.c,v 2.2 1998/06/23 05:26:53 mickey Exp $ */ + +/* + * Copyright (c) 1998 Michael Shalayeff + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Michael Shalayeff. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/types.h> +#include <machine/pdc.h> +#include <sys/disklabel.h> +#include "libsa.h" +#include "dev_hppa.h" + +time_t +getsecs() +{ + int err; + register time_t tt; + + if ((err = (*pdc)(PDC_TOD, PDC_TOD_READ, &pdcbuf)) < 0) { + tt = 0; +#ifdef DEBUG + if (debug) + printf("getsecs: TOD read failed (%d)\n", err); +#endif + } else { + tt = ((struct pdc_tod *)pdcbuf)->sec; +#ifdef DEBUG + if (debug && tt < 800000000) + printf("getsecs: got %lu seconds\n", tt); +#endif + } + + return tt; +} + diff --git a/sys/arch/hppa/stand/libz/Makefile b/sys/arch/hppa/stand/libz/Makefile new file mode 100644 index 00000000000..191c38e994e --- /dev/null +++ b/sys/arch/hppa/stand/libz/Makefile @@ -0,0 +1,10 @@ +# $OpenBSD: Makefile,v 1.1 1998/06/23 18:46:42 mickey Exp $ + +S=${.CURDIR}/../../../.. +ZDST=${.OBJDIR} +SADIR=${.CURDIR}/.. + +.PATH: ${S}/lib/libz + +.include "${S}/lib/libz/Makefile" +CFLAGS+=${SACFLAGS} -I${S}/lib/libsa -DDYNAMIC_CRC_TABLE diff --git a/sys/arch/hppa/stand/mkboot/Makefile b/sys/arch/hppa/stand/mkboot/Makefile new file mode 100644 index 00000000000..d8a98a1633c --- /dev/null +++ b/sys/arch/hppa/stand/mkboot/Makefile @@ -0,0 +1,11 @@ +# $OpenBSD: Makefile,v 1.1 1998/06/23 18:46:43 mickey Exp $ + +PROG= mkboot +CC= ${HOSTCC} +CFLAGS+=-g +LDSTATIC= -static +MAN= mkboot.8 +S= ${.CURDIR}/../../../.. +SADIR= ${.CURDIR)/.. + +.include <bsd.prog.mk> diff --git a/sys/arch/hppa/stand/mkboot/mkboot.8 b/sys/arch/hppa/stand/mkboot/mkboot.8 new file mode 100644 index 00000000000..e69de29bb2d --- /dev/null +++ b/sys/arch/hppa/stand/mkboot/mkboot.8 diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c new file mode 100644 index 00000000000..2f8eda1bc23 --- /dev/null +++ b/sys/arch/hppa/stand/mkboot/mkboot.c @@ -0,0 +1,435 @@ +/* $OpenBSD: mkboot.c,v 1.1 1998/06/23 18:46:43 mickey Exp $ */ + +/* + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)mkboot.c 8.1 (Berkeley) 7/15/93 + */ + +#if 0 +#ifndef lint +static char copyright[] = +"@(#) Copyright (c) 1990, 1993\n\ + The Regents of the University of California. All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +static char rcsid[] = "$OpenBSD: mkboot.c,v 1.1 1998/06/23 18:46:43 mickey Exp $"; +#endif /* not lint */ +#endif + +#include <sys/param.h> +#include <sys/file.h> +#include <sys/stat.h> +#include <string.h> +#include <stdlib.h> +#include <unistd.h> +#include <time.h> +#ifdef __OpenBSD__ +#include <err.h> +#endif + +#include <sys/exec_aout.h> +#include <sys/exec_elf.h> + +#include "volhdr.h" + +#include <stdio.h> +#include <ctype.h> + +int putfile __P((char *, int)); +void __dead usage __P((void)); +void bcddate __P((char *, char *)); +char *lifname __P((char *)); +int cksum __P((int, int *, int)); + +#define LIF_NUMDIR 8 + +#define LIF_VOLSTART 0 +#define LIF_VOLSIZE sizeof(struct lifvol) +#define LIF_DIRSTART 2048 +#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) +#define LIF_FILESTART 4096 + +#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE) +#define lifstob(s) ((s) * SECTSIZE) + +char *to_file; +int loadpoint, verbose; +u_long entry; +#ifndef __OpenBSD__ +char *__progname = "mkboot"; +#endif + +/* + * Old Format: + * sector 0: LIF volume header (40 bytes) + * sector 1: <unused> + * sector 2: LIF directory (8 x 32 == 256 bytes) + * sector 3-: LIF file 0, LIF file 1, etc. + * where sectors are 256 bytes. + * + * New Format: + * sector 0: LIF volume header (40 bytes) + * sector 1: <unused> + * sector 2: LIF directory (8 x 32 == 256 bytes) + * sector 3: <unused> + * sector 4-31: disklabel (~300 bytes right now) + * sector 32-: LIF file 0, LIF file 1, etc. + */ +int +main(argc, argv) + char **argv; +{ + int to; + register int n, pos, c; + char buf[LIF_FILESTART]; + struct lifvol *lifv = (struct lifvol *)buf; + struct lifdir *lifd = (struct lifdir *)(buf + LIF_DIRSTART); + + while ((c = getopt(argc, argv, "vl:")) != EOF) { + switch (c) { + case 'v': + verbose++; + break; + case 'l': + sscanf(optarg, "0x%x", &loadpoint); + break; + default: + usage(); + } + } + if (argc - optind < 2) + usage(); + else if (argc - optind > 8) + errx(1, "too many boot programs (max 8 supported)"); + + to_file = argv[--argc]; + if ((to = open(to_file, O_RDWR | O_TRUNC | O_CREAT, 0644)) < 0) + err(1, "%s: open", to_file); + + bzero(buf, sizeof(buf)); + /* clear possibly unused directory entries */ + strncpy(lifd[1].dir_name, " ", 10); + lifd[1].dir_type = -1; + lifd[1].dir_addr = 0; + lifd[1].dir_length = 0; + lifd[1].dir_flag = 0xFF; + lifd[1].dir_implement = 0; + lifd[7] = lifd[6] = lifd[5] = lifd[4] = lifd[3] = lifd[2] = lifd[1]; + + /* record volume info */ + lifv->vol_id = htobe16(VOL_ID); + strncpy(lifv->vol_label, "BOOT44", 6); + lifv->vol_addr = htobe32(btolifs(LIF_DIRSTART)); + lifv->vol_oct = htobe16(VOL_OCT); + lifv->vol_dirsize = htobe32(btolifs(LIF_DIRSIZE)); + lifv->vol_version = htobe16(1); + lifv->vol_lastvol = lifv->vol_number = htobe16(1); + lifv->vol_length = LIF_FILESTART; + bcddate(to_file, lifv->vol_toc); + lifv->ipl_addr = htobe32(LIF_FILESTART); + lifv->ipl_size = 0; + lifv->ipl_entry = 0; + + argv += optind; + argc -= optind; + optind = 0; + for (pos = btolifs(LIF_FILESTART); optind < argc; optind++) { + + /* output bootfile */ + lseek(to, lifstob(pos), 0); + lifd[optind].dir_addr = htobe32(pos); + n = btolifs(putfile(argv[optind], to)); + if (lifv->ipl_entry == 0) { + lifv->ipl_entry = htobe32(loadpoint + entry); + lifv->ipl_size = htobe32(lifstob(n)); + lifd[optind].dir_type = htobe16(DIR_ISL); + lifd[optind].dir_implement = 0; + } else { + lifd[optind].dir_type = htobe16(DIR_TYPE); + lifd[1].dir_implement = htobe32(loadpoint + entry); + } + + strcpy(lifd[optind].dir_name, lifname(argv[optind])); + lifd[optind].dir_length = htobe32(n); + bcddate(argv[optind], lifd[optind].dir_toc); + lifd[optind].dir_flag = htobe16(DIR_FLAG); + + lifv->vol_length += n; + pos += lifstob(n); + } + + lifv->vol_length = htobe32(lifv->vol_length); + + /* output volume/directory header info */ + lseek(to, LIF_VOLSTART, 0); + if (write(to, buf, sizeof(buf)) != sizeof(buf)) + err(1, "%s: write LIF volume", to_file); + lseek(to, 0, SEEK_END); + + if (close(to) < 0) + err(1, to_file); + + return(0); +} + +int +putfile(from_file, to) + char *from_file; + int to; +{ + struct exec ex; + register int n, total; + char buf[2048]; + int from, check_sum = 0; + struct load load; + + if ((from = open(from_file, O_RDONLY)) < 0) + err(1, from_file); + + n = read(from, &ex, sizeof(ex)); + if (n != sizeof(ex)) + err(1, "%s: reading file header", from_file); + + entry = ex.a_entry; + if (N_GETMAGIC(ex) == OMAGIC || N_GETMAGIC(ex) == NMAGIC) + entry += sizeof(ex); + + else if (IS_ELF(*(Elf32_Ehdr *)&ex)) { + Elf32_Ehdr elf_header; + Elf32_Phdr *elf_segments; + int i,header_count, memory_needed, elf_load_image_segment; + + (void) lseek(from, 0, L_SET); + n = read(from, &elf_header, sizeof (elf_header)); + if (n != sizeof (elf_header)) + err(1, "%s: reading ELF header", from_file); + header_count = ntohs(elf_header.e_phnum); + memory_needed = header_count * sizeof (Elf32_Phdr); + elf_segments = (Elf32_Phdr *)malloc(memory_needed); + if (elf_segments == NULL) + err(1, "malloc"); + (void) lseek(from, ntohl(elf_header.e_phoff), L_SET); + n = read(from, elf_segments, memory_needed); + if (n != memory_needed) + err(1, "%s: reading ELF segments", from_file); + elf_load_image_segment = -1; + for (i = 0; i < header_count; i++) { + if (elf_segments[i].p_filesz && + ntohl(elf_segments[i].p_flags) & PF_X) { + if (elf_load_image_segment != -1) + errx(1, "%s: more than one ELF program segment", from_file); + elf_load_image_segment = i; + } + if (elf_load_image_segment == -1) + errx(1, "%s: no suitable ELF program segment", from_file); + } + entry = ntohl(elf_header.e_entry) + + ntohl(elf_segments[elf_load_image_segment].p_offset) - + ntohl(elf_segments[elf_load_image_segment].p_vaddr); + } else + errx(1, "%s: bad magic number\n", from_file); + + entry += sizeof(load); + lseek(to, sizeof(load), SEEK_CUR); + total = 0; + n = sizeof(buf) - sizeof(load); + /* copy the whole file */ + for (lseek(from, 0, 0); ; n = sizeof(buf)) { + bzero(buf, sizeof(buf)); + if ((n = read(from, buf, n)) < 0) + err(1, from_file); + else if (n == 0) + break; + + if (write(to, buf, n) != n) + err(1, to_file); + + total += n; + check_sum = cksum(check_sum, (int *)buf, n); + } + + /* load header */ + load.address = htobe32(loadpoint + sizeof(load)); + load.count = htobe32(4 + total); + check_sum = cksum(check_sum, (int *)&load, sizeof(load)); + + if (verbose) + warnx("wrote %d bytes of file \'%s\'", total, from_file); + + bzero(buf, sizeof(buf)); + total += sizeof(load); + /* insert the header */ + lseek(to, -total, SEEK_CUR); + if (write(to, &load, sizeof(load)) != sizeof(load)) + err(1, to_file); + lseek(to, total - sizeof(load), SEEK_CUR); + + /* pad to int */ + n = sizeof(int) - total % sizeof(int); + if (total % sizeof(int)) { + if (write(to, buf, n) != n) + err(1, to_file); + else + total += n; + } + + /* pad to the blocksize */ + n = sizeof(buf) - total % sizeof(buf); + + if (n < sizeof(int)) { + n += sizeof(buf); + total += sizeof(buf); + } else + total += n; + + if (verbose) + warnx("checksum is 0x%08x", -check_sum); + + check_sum = htobe32(-check_sum); + if (write(to, &check_sum, sizeof(int)) != sizeof(int)) + err(1, to_file); + + n -= sizeof(int); + + if (write(to, buf, n) != n) + err(1, to_file); + + if (close(from) < 0 ) + err(1, from_file); + + return total; +} + +int +cksum(ck, p, size) + int ck; + int *p; + int size; +{ + /* we assume size is int-aligned */ + for (size = (size + sizeof(int) - 1) / sizeof(int); size--; p++ ) + ck += betoh32(*p); + + return ck; +} + +void __dead +usage() +{ + extern char *__progname; + fprintf(stderr, + "usage: %s [-v] [-l loadpoint] prog1 {progN} outfile\n", + __progname); + exit(1); +} + +char * +lifname(str) + char *str; +{ + static char lname[10] = "SYS_XXXXXX"; + register int i; + + for (i = 4; i < 9; i++) { + if (islower(*str)) + lname[i] = toupper(*str); + else if (isalnum(*str) || *str == '_') + lname[i] = *str; + else + break; + str++; + } + for ( ; i < 10; i++) + lname[i] = ' '; + return(lname); +} + + +void +bcddate(file, toc) + char *file; + char *toc; +{ + struct stat statb; +#ifndef __OpenBSD__ + struct tm { + int tm_sec; /* second (0-61, allows for leap seconds) */ + int tm_min; /* minute (0-59) */ + int tm_hour; /* hour (0-23) */ + int tm_mday; /* day of the month (1-31) */ + int tm_mon; /* month (0-11) */ + int tm_year; /* years since 1900 */ + int tm_wday; /* day of the week (0-6) */ + int tm_yday; /* day of the year (0-365) */ + int tm_isdst; /* non-0 if daylight savings time is in effect */ + } *tm; +#else + struct tm *tm; +#endif + + stat(file, &statb); + tm = localtime(&statb.st_ctime); + *toc = (tm->tm_year / 10) << 4; + *toc++ |= tm->tm_year % 10; + *toc = ((tm->tm_mon+1) / 10) << 4; + *toc++ |= (tm->tm_mon+1) % 10; + *toc = (tm->tm_mday / 10) << 4; + *toc++ |= tm->tm_mday % 10; + *toc = (tm->tm_hour / 10) << 4; + *toc++ |= tm->tm_hour % 10; + *toc = (tm->tm_min / 10) << 4; + *toc++ |= tm->tm_min % 10; + *toc = (tm->tm_sec / 10) << 4; + *toc |= tm->tm_sec % 10; +} + +#ifndef __OpenBSD__ +int +err(ex, str) + int ex; + char *str; +{ + perror(str); + exit(ex); +} + +int +errx(ex, str) + int ex; + char *str; +{ + perror(str); + exit(ex); +} +#endif diff --git a/sys/arch/hppa/stand/mkboot/volhdr.h b/sys/arch/hppa/stand/mkboot/volhdr.h new file mode 100644 index 00000000000..437898df70e --- /dev/null +++ b/sys/arch/hppa/stand/mkboot/volhdr.h @@ -0,0 +1,88 @@ +/* $OpenBSD: volhdr.h,v 1.1 1998/06/23 18:46:43 mickey Exp $ */ +/* $NetBSD: volhdr.h,v 1.4 1994/10/26 07:28:08 cgd Exp $ */ + +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)volhdr.h 8.1 (Berkeley) 6/10/93 + */ + +/* + * vohldr.h: volume header for "LIF" format volumes + */ + +struct lifvol { + short vol_id; + char vol_label[6]; + u_int vol_addr; + short vol_oct; + short vol_dummy; + u_int vol_dirsize; + short vol_version; + short vol_zero; + u_int vol_number; + u_int vol_lastvol; + u_int vol_length; + char vol_toc[6]; + char vol_dummy1[198]; + + u_int ipl_addr; + u_int ipl_size; + u_int ipl_entry; +}; + +struct lifdir { + char dir_name[10]; + short dir_type; + u_int dir_addr; + u_int dir_length; + char dir_toc[6]; + short dir_flag; + u_int dir_implement; +}; + +struct load { + int address; + int count; +}; + +#define VOL_ID -32768 +#define VOL_OCT 4096 +#define DIR_TYPE -5822 +#define DIR_ISL -12800 +#define DIR_FLAG 0x8001 /* dont ask me! */ +#define SECTSIZE 256 |