Reach over to the sparc versions.
This commit is contained in:
parent
afe147460e
commit
ef98c2defb
@ -1,358 +1,3 @@
|
|||||||
/* $NetBSD: bsd_openprom.h,v 1.6 2003/08/07 16:29:49 agc Exp $ */
|
/* $NetBSD: bsd_openprom.h,v 1.7 2004/03/21 14:05:43 pk Exp $ */
|
||||||
|
|
||||||
/*
|
#include <sparc/bsd_openprom.h>
|
||||||
* Copyright (c) 1992, 1993
|
|
||||||
* The Regents of the University of California. All rights reserved.
|
|
||||||
*
|
|
||||||
* This code is derived from software contributed to Berkeley by
|
|
||||||
* Jan-Simon Pendry.
|
|
||||||
*
|
|
||||||
* 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. 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.
|
|
||||||
*
|
|
||||||
* @(#)bsd_openprom.h 8.1 (Berkeley) 6/11/93
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
|
||||||
#include "opt_sparc_arch.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Sun4m support by Aaron Brown, Harvard University.
|
|
||||||
* Changes Copyright (c) 1995 The President and Fellows of Harvard College.
|
|
||||||
* All rights reserved.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _BSD_OPENPROM_H_
|
|
||||||
#define _BSD_OPENPROM_H_
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This file defines the interface between the kernel and the Openboot PROM.
|
|
||||||
* N.B.: this has been tested only on interface versions 0 and 2 (we have
|
|
||||||
* never seen interface version 1).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The v0 interface tells us what virtual memory to scan to avoid PMEG
|
|
||||||
* conflicts, but the v2 interface fails to do so, and we must `magically'
|
|
||||||
* know where the OPENPROM lives in virtual space.
|
|
||||||
*/
|
|
||||||
#define OPENPROM_STARTVADDR 0xffd00000
|
|
||||||
#define OPENPROM_ENDVADDR 0xfff00000
|
|
||||||
|
|
||||||
#define OPENPROM_MAGIC 0x10010407
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Version 0 PROM vector device operations (collected here to emphasise that
|
|
||||||
* they are deprecated). Open and close are obvious. Read and write are
|
|
||||||
* segregated according to the device type (block, network, or character);
|
|
||||||
* this is unnecessary and was eliminated from the v2 device operations, but
|
|
||||||
* we are stuck with it.
|
|
||||||
*
|
|
||||||
* Seek is probably only useful on tape devices, since the only character
|
|
||||||
* devices are the serial ports.
|
|
||||||
*
|
|
||||||
* Note that a v0 device name is always exactly two characters ("sd", "le",
|
|
||||||
* and so forth).
|
|
||||||
*/
|
|
||||||
struct v0devops {
|
|
||||||
int (*v0_open) __P((char *dev));
|
|
||||||
int (*v0_close) __P((int d));
|
|
||||||
int (*v0_rbdev) __P((int d, int nblks, int blkno, void *addr));
|
|
||||||
int (*v0_wbdev) __P((int d, int nblks, int blkno, void *addr));
|
|
||||||
int (*v0_wnet) __P((int d, int nbytes, void *addr));
|
|
||||||
int (*v0_rnet) __P((int d, int nbytes, void *addr));
|
|
||||||
int (*v0_rcdev) __P((int d, int nbytes, int, void *addr));
|
|
||||||
int (*v0_wcdev) __P((int d, int nbytes, int, void *addr));
|
|
||||||
int (*v0_seek) __P((int d, long offset, int whence));
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Version 2 device operations. Open takes a device `path' such as
|
|
||||||
* /sbus/le@0,c00000,0 or /sbus/esp@.../sd@0,0, which means it can open
|
|
||||||
* anything anywhere, without any magic translation.
|
|
||||||
*
|
|
||||||
* The memory allocator and map functions are included here even though
|
|
||||||
* they relate only indirectly to devices (e.g., mmap is good for mapping
|
|
||||||
* device memory, and drivers need to allocate space in which to record
|
|
||||||
* the device state).
|
|
||||||
*/
|
|
||||||
struct v2devops {
|
|
||||||
/*
|
|
||||||
* Convert an `instance handle' (acquired through v2_open()) to
|
|
||||||
* a `package handle', a.k.a. a `node'.
|
|
||||||
*/
|
|
||||||
int (*v2_fd_phandle) __P((int d));
|
|
||||||
|
|
||||||
/* Memory allocation and release. */
|
|
||||||
void *(*v2_malloc) __P((caddr_t va, u_int sz));
|
|
||||||
void (*v2_free) __P((caddr_t va, u_int sz));
|
|
||||||
|
|
||||||
/* Device memory mapper. */
|
|
||||||
caddr_t (*v2_mmap) __P((caddr_t va, int asi, u_int pa, u_int sz));
|
|
||||||
void (*v2_munmap) __P((caddr_t va, u_int sz));
|
|
||||||
|
|
||||||
/* Device open, close, etc. */
|
|
||||||
int (*v2_open) __P((char *devpath));
|
|
||||||
void (*v2_close) __P((int d));
|
|
||||||
int (*v2_read) __P((int d, void *buf, int nbytes));
|
|
||||||
int (*v2_write) __P((int d, void *buf, int nbytes));
|
|
||||||
void (*v2_seek) __P((int d, int hi, int lo));
|
|
||||||
|
|
||||||
void (*v2_chain) __P((void)); /* ??? */
|
|
||||||
void (*v2_release) __P((void)); /* ??? */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The v0 interface describes memory regions with these linked lists.
|
|
||||||
* (The !$&@#+ v2 interface reformats these as properties, so that we
|
|
||||||
* have to extract them into local temporary memory and reinterpret them.)
|
|
||||||
*/
|
|
||||||
struct v0mlist {
|
|
||||||
struct v0mlist *next;
|
|
||||||
caddr_t addr;
|
|
||||||
u_int nbytes;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* V0 gives us three memory lists: Total physical memory, VM reserved to
|
|
||||||
* the PROM, and available physical memory (which, presumably, is just the
|
|
||||||
* total minus any pages mapped in the PROM's VM region). We can find the
|
|
||||||
* reserved PMEGs by scanning the taken VM. Unfortunately, the V2 prom
|
|
||||||
* forgot to provide taken VM, and we are stuck with scanning ``magic''
|
|
||||||
* addresses.
|
|
||||||
*/
|
|
||||||
struct v0mem {
|
|
||||||
struct v0mlist **v0_phystot; /* physical memory */
|
|
||||||
struct v0mlist **v0_vmprom; /* VM used by PROM */
|
|
||||||
struct v0mlist **v0_physavail; /* available physical memory */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The version 0 PROM breaks up the string given to the boot command and
|
|
||||||
* leaves the decoded version behind.
|
|
||||||
*/
|
|
||||||
struct v0bootargs {
|
|
||||||
char *ba_argv[8]; /* argv format for boot string */
|
|
||||||
char ba_args[100]; /* string space */
|
|
||||||
char ba_bootdev[2]; /* e.g., "sd" for `b sd(...' */
|
|
||||||
int ba_ctlr; /* controller # */
|
|
||||||
int ba_unit; /* unit # */
|
|
||||||
int ba_part; /* partition # */
|
|
||||||
char *ba_kernel; /* kernel to boot, e.g., "vmunix" */
|
|
||||||
void *ba_spare0; /* not decoded here XXX */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The version 2 PROM interface uses the more general, if less convenient,
|
|
||||||
* approach of passing the boot strings unchanged. We also get open file
|
|
||||||
* numbers for stdin and stdout (keyboard and screen, or whatever), for use
|
|
||||||
* with the v2 device ops.
|
|
||||||
*/
|
|
||||||
struct v2bootargs {
|
|
||||||
char **v2_bootpath; /* V2: Path to boot device */
|
|
||||||
char **v2_bootargs; /* V2: Boot args */
|
|
||||||
int *v2_fd0; /* V2: Stdin descriptor */
|
|
||||||
int *v2_fd1; /* V2: Stdout descriptor */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The format used by the PROM to describe a physical address. These
|
|
||||||
* are typically found in a "reg" property.
|
|
||||||
*/
|
|
||||||
struct openprom_addr {
|
|
||||||
int oa_space; /* address space (may be relative) */
|
|
||||||
u_int oa_base; /* address within space */
|
|
||||||
u_int oa_size; /* extent (number of bytes) */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The format used by the PROM to describe an address space window. These
|
|
||||||
* are typically found in a "range" property.
|
|
||||||
*/
|
|
||||||
struct openprom_range {
|
|
||||||
int or_child_space; /* address space of child */
|
|
||||||
u_int or_child_base; /* offset in child's view of bus */
|
|
||||||
int or_parent_space; /* address space of parent */
|
|
||||||
u_int or_parent_base; /* offset in parent's view of bus */
|
|
||||||
u_int or_size; /* extent (number of bytes) */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The format used by the PROM to describe an interrupt. These are
|
|
||||||
* typically found in an "intr" property.
|
|
||||||
*/
|
|
||||||
struct openprom_intr {
|
|
||||||
int oi_pri; /* interrupt priority */
|
|
||||||
int oi_vec; /* interrupt vector */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following structure defines the primary PROM vector interface.
|
|
||||||
* The Boot PROM hands the kernel a pointer to this structure in %o0.
|
|
||||||
* There are numerous substructures defined below.
|
|
||||||
*/
|
|
||||||
struct promvec {
|
|
||||||
/* Version numbers. */
|
|
||||||
u_int pv_magic; /* Magic number */
|
|
||||||
u_int pv_romvec_vers; /* interface version (0, 2) */
|
|
||||||
u_int pv_plugin_vers; /* ??? */
|
|
||||||
u_int pv_printrev; /* PROM rev # (* 10, e.g 1.9 = 19) */
|
|
||||||
|
|
||||||
/* Version 0 memory descriptors (see below). */
|
|
||||||
struct v0mem pv_v0mem; /* V0: Memory description lists. */
|
|
||||||
|
|
||||||
/* Node operations (see below). */
|
|
||||||
struct nodeops *pv_nodeops; /* node functions */
|
|
||||||
|
|
||||||
char **pv_bootstr; /* Boot command, eg sd(0,0,0)vmunix */
|
|
||||||
|
|
||||||
struct v0devops pv_v0devops; /* V0: device ops */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* PROMDEV_* cookies. I fear these may vanish in lieu of fd0/fd1
|
|
||||||
* (see below) in future PROMs, but for now they work fine.
|
|
||||||
*/
|
|
||||||
char *pv_stdin; /* stdin cookie */
|
|
||||||
char *pv_stdout; /* stdout cookie */
|
|
||||||
#define PROMDEV_KBD 0 /* input from keyboard */
|
|
||||||
#define PROMDEV_SCREEN 0 /* output to screen */
|
|
||||||
#define PROMDEV_TTYA 1 /* in/out to ttya */
|
|
||||||
#define PROMDEV_TTYB 2 /* in/out to ttyb */
|
|
||||||
|
|
||||||
/* Blocking getchar/putchar. NOT REENTRANT! (grr) */
|
|
||||||
int (*pv_getchar) __P((void));
|
|
||||||
void (*pv_putchar) __P((int ch));
|
|
||||||
|
|
||||||
/* Non-blocking variants that return -1 on error. */
|
|
||||||
int (*pv_nbgetchar) __P((void));
|
|
||||||
int (*pv_nbputchar) __P((int ch));
|
|
||||||
|
|
||||||
/* Put counted string (can be very slow). */
|
|
||||||
void (*pv_putstr) __P((char *str, int len));
|
|
||||||
|
|
||||||
/* Miscellany. */
|
|
||||||
void (*pv_reboot) __P((char *bootstr));
|
|
||||||
void (*pv_printf) __P((const char *fmt, ...));
|
|
||||||
void (*pv_abort) __P((void)); /* L1-A abort */
|
|
||||||
int *pv_ticks; /* Ticks since last reset */
|
|
||||||
__dead void (*pv_halt) __P((void)) __attribute__((noreturn));/* Halt! */
|
|
||||||
void (**pv_synchook) __P((void)); /* "sync" command hook */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This eval's a FORTH string. Unfortunately, its interface
|
|
||||||
* changed between V0 and V2, which gave us much pain.
|
|
||||||
*/
|
|
||||||
union {
|
|
||||||
void (*v0_eval) __P((int len, char *str));
|
|
||||||
void (*v2_eval) __P((char *str));
|
|
||||||
} pv_fortheval;
|
|
||||||
|
|
||||||
struct v0bootargs **pv_v0bootargs; /* V0: Boot args */
|
|
||||||
|
|
||||||
/* Extract Ethernet address from network device. */
|
|
||||||
u_int (*pv_enaddr) __P((int d, char *enaddr));
|
|
||||||
|
|
||||||
struct v2bootargs pv_v2bootargs; /* V2: Boot args + std in/out */
|
|
||||||
struct v2devops pv_v2devops; /* V2: device operations */
|
|
||||||
|
|
||||||
int pv_spare[15];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The following is machine-dependent.
|
|
||||||
*
|
|
||||||
* The sun4c needs a PROM function to set a PMEG for another
|
|
||||||
* context, so that the kernel can map itself in all contexts.
|
|
||||||
* It is not possible simply to set the context register, because
|
|
||||||
* contexts 1 through N may have invalid translations for the
|
|
||||||
* current program counter. The hardware has a mode in which
|
|
||||||
* all memory references go to the PROM, so the PROM can do it
|
|
||||||
* easily.
|
|
||||||
*/
|
|
||||||
void (*pv_setctxt) __P((int ctxt, caddr_t va, int pmeg));
|
|
||||||
#if defined(SUN4M) && defined(notyet)
|
|
||||||
/*
|
|
||||||
* The following are V3 ROM functions to handle MP machines in the
|
|
||||||
* Sun4m series. They have undefined results when run on a uniprocessor!
|
|
||||||
*/
|
|
||||||
int (*pv_v3cpustart) __P((u_int module, u_int ctxtbl,
|
|
||||||
int context, caddr_t pc));
|
|
||||||
int (*pv_v3cpustop) __P((u_int module));
|
|
||||||
int (*pv_v3cpuidle) __P((u_int module));
|
|
||||||
int (*pv_v3cpuresume) __P((u_int module));
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In addition to the global stuff defined in the PROM vectors above,
|
|
||||||
* the PROM has quite a collection of `nodes'. A node is described by
|
|
||||||
* an integer---these seem to be internal pointers, actually---and the
|
|
||||||
* nodes are arranged into an N-ary tree. Each node implements a fixed
|
|
||||||
* set of functions, as described below. The first two deal with the tree
|
|
||||||
* structure, allowing traversals in either breadth- or depth-first fashion.
|
|
||||||
* The rest deal with `properties'.
|
|
||||||
*
|
|
||||||
* A node property is simply a name/value pair. The names are C strings
|
|
||||||
* (NUL-terminated); the values are arbitrary byte strings (counted strings).
|
|
||||||
* Many values are really just C strings. Sometimes these are NUL-terminated,
|
|
||||||
* sometimes not, depending on the interface version; v0 seems to terminate
|
|
||||||
* and v2 not. Many others are simply integers stored as four bytes in
|
|
||||||
* machine order: you just get them and go. The third popular format is
|
|
||||||
* an `address', which is made up of one or more sets of three integers
|
|
||||||
* as defined below.
|
|
||||||
*
|
|
||||||
* N.B.: for the `next' functions, next(0) = first, and next(last) = 0.
|
|
||||||
* Whoever designed this part had good taste. On the other hand, these
|
|
||||||
* operation vectors are global, rather than per-node, yet the pointers
|
|
||||||
* are not in the openprom vectors but rather found by indirection from
|
|
||||||
* there. So the taste balances out.
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct nodeops {
|
|
||||||
/*
|
|
||||||
* Tree traversal.
|
|
||||||
*/
|
|
||||||
int (*no_nextnode) __P((int node)); /* next(node) */
|
|
||||||
int (*no_child) __P((int node)); /* first child */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Property functions. Proper use of getprop requires calling
|
|
||||||
* proplen first to make sure it fits. Kind of a pain, but no
|
|
||||||
* doubt more convenient for the PROM coder.
|
|
||||||
*/
|
|
||||||
int (*no_proplen) __P((int node, caddr_t name));
|
|
||||||
int (*no_getprop) __P((int node, caddr_t name, caddr_t val));
|
|
||||||
int (*no_setprop) __P((int node, caddr_t name, caddr_t val,
|
|
||||||
int len));
|
|
||||||
caddr_t (*no_nextprop) __P((int node, caddr_t name));
|
|
||||||
};
|
|
||||||
|
|
||||||
void romhalt __P((void))
|
|
||||||
__attribute__((__noreturn__));
|
|
||||||
void romboot __P((char *))
|
|
||||||
__attribute__((__noreturn__));
|
|
||||||
|
|
||||||
extern struct promvec *promvec;
|
|
||||||
|
|
||||||
#endif /* _BSD_OPENPROM_H_ */
|
|
||||||
|
@ -1,317 +1,3 @@
|
|||||||
/* $NetBSD: oldmon.h,v 1.2 2001/12/04 00:53:19 darrenr Exp $ */
|
/* $NetBSD: oldmon.h,v 1.3 2004/03/21 14:05:43 pk Exp $ */
|
||||||
|
|
||||||
/*
|
#include <sparc/oldmon.h>
|
||||||
* Copyright (C) 1985 Regents of the University of California
|
|
||||||
* Copyright (c) 1993 Adam Glass
|
|
||||||
* 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 Adam Glass.
|
|
||||||
* 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 Adam Glass ``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.
|
|
||||||
*
|
|
||||||
* from: Sprite /cdrom/src/kernel/Cvsroot/kernel/mach/sun3.md/machMon.h,v
|
|
||||||
* 9.1 90/10/03 13:52:34 mgbaker Exp SPRITE (Berkeley)
|
|
||||||
*/
|
|
||||||
#ifndef _MACHINE_OLDMON_H
|
|
||||||
#define _MACHINE_OLDMON_H
|
|
||||||
|
|
||||||
#if defined(_KERNEL_OPT)
|
|
||||||
#include "opt_sparc_arch.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Structures, constants and defines for access to the sun monitor.
|
|
||||||
* These are translated from the sun monitor header file "sunromvec.h".
|
|
||||||
*
|
|
||||||
* The memory addresses for the PROM, and the EEPROM.
|
|
||||||
* On the sun2 these addresses are actually 0x00EF??00
|
|
||||||
* but only the bottom 24 bits are looked at so these still
|
|
||||||
* work ok.
|
|
||||||
*/
|
|
||||||
#define PROM_BASE 0xffe81000
|
|
||||||
|
|
||||||
enum maptypes { /* Page map entry types. */
|
|
||||||
MAP_MAINMEM,
|
|
||||||
MAP_OBIO,
|
|
||||||
MAP_MBMEM,
|
|
||||||
MAP_MBIO,
|
|
||||||
MAP_VME16A16D,
|
|
||||||
MAP_VME16A32D,
|
|
||||||
MAP_VME24A16D,
|
|
||||||
MAP_VME24A32D,
|
|
||||||
MAP_VME32A16D,
|
|
||||||
MAP_VME32A32D
|
|
||||||
};
|
|
||||||
/*
|
|
||||||
* This table gives information about the resources needed by a device.
|
|
||||||
*/
|
|
||||||
struct devinfo {
|
|
||||||
unsigned int d_devbytes; /* Bytes occupied by device in IO space.*/
|
|
||||||
unsigned int d_dmabytes; /* Bytes needed by device in DMA memory.*/
|
|
||||||
unsigned int d_localbytes;/* Bytes needed by device for local info.*/
|
|
||||||
unsigned int d_stdcount; /* How many standard addresses. */
|
|
||||||
unsigned long *d_stdaddrs; /* The vector of standard addresses. */
|
|
||||||
enum maptypes d_devtype; /* What map space device is in. */
|
|
||||||
unsigned int d_maxiobytes;/* Size to break big I/O's into. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A "stand alone I/O request".
|
|
||||||
* This is passed as the main argument to the PROM I/O routines
|
|
||||||
* in the `om_boottable' structure.
|
|
||||||
*/
|
|
||||||
struct saioreq {
|
|
||||||
char si_flgs;
|
|
||||||
struct om_boottable *si_boottab;/* Points to boottab entry if any */
|
|
||||||
char *si_devdata; /* Device-specific data pointer */
|
|
||||||
int si_ctlr; /* Controller number or address */
|
|
||||||
int si_unit; /* Unit number within controller */
|
|
||||||
long si_boff; /* Partition number within unit */
|
|
||||||
long si_cyloff;
|
|
||||||
long si_offset;
|
|
||||||
long si_bn; /* Block number to R/W */
|
|
||||||
char *si_ma; /* Memory address to R/W */
|
|
||||||
int si_cc; /* Character count to R/W */
|
|
||||||
struct saif *si_sif; /* net if. pointer (set by b_open) */
|
|
||||||
char *si_devaddr; /* Points to mapped in device */
|
|
||||||
char *si_dmaaddr; /* Points to allocated DMA space */
|
|
||||||
};
|
|
||||||
#define SAIO_F_READ 0x01
|
|
||||||
#define SAIO_F_WRITE 0x02
|
|
||||||
#define SAIO_F_ALLOC 0x04
|
|
||||||
#define SAIO_F_FILE 0x08
|
|
||||||
#define SAIO_F_EOF 0x10 /* EOF on device */
|
|
||||||
#define SAIO_F_AJAR 0x20 /* Descriptor "ajar" (stopped but not closed) */
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The table entry that describes a device. It exists in the PROM; a
|
|
||||||
* pointer to it is passed in MachMonBootParam. It can be used to locate
|
|
||||||
* PROM subroutines for opening, reading, and writing the device.
|
|
||||||
*
|
|
||||||
* When using this interface, only one device can be open at once.
|
|
||||||
*
|
|
||||||
* NOTE: I am not sure what arguments boot, open, close, and strategy take.
|
|
||||||
* What is here is just translated verbatim from the sun monitor code. We
|
|
||||||
* should figure this out eventually if we need it.
|
|
||||||
*/
|
|
||||||
struct om_boottable {
|
|
||||||
char b_devname[2]; /* The name of the device */
|
|
||||||
int (*b_probe) __P((void)); /* probe() --> -1 or found controller
|
|
||||||
number */
|
|
||||||
int (*b_boot) __P((void)); /* boot(bp) --> -1 or start address */
|
|
||||||
int (*b_open)
|
|
||||||
__P((struct saioreq *));/* open(iobp) --> -1 or 0 */
|
|
||||||
int (*b_close)
|
|
||||||
__P((struct saioreq *));/* close(iobp) --> -1 or 0 */
|
|
||||||
int (*b_strategy)
|
|
||||||
__P((struct saioreq *, int));/* strategy(iobp,rw) --> -1 or 0 */
|
|
||||||
char *b_desc; /* Printable string describing dev */
|
|
||||||
struct devinfo *b_devinfo; /* info to configure device. */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Structure set up by the boot command to pass arguments to the program that
|
|
||||||
* is booted.
|
|
||||||
*/
|
|
||||||
struct om_bootparam {
|
|
||||||
char *argPtr[8]; /* String arguments */
|
|
||||||
char strings[100]; /* String table for string arguments */
|
|
||||||
char devName[2]; /* Device name */
|
|
||||||
int ctlrNum; /* Controller number */
|
|
||||||
int unitNum; /* Unit number */
|
|
||||||
int partNum; /* Partition/file number */
|
|
||||||
char *fileName; /* File name, points into strings */
|
|
||||||
struct om_boottable *bootTable; /* Points to table entry for device */
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Here is the structure of the vector table which is at the front of the boot
|
|
||||||
* rom. The functions defined in here are explained below.
|
|
||||||
*
|
|
||||||
* NOTE: This struct has references to the structures keybuf and globram which
|
|
||||||
* I have not translated. If anyone needs to use these they should
|
|
||||||
* translate these structs into Sprite format.
|
|
||||||
*/
|
|
||||||
struct om_vector {
|
|
||||||
char *initSp; /* Initial system stack ptr for hardware */
|
|
||||||
int (*startMon) __P((void));/* Initial PC for hardware */
|
|
||||||
int *diagberr; /* Bus err handler for diags */
|
|
||||||
|
|
||||||
/* Monitor and hardware revision and identification */
|
|
||||||
struct om_bootparam **bootParam; /* Info for bootstrapped pgm */
|
|
||||||
u_long *memorySize; /* Usable memory in bytes */
|
|
||||||
|
|
||||||
/* Single-character input and output */
|
|
||||||
int (*getChar) __P((void)); /* Get char from input source */
|
|
||||||
void (*putChar) __P((int)); /* Put char to output sink */
|
|
||||||
int (*mayGet) __P((void)); /* Maybe get char, or -1 */
|
|
||||||
int (*mayPut) __P((int)); /* Maybe put char, or -1 */
|
|
||||||
u_char *echo; /* Should getchar echo? */
|
|
||||||
u_char *inSource; /* Input source selector */
|
|
||||||
u_char *outSink; /* Output sink selector */
|
|
||||||
#define PROMDEV_KBD 0 /* input from keyboard */
|
|
||||||
#define PROMDEV_SCREEN 0 /* output to screen */
|
|
||||||
#define PROMDEV_TTYA 1 /* in/out to ttya */
|
|
||||||
#define PROMDEV_TTYB 2 /* in/out to ttyb */
|
|
||||||
|
|
||||||
/* Keyboard input (scanned by monitor nmi routine) */
|
|
||||||
int (*getKey) __P((void)); /* Get next key if one exists */
|
|
||||||
int (*initGetKey) __P((void));/* Initialize get key */
|
|
||||||
u_int *translation; /* Kbd translation selector */
|
|
||||||
u_char *keyBid; /* Keyboard ID byte */
|
|
||||||
int *screen_x; /* V2: Screen x pos (R/O) */
|
|
||||||
int *screen_y; /* V2: Screen y pos (R/O) */
|
|
||||||
struct keybuf *keyBuf; /* Up/down keycode buffer */
|
|
||||||
|
|
||||||
/* Monitor revision level. */
|
|
||||||
char *monId;
|
|
||||||
|
|
||||||
/* Frame buffer output and terminal emulation */
|
|
||||||
int (*fbWriteChar) __P((void));/* Write a character to FB */
|
|
||||||
int *fbAddr; /* Address of frame buffer */
|
|
||||||
char **font; /* Font table for FB */
|
|
||||||
void (*fbWriteStr) __P((char *, int));
|
|
||||||
/* Quickly write string to FB */
|
|
||||||
|
|
||||||
/* Reboot interface routine -- resets and reboots system. */
|
|
||||||
void (*reBoot) __P((char *)); /* e.g. reBoot("xy()vmunix") */
|
|
||||||
|
|
||||||
/* Line input and parsing */
|
|
||||||
u_char *lineBuf; /* The line input buffer */
|
|
||||||
u_char **linePtr; /* Cur pointer into linebuf */
|
|
||||||
int *lineSize; /* length of line in linebuf */
|
|
||||||
int (*getLine) __P((void)); /* Get line from user */
|
|
||||||
u_char (*getNextChar) __P((void));/* Get next char from linebuf */
|
|
||||||
u_char (*peekNextChar) __P((void));/* Peek at next char */
|
|
||||||
int *fbThere; /* =1 if frame buffer there */
|
|
||||||
int (*getNum) __P((void)); /* Grab hex num from line */
|
|
||||||
|
|
||||||
/* Print formatted output to current output sink */
|
|
||||||
int (*printf) __P((void)); /* Similar to "Kernel printf" */
|
|
||||||
int (*printHex) __P((void));/* Format N digits in hex */
|
|
||||||
|
|
||||||
/* Led stuff */
|
|
||||||
u_char *leds; /* RAM copy of LED register */
|
|
||||||
int (*setLeds) __P((void)); /* Sets LED's and RAM copy */
|
|
||||||
|
|
||||||
/* Non-maskable interrupt (nmi) information */
|
|
||||||
int (*nmiAddr) __P((void)); /* Addr for level 7 vector */
|
|
||||||
void (*abortEntry) __P((void));/* Entry for keyboard abort */
|
|
||||||
int *nmiClock; /* Counts up in msec */
|
|
||||||
|
|
||||||
/* Frame buffer type: see <machine/fbio.h> */
|
|
||||||
int *fbType;
|
|
||||||
|
|
||||||
/* Assorted other things */
|
|
||||||
u_long romvecVersion; /* Version # of Romvec */
|
|
||||||
struct globram *globRam; /* monitor global variables */
|
|
||||||
caddr_t kbdZscc; /* Addr of keyboard in use */
|
|
||||||
|
|
||||||
int *keyrInit; /* ms before kbd repeat */
|
|
||||||
u_char *keyrTick; /* ms between repetitions */
|
|
||||||
u_long *memoryAvail; /* V1: Main mem usable size */
|
|
||||||
long *resetAddr; /* where to jump on a reset */
|
|
||||||
long *resetMap; /* pgmap entry for resetaddr */
|
|
||||||
/* Really struct pgmapent * */
|
|
||||||
|
|
||||||
__dead void (*exitToMon)
|
|
||||||
__P((void)) __attribute__((noreturn));/* Exit from user program */
|
|
||||||
u_char **memorybitmap; /* V1: &{0 or &bits} */
|
|
||||||
void (*setcxsegmap) /* Set seg in any context */
|
|
||||||
__P((int, caddr_t, int));
|
|
||||||
void (**vector_cmd) __P((u_long, char *));/* V2: Handler for 'v' cmd */
|
|
||||||
u_long *ExpectedTrapSig;
|
|
||||||
u_long *TrapVectorTable;
|
|
||||||
int dummy1z;
|
|
||||||
int dummy2z;
|
|
||||||
int dummy3z;
|
|
||||||
int dummy4z;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define romVectorPtr ((struct om_vector *)PROM_BASE)
|
|
||||||
|
|
||||||
#define mon_printf (romVectorPtr->printf)
|
|
||||||
#define mon_putchar (romVectorPtr->putChar)
|
|
||||||
#define mon_may_getchar (romVectorPtr->mayGet)
|
|
||||||
#define mon_exit_to_mon (romVectorPtr->exitToMon)
|
|
||||||
#define mon_reboot (romVectorPtr->exitToMon)
|
|
||||||
#define mon_panic(x) { mon_printf(x); mon_exit_to_mon();}
|
|
||||||
|
|
||||||
#define mon_setcxsegmap(context, va, sme) \
|
|
||||||
romVectorPtr->setcxsegmap(context, va, sme)
|
|
||||||
#define romp (romVectorPtr)
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OLDMON_STARTVADDR and OLDMON_ENDVADDR denote the range of the damn monitor.
|
|
||||||
*
|
|
||||||
* supposedly you can steal pmegs within this range that do not contain
|
|
||||||
* valid pages.
|
|
||||||
*/
|
|
||||||
#define OLDMON_STARTVADDR 0xFFD00000
|
|
||||||
#define OLDMON_ENDVADDR 0xFFF00000
|
|
||||||
|
|
||||||
/*
|
|
||||||
* These describe the monitor's short segment which it basically uses to map
|
|
||||||
* one stupid page that it uses for storage. MONSHORTPAGE is the page,
|
|
||||||
* and MONSHORTSEG is the segment that it is in. If this sounds dumb to
|
|
||||||
* you, it is. I can change the pmeg, but not the virtual address.
|
|
||||||
* Sun defines these with the high nibble set to 0xF. I believe this was
|
|
||||||
* for the monitor source which accesses this piece of memory with addressing
|
|
||||||
* limitations or some such crud. I haven't replicated this here, because
|
|
||||||
* it is confusing, and serves no obvious purpose if you aren't the monitor.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define MONSHORTPAGE 0x0FFFE000
|
|
||||||
#define MONSHORTSEG 0x0FFE0000
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Ethernet interface descriptor
|
|
||||||
* First, set: saiop->si_devaddr, saiop->si_dmaaddr, etc.
|
|
||||||
* Then: saiop->si_boottab->b_open() will set:
|
|
||||||
* saiop->si_sif;
|
|
||||||
* saiop->si_devdata;
|
|
||||||
* The latter is the first arg to the following functions.
|
|
||||||
* Note that the buffer must be in DVMA space...
|
|
||||||
*/
|
|
||||||
struct saif {
|
|
||||||
/* transmit packet, returns zero on success. */
|
|
||||||
int (*sif_xmit)(void *devdata, char *buf, int len);
|
|
||||||
/* wait for packet, zero if none arrived */
|
|
||||||
int (*sif_poll)(void *devdata, char *buf);
|
|
||||||
/* reset interface, set addresses, etc. */
|
|
||||||
int (*sif_reset)(void *devdata, struct saioreq *sip);
|
|
||||||
/* Later (sun4 only) proms have more stuff here. */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(SUN4)
|
|
||||||
void oldmon_w_trace __P((u_long));
|
|
||||||
void oldmon_w_cmd __P((u_long, char *));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* _MACHINE_OLDMON_H */
|
|
||||||
|
Loading…
Reference in New Issue
Block a user