diff --git a/sys/arch/sun3/include/mon.h b/sys/arch/sun3/include/mon.h index c7ebcaf15316..56bf81d7a95a 100644 --- a/sys/arch/sun3/include/mon.h +++ b/sys/arch/sun3/include/mon.h @@ -1,4 +1,4 @@ -/* $NetBSD: mon.h,v 1.15 1994/11/21 21:33:51 gwr Exp $ */ +/* $NetBSD: mon.h,v 1.16 1995/02/07 05:01:05 gwr Exp $ */ /* * Copyright (c) 1993 Adam Glass @@ -36,7 +36,7 @@ * sprite distribution. * * In particular, this file came out of the Walnut Creek cdrom collection - * which contained no warnings about any possible copyright infringement + * which contained no warnings about any possible copyright infringement. * It was also indentical to a file in the sprite kernel tar file found on * allspice.berkeley.edu. * It also written in the annoying sprite coding style. I've made @@ -74,35 +74,11 @@ #define PROM_BASE 0x0fef0000 -/* - * 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. - */ - -typedef struct { - char devName[2]; /* The name of the device */ - int (*probe)(); /* probe() --> -1 or found controller - number */ - int (*boot)(); /* boot(bp) --> -1 or start address */ - int (*open)(); /* open(iobp) --> -1 or 0 */ - int (*close)(); /* close(iobp) --> -1 or 0 */ - int (*strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ - char *desc; /* Printable string describing dev */ -} MachMonBootTable; - /* * Structure set up by the boot command to pass arguments to the program that * is booted. */ - -typedef struct { +typedef struct bootparam { char *argPtr[8]; /* String arguments */ char strings[100]; /* String table for string arguments */ char devName[2]; /* Device name */ @@ -110,7 +86,7 @@ typedef struct { int unitNum; /* Unit number */ int partNum; /* Partition/file number */ char *fileName; /* File name, points into strings */ - MachMonBootTable *bootTable; /* Points to table entry for device */ + struct boottab *bootDevice; /* Defined in saio.h */ } MachMonBootParam; /* @@ -121,7 +97,6 @@ typedef struct { * I have not translated. If anyone needs to use these they should * translate these structs into Sprite format. */ - typedef struct { char *initSp; /* Initial system stack ptr * for hardware */ @@ -133,7 +108,7 @@ typedef struct { * Monitor and hardware revision and identification */ - MachMonBootParam **bootParam; /* Info for bootstrapped pgm */ + struct bootparam **bootParam; /* Info for bootstrapped pgm */ unsigned *memorySize; /* Usable memory in bytes */ /* diff --git a/sys/arch/sun3/include/saio.h b/sys/arch/sun3/include/saio.h new file mode 100644 index 000000000000..3eb598b928e1 --- /dev/null +++ b/sys/arch/sun3/include/saio.h @@ -0,0 +1,131 @@ +/* $NetBSD: saio.h,v 1.1 1995/02/07 05:01:07 gwr Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon Ross + * + * 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. + */ + +/* + * This file derived from kernel/mach/sun3.md/machMon.h from the + * sprite distribution. + * + * In particular, this file came out of the Walnut Creek cdrom collection + * which contained no warnings about any possible copyright infringement. + */ + +/* + * machMon.h -- + * + * Structures, constants and defines for access to the sun monitor. + * These were translated from the sun monitor header files: + * mon/sunromvec.h + * stand/saio.h + * + * Copyright (C) 1985 Regents of the University of California + * All rights reserved. + * + * Header: /sprite/src/boot/sunprom/sun3.md/RCS/machMon.h,v \ + * 1.1 90/09/17 10:57:28 rab Exp Locker: rab $ SPRITE (Berkeley) + */ + +/* + * 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. + */ +typedef struct boottab { + char b_dev[2]; /* The name of the device */ + int (*b_probe)(); /* probe() --> -1 or found controller + number */ + int (*b_boot)(); /* boot(bp) --> -1 or start address */ + int (*b_open)(); /* open(iobp) --> -1 or 0 */ + int (*b_close)(); /* close(iobp) --> -1 or 0 */ + int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ + char *b_desc; /* Printable string describing dev */ + struct devinfo *b_devinfo; /* Information to configure device */ +} MachMonBootDevice; + +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. + */ +typedef 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. */ +} MachMonDevInfo; + + +/* + * A "stand alone I/O request", taken from SunOS saio.h (struct saioreq) + * This is passed as the main argument to the PROM I/O routines + * in the MachMonBootDevice structure. + */ +typedef struct saioreq { + char si_flgs; + struct boottab *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; /* interface pointer (not defined) */ + char *si_devaddr; /* Points to mapped in device */ + char *si_dmaaddr; /* Points to allocated DMA space */ +} MachMonIORequest; + + +#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) */ + diff --git a/sys/arch/sun3/stand/libsa/saio.h b/sys/arch/sun3/stand/libsa/saio.h new file mode 100644 index 000000000000..3eb598b928e1 --- /dev/null +++ b/sys/arch/sun3/stand/libsa/saio.h @@ -0,0 +1,131 @@ +/* $NetBSD: saio.h,v 1.1 1995/02/07 05:01:07 gwr Exp $ */ + +/* + * Copyright (c) 1995 Gordon W. Ross + * 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. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission. + * 4. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Gordon Ross + * + * 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. + */ + +/* + * This file derived from kernel/mach/sun3.md/machMon.h from the + * sprite distribution. + * + * In particular, this file came out of the Walnut Creek cdrom collection + * which contained no warnings about any possible copyright infringement. + */ + +/* + * machMon.h -- + * + * Structures, constants and defines for access to the sun monitor. + * These were translated from the sun monitor header files: + * mon/sunromvec.h + * stand/saio.h + * + * Copyright (C) 1985 Regents of the University of California + * All rights reserved. + * + * Header: /sprite/src/boot/sunprom/sun3.md/RCS/machMon.h,v \ + * 1.1 90/09/17 10:57:28 rab Exp Locker: rab $ SPRITE (Berkeley) + */ + +/* + * 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. + */ +typedef struct boottab { + char b_dev[2]; /* The name of the device */ + int (*b_probe)(); /* probe() --> -1 or found controller + number */ + int (*b_boot)(); /* boot(bp) --> -1 or start address */ + int (*b_open)(); /* open(iobp) --> -1 or 0 */ + int (*b_close)(); /* close(iobp) --> -1 or 0 */ + int (*b_strategy)(); /* strategy(iobp,rw) --> -1 or 0 */ + char *b_desc; /* Printable string describing dev */ + struct devinfo *b_devinfo; /* Information to configure device */ +} MachMonBootDevice; + +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. + */ +typedef 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. */ +} MachMonDevInfo; + + +/* + * A "stand alone I/O request", taken from SunOS saio.h (struct saioreq) + * This is passed as the main argument to the PROM I/O routines + * in the MachMonBootDevice structure. + */ +typedef struct saioreq { + char si_flgs; + struct boottab *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; /* interface pointer (not defined) */ + char *si_devaddr; /* Points to mapped in device */ + char *si_dmaaddr; /* Points to allocated DMA space */ +} MachMonIORequest; + + +#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) */ +