Home | History | Annotate | Line # | Download | only in include
      1  1.1  skrll /*	$NetBSD: iomod.h,v 1.1 2014/02/24 07:23:43 skrll Exp $	*/
      2  1.1  skrll 
      3  1.1  skrll /*	$OpenBSD: iomod.h,v 1.18 2007/10/20 16:41:45 miod Exp $	*/
      4  1.1  skrll 
      5  1.1  skrll /*
      6  1.1  skrll  * Copyright (c) 2000-2004 Michael Shalayeff
      7  1.1  skrll  * All rights reserved.
      8  1.1  skrll  *
      9  1.1  skrll  * Redistribution and use in source and binary forms, with or without
     10  1.1  skrll  * modification, are permitted provided that the following conditions
     11  1.1  skrll  * are met:
     12  1.1  skrll  * 1. Redistributions of source code must retain the above copyright
     13  1.1  skrll  *    notice, this list of conditions and the following disclaimer.
     14  1.1  skrll  * 2. Redistributions in binary form must reproduce the above copyright
     15  1.1  skrll  *    notice, this list of conditions and the following disclaimer in the
     16  1.1  skrll  *    documentation and/or other materials provided with the distribution.
     17  1.1  skrll  *
     18  1.1  skrll  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19  1.1  skrll  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20  1.1  skrll  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21  1.1  skrll  * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
     22  1.1  skrll  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     23  1.1  skrll  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     24  1.1  skrll  * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     25  1.1  skrll  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     26  1.1  skrll  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
     27  1.1  skrll  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     28  1.1  skrll  * THE POSSIBILITY OF SUCH DAMAGE.
     29  1.1  skrll  */
     30  1.1  skrll /*
     31  1.1  skrll  * Copyright (c) 1990 mt Xinu, Inc.  All rights reserved.
     32  1.1  skrll  * Copyright (c) 1990,1991,1992,1994 University of Utah.  All rights reserved.
     33  1.1  skrll  *
     34  1.1  skrll  * Permission to use, copy, modify and distribute this software is hereby
     35  1.1  skrll  * granted provided that (1) source code retains these copyright, permission,
     36  1.1  skrll  * and disclaimer notices, and (2) redistributions including binaries
     37  1.1  skrll  * reproduce the notices in supporting documentation, and (3) all advertising
     38  1.1  skrll  * materials mentioning features or use of this software display the following
     39  1.1  skrll  * acknowledgement: ``This product includes software developed by the
     40  1.1  skrll  * Computer Systems Laboratory at the University of Utah.''
     41  1.1  skrll  *
     42  1.1  skrll  * Copyright (c) 1990 mt Xinu, Inc.
     43  1.1  skrll  * This file may be freely distributed in any form as long as
     44  1.1  skrll  * this copyright notice is included.
     45  1.1  skrll  * MTXINU, THE UNIVERSITY OF UTAH, AND CSL PROVIDE THIS SOFTWARE ``AS
     46  1.1  skrll  * IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
     47  1.1  skrll  * WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND
     48  1.1  skrll  * FITNESS FOR A PARTICULAR PURPOSE.
     49  1.1  skrll  *
     50  1.1  skrll  * CSL requests users of this software to return to csl-dist (at) cs.utah.edu any
     51  1.1  skrll  * improvements that they make and grant CSL redistribution rights.
     52  1.1  skrll  *
     53  1.1  skrll  *	Utah $Hdr: iomod.h 1.6 94/12/14$
     54  1.1  skrll  */
     55  1.1  skrll 
     56  1.1  skrll #ifndef	_MACHINE_IOMOD_H_
     57  1.1  skrll #define	_MACHINE_IOMOD_H_
     58  1.1  skrll 
     59  1.1  skrll #include <machine/pdc.h>
     60  1.1  skrll 
     61  1.1  skrll /*
     62  1.1  skrll  * Structures and definitions for I/O Modules on HP-PA (9000/800).
     63  1.1  skrll  *
     64  1.1  skrll  * Memory layout:
     65  1.1  skrll  *
     66  1.1  skrll  *	0x00000000	+---------------------------------+
     67  1.1  skrll  *			|           Page Zero             |
     68  1.1  skrll  *	0x00000800	+ - - - - - - - - - - - - - - - - +
     69  1.1  skrll  *			|                                 |
     70  1.1  skrll  *			|                                 |
     71  1.1  skrll  *			|      Memory Address Space       |
     72  1.1  skrll  *			|                                 |
     73  1.1  skrll  *			|                                 |
     74  1.1  skrll  *	0xEF000000	+---------------------------------+
     75  1.1  skrll  *			|                                 |
     76  1.1  skrll  *			|        PDC Address Space        |
     77  1.1  skrll  *			|                                 |
     78  1.1  skrll  *	0xF1000000	+---------------------------------+
     79  1.1  skrll  *			|                                 |
     80  1.1  skrll  *			|                                 |
     81  1.1  skrll  *			|        I/O Address Space        |
     82  1.1  skrll  *			|                                 |
     83  1.1  skrll  *			|                                 |
     84  1.1  skrll  *	0xFFF80000	+ - - - - - - - - - - - - - - - - +
     85  1.1  skrll  *			|  Fixed Physical Address Space   |
     86  1.1  skrll  *	0xFFFC0000	+ - - - - - - - - - - - - - - - - +
     87  1.1  skrll  *			|  Local Broadcast Address Space  |
     88  1.1  skrll  *	0xFFFE0000	+ - - - - - - - - - - - - - - - - +
     89  1.1  skrll  *			| Global Broadcast Address Space  |
     90  1.1  skrll  *	0xFFFFFFFF	+---------------------------------+
     91  1.1  skrll  *
     92  1.1  skrll  * "Memory Address Space" is used by memory modules,
     93  1.1  skrll  *   "Page Zero" is described below.
     94  1.1  skrll  * "PDC Address Space" is used by Processor-Dependent Code.
     95  1.1  skrll  * "I/O Address Space" is used by I/O modules (and is not cached),
     96  1.1  skrll  *   "Fixed Physical" is used by modules on the central bus,
     97  1.1  skrll  *   "Local Broadcast" is used to reach all modules on the same bus, and
     98  1.1  skrll  *   "Global Broadcast" is used to reach all modules (thru bus converters).
     99  1.1  skrll  *
    100  1.1  skrll  * SPA space (see below) ranges from 0xF1000000 thru 0xFFFC0000.
    101  1.1  skrll  */
    102  1.1  skrll 
    103  1.1  skrll #define	HPPA_IOBEGIN	0xF0000000
    104  1.1  skrll #define	HPPA_IOLEN	0x10000000
    105  1.1  skrll #define	PDC_ADDR	0xEF000000	/* explained above */
    106  1.1  skrll #define	IO_ADDR		0xF1000000
    107  1.1  skrll #define	SGC_SLOT1	0xF4000000	/* (hppa) */
    108  1.1  skrll #define	SGC_SLOT2	0xF8000000	/* (hppa) */
    109  1.1  skrll #define	SGC_SIZE	0x02000000	/* (hppa) */
    110  1.1  skrll #define	FP_ADDR		0xFFF80000
    111  1.1  skrll #define	LBCAST_ADDR	0xFFFC0000
    112  1.1  skrll #define	GBCAST_ADDR	0xFFFE0000
    113  1.1  skrll 
    114  1.1  skrll #define	PDC_LOW		PDC_ADDR	/* define some ranges */
    115  1.1  skrll #define	PDC_HIGH	IO_ADDR
    116  1.1  skrll #define	FPA_LOW		FP_ADDR
    117  1.1  skrll #define	FPA_HIGH	LBCAST_ADDR
    118  1.1  skrll #define	SPA_LOW		IO_ADDR
    119  1.1  skrll #define	SPA_HIGH	LBCAST_ADDR
    120  1.1  skrll #define	SGC_LOW		SGC_SLOT1
    121  1.1  skrll #define	SGC_HIGH	(SGC_SLOT2+SGC_SIZE)
    122  1.1  skrll 
    123  1.1  skrll #define	FPA_IOMOD	((FPA_HIGH-FPA_LOW)/sizeof(struct iomod))
    124  1.1  skrll #define	MAXMODBUS	((int)(FPA_IOMOD))	/* maximum modules/bus */
    125  1.1  skrll 
    126  1.1  skrll #define	HPPA_FLEX_COUNT	0x4000		/* number of "flex" blocks */
    127  1.1  skrll #define	HPPA_FLEX_MASK	0xFFFC0000	/* (see below) */
    128  1.1  skrll #define	HPPA_FLEX_SIZE	(~HPPA_FLEX_MASK + 1)
    129  1.1  skrll #define	HPPA_FLEX(a)	(((a) & HPPA_FLEX_MASK) >> 18)
    130  1.1  skrll 
    131  1.1  skrll /* size of HPA space for any device */
    132  1.1  skrll #define	IOMOD_HPASIZE	0x1000
    133  1.1  skrll 
    134  1.1  skrll /* offset to the device-specific registers,
    135  1.1  skrll  * basically sizeof(struct iomod) (see later)
    136  1.1  skrll  */
    137  1.1  skrll #define	IOMOD_DEVOFFSET	0x800
    138  1.1  skrll 
    139  1.1  skrll #if !defined(_LOCORE)
    140  1.1  skrll 
    141  1.1  skrll /*
    142  1.1  skrll  * The first 2K of Soft Physical Address space on the Initial Memory Module
    143  1.1  skrll  * is aptly called "page zero".  The following structure defines the format
    144  1.1  skrll  * of page zero.  Individual members of this structure should be accessed
    145  1.1  skrll  * as "PAGE0->member".
    146  1.1  skrll  */
    147  1.1  skrll 
    148  1.1  skrll #define	PAGE0	((struct pagezero *)0)	/* can't get any lower than this! */
    149  1.1  skrll 
    150  1.1  skrll struct pagezero {
    151  1.1  skrll 	/* [0x000] Initialize Vectors */
    152  1.1  skrll 	int	ivec_special;		/* must be zero */
    153  1.1  skrll 	int	(*ivec_mempf)(void);	/* powerfail recovery software */
    154  1.1  skrll 	int	(*ivec_toc)(void);	/* exec'd after Transfer Of Control */
    155  1.1  skrll 	u_int	ivec_toclen;		/* bytes of ivec_toc code */
    156  1.1  skrll 	int	(*ivec_rendz)(void);	/* exec'd after Rendezvous Signal */
    157  1.1  skrll 	u_int	ivec_mempflen;		/* bytes of ivec_mempf code */
    158  1.1  skrll 	u_int	ivec_resv[2];		/* (reserved) */
    159  1.1  skrll 	u_int	ivec_mbz;		/* must be zero */
    160  1.1  skrll 	u_int	ivec_resv2[7];		/* (reserved) */
    161  1.1  skrll 
    162  1.1  skrll 	/* [0x040] Processor Dependent */
    163  1.1  skrll 	union	{
    164  1.1  skrll 		u_int	pd_Resv1[112];	/* (reserved) processor dependent */
    165  1.1  skrll 		struct	{		/* Viper-specific data */
    166  1.1  skrll 			u_int	v_Resv1[39];
    167  1.1  skrll 			u_int	v_Ctrlcpy;	/* copy of Viper `vi_control' */
    168  1.1  skrll 			u_int	v_Resv2[72];
    169  1.1  skrll 		} pd_Viper;
    170  1.1  skrll 	} pz_Pdep;
    171  1.1  skrll 
    172  1.1  skrll 	/* [0x200] IODC Data Area Descriptors
    173  1.1  skrll 		   use PDC_ALLOC to allocate these memory regions */
    174  1.1  skrll 	u_int	iodc_cons_base;		/* */
    175  1.1  skrll 	u_int	iodc_cons_size;		/* */
    176  1.1  skrll 	u_int	iodc_kbrd_base;		/* */
    177  1.1  skrll 	u_int	iodc_kbrd_size;		/* */
    178  1.1  skrll 	u_int	iodc_boot_base;		/* */
    179  1.1  skrll 	u_int	iodc_boot_size;		/* */
    180  1.1  skrll 
    181  1.1  skrll 	/* [0x218] */
    182  1.1  skrll 	u_int	resv1[0x41];
    183  1.1  skrll 
    184  1.1  skrll 	/* [0x31C] Capability Flags */
    185  1.1  skrll 	u_int	cap_flags;		/* system capabitlities */
    186  1.1  skrll #define	HPPA_CAP_WIDESCSI	0x00000001
    187  1.1  skrll 
    188  1.1  skrll 	/* [0x320] Keyboard Extensions */
    189  1.1  skrll 	u_int	kbrd_ext[2];
    190  1.1  skrll 
    191  1.1  skrll 	/* [0x328] Boot Device Extensions */
    192  1.1  skrll 	u_int	boot_ext[2];
    193  1.1  skrll 
    194  1.1  skrll 	/* [0x330] Console/Display Extensions */
    195  1.1  skrll 	u_int	cons_ext[2];
    196  1.1  skrll 
    197  1.1  skrll 	/* [0x338] Initial Memory Module Extensions */
    198  1.1  skrll 	u_int	imm_ext[2];
    199  1.1  skrll 
    200  1.1  skrll 	/* [0x340] Memory Configuration */
    201  1.1  skrll 	u_int	memc_cont_l;		/* memc_cont low part */
    202  1.1  skrll 	u_int	memc_phsize_l;		/* memc_phsize low part */
    203  1.1  skrll 	u_int	memc_adsize_l;		/* memc_adsize low part */
    204  1.1  skrll 	u_int	memc_resv;		/* (reserved) */
    205  1.1  skrll 	u_int	memc_cont;		/* bytes of contiguous valid memory */
    206  1.1  skrll 	u_int	memc_phsize;		/* bytes of valid physical memory */
    207  1.1  skrll 	u_int	memc_adsize;		/* bytes of SPA space used by PDC */
    208  1.1  skrll 	u_int	memc_hpa_h;		/* HPA of CPU (high) */
    209  1.1  skrll 
    210  1.1  skrll 	/* [0x360] Miscellaneous */
    211  1.1  skrll 	struct boot_err mem_be[8];	/* boot errors (see above) */
    212  1.1  skrll 	u_int	mem_free;		/* first free phys. memory location */
    213  1.1  skrll 	u_int	mem_hpa;		/* HPA of CPU */
    214  1.1  skrll 	int	(*mem_pdc)(void);	/* PDC entry point */
    215  1.1  skrll 	u_int	mem_10msec;		/* # of Interval Timer ticks in 10msec*/
    216  1.1  skrll 
    217  1.1  skrll 	/* [0x390] Initial Memory Module */
    218  1.1  skrll 	struct iomod *imm_hpa;		/* HPA of Initial Memory module */
    219  1.1  skrll 	u_int	imm_soft_boot;		/* 0 == hard boot, 1 == soft boot */
    220  1.1  skrll 	u_int	imm_spa_size;		/* bytes of SPA in IMM */
    221  1.1  skrll 	u_int	imm_max_mem;		/* bytes of mem in IMM (<= spa_size) */
    222  1.1  skrll 
    223  1.1  skrll 	/* [0x3A0] Boot Console/Display, Device, and Keyboard */
    224  1.1  skrll 	struct pz_device mem_cons;	/* description of console device */
    225  1.1  skrll 	struct pz_device mem_boot;	/* description of boot device */
    226  1.1  skrll 	struct pz_device mem_kbd;	/* description of keyboard device */
    227  1.1  skrll 
    228  1.1  skrll 	/* [0x430] Reserved */
    229  1.1  skrll 	u_int	resv2[116];		/* (reserved) */
    230  1.1  skrll 
    231  1.1  skrll 	/* [0x600] Processor Dependent */
    232  1.1  skrll 	u_int	pd_resv2[128];		/* (reserved) processor dependent */
    233  1.1  skrll };
    234  1.1  skrll #define	v_ctrlcpy	pz_Pdep.pd_Viper.v_Ctrlcpy
    235  1.1  skrll 
    236  1.1  skrll 
    237  1.1  skrll /*
    238  1.1  skrll  * Every module has 4K-bytes of address space associated with it.
    239  1.1  skrll  * A Hard Physical Address (HPA) can be broken down as follows.
    240  1.1  skrll  *
    241  1.1  skrll  * Since this is an I/O space, the high 4 bits are always 1's.
    242  1.1  skrll  *
    243  1.1  skrll  * The "flex" address specifies which bus a module is on; there are
    244  1.1  skrll  * 256K-bytes of HPA space for each bus, however only values from
    245  1.1  skrll  * 64 - 1022 are valid for the "flex" field (1022 designates the
    246  1.1  skrll  * central bus).  The "flex" addr is set at bus configuration time.
    247  1.1  skrll  *
    248  1.1  skrll  * The "fixed" address specifies a particular module on the same
    249  1.1  skrll  * bus (i.e. among modules with the same "flex" address).  This
    250  1.1  skrll  * value can also be found in "device_path.dp_mod" in "pdc.h".
    251  1.1  skrll  *
    252  1.1  skrll  * A modules HPA space consists of 2 pages; the "up" bit specifies
    253  1.1  skrll  * which of these pages is being addressed.  In general, the lower
    254  1.1  skrll  * page is privileged and the upper page it module-type dependent.
    255  1.1  skrll  *
    256  1.1  skrll  */
    257  1.1  skrll 
    258  1.1  skrll struct hpa {
    259  1.1  skrll 	u_int	hpa_ones: 4,	/* must be 1's; this is an I/O space addr */
    260  1.1  skrll 		hpa_flex:10,	/* bus address for this module */
    261  1.1  skrll 		hpa_fixed:6,	/* location of module on bus */
    262  1.1  skrll 		hpa_up	: 1,	/* 1 == upper page, 0 == lower page */
    263  1.1  skrll 		hpa_set	: 5,	/* register set */
    264  1.1  skrll 		hpa_reg	: 4,	/* register number within a register set */
    265  1.1  skrll 		hpa_zeros:2;	/* must be 0's; addrs are word aligned */
    266  1.1  skrll };
    267  1.1  skrll 
    268  1.1  skrll 
    269  1.1  skrll /*
    270  1.1  skrll  * Certain modules require additional memory (i.e. more than that
    271  1.1  skrll  * provided by the HPA space).  A Soft Physical Address (SPA) can be
    272  1.1  skrll  * broken down as follows, on a module-type specific basis (either
    273  1.1  skrll  * Memory SPA or I/O SPA).
    274  1.1  skrll  *
    275  1.1  skrll  * SPA space must be a power of 2, and aligned accordingly.  The IODC
    276  1.1  skrll  * provides all information needed by software to configure SPA space
    277  1.1  skrll  * for a particular module.
    278  1.1  skrll  */
    279  1.1  skrll 
    280  1.1  skrll struct memspa {
    281  1.1  skrll 	u_int	spa_page:21,	/* page of memory */
    282  1.1  skrll 		spa_off	:11;	/* offset into memory page */
    283  1.1  skrll };
    284  1.1  skrll 
    285  1.1  skrll struct iospa {
    286  1.1  skrll 	u_int	spa_ones: 4,	/* must be 1's; this is an I/O space addr */
    287  1.1  skrll 		spa_iopg:17,	/* page in I/O address space */
    288  1.1  skrll 		spa_set	: 5,	/* register set */
    289  1.1  skrll 		spa_reg	: 4,	/* register number within a register set */
    290  1.1  skrll 		spa_mode: 2;	/* aligned according to bus transaction mode */
    291  1.1  skrll };
    292  1.1  skrll 
    293  1.1  skrll 
    294  1.1  skrll /*
    295  1.1  skrll  * It is possible to send a command to all modules on a particular bus
    296  1.1  skrll  * (local broadcast), or all modules (global broadcast).  A Broadcast
    297  1.1  skrll  * Physical Address (BPA) can be broken down as follows.
    298  1.1  skrll  *
    299  1.1  skrll  * Read and Clear transactions are not allowed in BPA space.  All pages
    300  1.1  skrll  * in BPA space are privileged.
    301  1.1  skrll  */
    302  1.1  skrll 
    303  1.1  skrll struct bpa {
    304  1.1  skrll 	u_int	bpa_ones:14,	/* must be 1's; this is in BPA space */
    305  1.1  skrll 		bpa_gbl	: 1,	/* 0 == local, 1 == global broadcast */
    306  1.1  skrll 		bpa_page: 6,	/* page in local/global BPA space */
    307  1.1  skrll 		bpa_set	: 5,	/* register set */
    308  1.1  skrll 		bpa_reg	: 4,	/* register number within a register set */
    309  1.1  skrll 		bpa_zeros:2;	/* must be 0's; addrs are word aligned */
    310  1.1  skrll };
    311  1.1  skrll 
    312  1.1  skrll 
    313  1.1  skrll /*
    314  1.1  skrll  * All I/O and Memory modules have 4K-bytes of HPA space associated with
    315  1.1  skrll  * it (described above), however not all modules implement every register.
    316  1.1  skrll  * The first 2K-bytes of registers are "privileged".
    317  1.1  skrll  *
    318  1.1  skrll  * (WO) == Write Only, (RO) == Read Only
    319  1.1  skrll  */
    320  1.1  skrll 
    321  1.1  skrll struct iomod {
    322  1.1  skrll /* SRS (Supervisor Register Set) */
    323  1.1  skrll 	u_int	io_eir;		/* (WO) interrupt CPU; set bits in EIR CR */
    324  1.1  skrll 	u_int	io_eim;		/* (WO) External Interrupt Message address */
    325  1.1  skrll 	u_int	io_dc_rw;	/* write address of IODC to read IODC data */
    326  1.1  skrll 	u_int	io_ii_rw;	/* read/clear external intrpt msg (bit-26) */
    327  1.1  skrll 	void *	io_dma_link;	/* pointer to "next quad" in DMA chain */
    328  1.1  skrll 	u_int	io_dma_command;	/* (RO) chain command to exec on "next quad" */
    329  1.1  skrll 	void *	io_dma_address;	/* (RO) start of DMA */
    330  1.1  skrll 	u_int	io_dma_count;	/* (RO) number of bytes remaining to xfer */
    331  1.1  skrll 	void *	io_flex;	/* (WO) HPA flex addr, LSB: bus master flag */
    332  1.1  skrll 	void *	io_spa;		/* (WO) SPA space; 0-20:addr, 24-31:iodc_spa */
    333  1.1  skrll 	u_int	resv1[2];	/* (reserved) */
    334  1.1  skrll 	u_int	io_command;	/* (WO) module commands (see below) */
    335  1.1  skrll 	u_int	io_status;	/* (RO) error returns (see below) */
    336  1.1  skrll 	u_int	io_control;	/* memory err logging (bit-9), bc forwarding */
    337  1.1  skrll 	u_int	io_test;	/* (RO) self-test information */
    338  1.1  skrll /* ARS (Auxiliary Register Set) */
    339  1.1  skrll 	u_int	io_err_sadd;	/* (RO) slave bus error or memory error addr */
    340  1.1  skrll 	void *	chain_addr;	/* start address of chain RAM */
    341  1.1  skrll 	u_int	sub_mask_clr;	/* ignore intrpts on sub-channel (bitmask) */
    342  1.1  skrll 	u_int	sub_mask_set;	/* service intrpts on sub-channel (bitmask) */
    343  1.1  skrll 	u_int	diagnostic;	/* diagnostic use (reserved) */
    344  1.1  skrll 	u_int	resv2[2];	/* (reserved) */
    345  1.1  skrll 	void *	nmi_address;	/* address to send data to when NMI detected */
    346  1.1  skrll 	void *	nmi_data;	/* NMI data to be sent */
    347  1.1  skrll 	u_int	resv3[3];	/* (reserved) */
    348  1.1  skrll 	u_int	io_mem_low;	/* bottom of memory address range */
    349  1.1  skrll 	u_int	io_mem_high;	/* top of memory address range */
    350  1.1  skrll 	u_int	io_io_low;	/* bottom of I/O HPA address Range */
    351  1.1  skrll 	u_int	io_io_high;	/* top of I/O HPA address Range */
    352  1.1  skrll 
    353  1.1  skrll 	u_int	priv_trs[160];	/* TRSes (Type-dependent Reg Sets) */
    354  1.1  skrll 
    355  1.1  skrll 	u_int	priv_hvrs[320];	/* HVRSes (HVERSION-dependent Register Sets) */
    356  1.1  skrll 
    357  1.1  skrll 	u_int	hvrs[512];	/* HVRSes (HVERSION-dependent Register Sets) */
    358  1.1  skrll };
    359  1.1  skrll 
    360  1.1  skrll #define IOMOD_IO_IO_LOW(mod)	(((struct iomod *)(mod))->io_io_low)
    361  1.1  skrll #define IOMOD_IO_IO_HIGH(mod)	(((struct iomod *)(mod))->io_io_high)
    362  1.1  skrll 
    363  1.1  skrll #endif	/* !_LOCORE */
    364  1.1  skrll 
    365  1.1  skrll /* primarily for a "reboot" and "_rtt" routines */
    366  1.1  skrll #define	iomod_command	(4*12)
    367  1.1  skrll 
    368  1.1  skrll /* io_flex */
    369  1.1  skrll #define	DMA_ENABLE	0x1	/* flex register enable DMA bit */
    370  1.1  skrll 
    371  1.1  skrll /* io_spa */
    372  1.1  skrll #define	IOSPA(spa,iodc_data)	\
    373  1.1  skrll 	((volatile void *)		\
    374  1.1  skrll 	 (spa | iodc_data.iodc_spa_shift | iodc_data.iodc_spa_enb << 5 | \
    375  1.1  skrll 	  iodc_data.iodc_spa_pack << 6 | iodc_data.iodc_spa_io << 7))
    376  1.1  skrll 
    377  1.1  skrll /* io_command */
    378  1.1  skrll #define	CMD_STOP	0	/* halt any I/O, enable diagnostic access */
    379  1.1  skrll #define	CMD_FLUSH	1	/* abort DMA */
    380  1.1  skrll #define	CMD_CHAIN	2	/* initiate DMA */
    381  1.1  skrll #define	CMD_CLEAR	3	/* clear errors */
    382  1.1  skrll #define	CMD_RESET	5	/* reset any module */
    383  1.1  skrll 
    384  1.1  skrll /* io_status */
    385  1.1  skrll #define	IO_ERR_MEM_SL	0x10000	/* SPA space lost or corrupted */
    386  1.1  skrll #define	IO_ERR_MEM_SE	0x00200	/* severity: minor */
    387  1.1  skrll #define	IO_ERR_MEM_HE	0x00100	/* severity: affects invalid parts */
    388  1.1  skrll #define	IO_ERR_MEM_FE	0x00080	/* severity: bad */
    389  1.1  skrll #define	IO_ERR_MEM_RY	0x00040	/* IO_COMMAND register ready for command */
    390  1.1  skrll #define	IO_ERR_DMA_DG	0x00010	/* module in diagnostic mode */
    391  1.1  skrll #define	IO_ERR_DMA_PW	0x00004	/* Power Failing */
    392  1.1  skrll #define	IO_ERR_DMA_PL	0x00002	/* Power Lost */
    393  1.1  skrll #define	IO_ERR_VAL(x)	 (((x) >> 10) & 0x3f)
    394  1.1  skrll #define	IO_ERR_DEPEND	 0	/* unspecified error */
    395  1.1  skrll #define	IO_ERR_SPA	 1	/* (module-type specific) */
    396  1.1  skrll #define	IO_ERR_INTERNAL	 2	/* (module-type specific) */
    397  1.1  skrll #define	IO_ERR_MODE	 3	/* invalid mode or address space mapping */
    398  1.1  skrll #define	IO_ERR_ERROR_M	 4	/* bus error (master detect) */
    399  1.1  skrll #define	IO_ERR_DPARITY_S 5	/* data parity (slave detect) */
    400  1.1  skrll #define	IO_ERR_PROTO_M	 6	/* protocol error (master detect) */
    401  1.1  skrll #define	IO_ERR_ADDRESS	 7	/* no slave acknowledgement in transaction */
    402  1.1  skrll #define	IO_ERR_MORE	 8	/* device transferred more data than expected */
    403  1.1  skrll #define	IO_ERR_LESS	 9	/* device transferred less data than expected */
    404  1.1  skrll #define	IO_ERR_SAPARITY	10	/* slave address phase parity */
    405  1.1  skrll #define	IO_ERR_MAPARITY	11	/* master address phase parity */
    406  1.1  skrll #define	IO_ERR_MDPARITY	12	/* mode phase parity */
    407  1.1  skrll #define	IO_ERR_STPARITY	13	/* status phase parity */
    408  1.1  skrll #define	IO_ERR_CMD	14	/* unimplemented I/O Command */
    409  1.1  skrll #define	IO_ERR_BUS	15	/* generic bus error */
    410  1.1  skrll #define	IO_ERR_CORR	24	/* correctable memory error */
    411  1.1  skrll #define	IO_ERR_UNCORR	25	/* uncorrectable memory error */
    412  1.1  skrll #define	IO_ERR_MAP	26	/* equivalent to IO_ERR_CORR */
    413  1.1  skrll #define	IO_ERR_LINK	28	/* Bus Converter "link" (connection) error */
    414  1.1  skrll #define	IO_ERR_CCMD	32	/* Illegal DMA command */
    415  1.1  skrll #define	IO_ERR_ERROR_S	52	/* bus error (slave detect) */
    416  1.1  skrll #define	IO_ERR_DPARITY_M 53	/* data parity (master detect) */
    417  1.1  skrll #define	IO_ERR_PROTOCOL	54	/* protocol error (slave detect) */
    418  1.1  skrll #define	IO_ERR_SELFTEST	58	/* (module-type specific) */
    419  1.1  skrll #define	IO_ERR_BUSY	59	/* slave was busy too often or too long */
    420  1.1  skrll #define	IO_ERR_RETRY	60	/* "busied" transaction not retried soon enough */
    421  1.1  skrll #define	IO_ERR_ACCESS	61	/* illegal register access */
    422  1.1  skrll #define	IO_ERR_IMPROP	62	/* "improper" data written */
    423  1.1  skrll #define	IO_ERR_UNKNOWN	63
    424  1.1  skrll 
    425  1.1  skrll /* io_control (memory) */
    426  1.1  skrll #define	IO_CTL_MEMINIT	0x0	/* prevent some bus errors during memory init */
    427  1.1  skrll #define	IO_CTL_MEMOKAY	0x100	/* enable all bus error logging */
    428  1.1  skrll 
    429  1.1  skrll /* io_spa */
    430  1.1  skrll #define	SPA_ENABLE	0x20	/* io_spa register enable spa bit */
    431  1.1  skrll 
    432  1.1  skrll #define	EIM_GRPMASK	0x1F	/* EIM register group mask */
    433  1.1  skrll #define	EIEM_MASK(eim)	(0x80000000 >> (eim & EIM_GRPMASK))
    434  1.1  skrll #define	EIEM_BITCNT	32	/* number of bits in EIEM register */
    435  1.1  skrll 
    436  1.1  skrll #endif	/* _MACHINE_IOMOD_H_ */
    437