sysiosbus.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SYSIOSBUS_H
#define _SYS_SYSIOSBUS_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifndef _ASM
#include <sys/machsystm.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* Things for debugging */
#ifdef SYSIO_MEM_DEBUG
#define IO_MEMUSAGE
#endif /* SYSIO_MEM_DEBUG */
/*
* sysio sbus constant definitions.
*/
#define OFF_SYSIO_CTRL_REG 0x10
#define SYSIO_CTRL_REG_SIZE (NATURAL_REG_SIZE)
#define OFF_SBUS_CTRL_REG 0x2000
#define SBUS_CTRL_REG_SIZE (NATURAL_REG_SIZE)
#define OFF_SBUS_SLOT_CONFIG 0x2020
#define OFF_INTR_MAPPING_REG 0x2c00
/* #define INTR_MAPPING_REG_SIZE (NATURAL_REG_SIZE * 16 * 8) */
#define INTR_MAPPING_REG_SIZE 0x490
#define OFF_CLR_INTR_REG 0x3408
/* #define CLR_INTR_REG_SIZE (NATURAL_REG_SIZE * 16 * 8) */
#define CLR_INTR_REG_SIZE 0x488
#define OFF_INTR_RETRY_REG 0x2c20
#define INTR_RETRY_REG_SIZE (MIN_REG_SIZE)
#define OFF_SBUS_INTR_STATE_REG 0x4800
#define SYSIO_IGN 46
#define SBUS_ARBIT_ALL 0x3full
#define SYSIO_VER_SHIFT 56
/* Error registers */
#define OFF_SYSIO_ECC_REGS 0x20
#define SYSIO_ECC_REGS_SIZE NATURAL_REG_SIZE
#define OFF_SYSIO_UE_REGS 0x30
#define OFF_SYSIO_CE_REGS 0x40
#define OFF_SBUS_ERR_REGS 0x2010
/* Interrupts */
#define SBUS_INTR_IDLE 0ull
/*
* Fix these (RAZ)
* Interrupt Mapping Register defines
*/
#define MAX_SBUS (30)
#define MAX_SBUS_LEVEL (7)
#define SYSIO_BURST_MASK 0xffff
#define SYSIO64_BURST_MASK 0xffff0000
#define SYSIO64_BURST_SHIFT 16
#define MAX_PIL 16
/* Slot config register defines */
#define SBUS_ETM 0x4000ull
/*
* Offsets of sysio, sbus, registers
*/
/* Slot configuration register mapping offsets */
#define SBUS_SLOT0_CONFIG 0x0
#define SBUS_SLOT1_CONFIG 0x1
#define SBUS_SLOT2_CONFIG 0x2
#define SBUS_SLOT3_CONFIG 0x3
#define SBUS_SLOT4_CONFIG 0x4
#define SBUS_SLOT5_CONFIG 0x5
#define SBUS_SLOT6_CONFIG 0x6
/* Interrupt mapping register mapping offsets */
#define SBUS_SLOT0_MAPREG 0x0
#define SBUS_SLOT1_MAPREG 0x1
#define SBUS_SLOT2_MAPREG 0x2
#define SBUS_SLOT3_MAPREG 0x3
#define ESP_MAPREG 0x80
#define ETHER_MAPREG 0x81
#define PP_MAPREG 0x82
#define AUDIO_MAPREG 0x83
#define KBDMOUSE_MAPREG 0x85
#define FLOPPY_MAPREG 0x86
#define THERMAL_MAPREG 0x87
#define TIMER0_MAPREG 0x8C
#define TIMER1_MAPREG 0x8D
#define UE_ECC_MAPREG 0x8E
#define CE_ECC_MAPREG 0x8F
#define SBUS_ERR_MAPREG 0x90
#define PM_WAKEUP_MAPREG 0x91
#define FFB_MAPPING_REG 0x92
#define EXP_MAPPING_REG 0x93
/* Interrupt clear register mapping offsets */
#define SBUS_SLOT0_L1_CLEAR 0x0
#define SBUS_SLOT0_L2_CLEAR 0x1
#define SBUS_SLOT0_L3_CLEAR 0x2
#define SBUS_SLOT0_L4_CLEAR 0x3
#define SBUS_SLOT0_L5_CLEAR 0x4
#define SBUS_SLOT0_L6_CLEAR 0x5
#define SBUS_SLOT0_L7_CLEAR 0x6
#define SBUS_SLOT1_L1_CLEAR 0x8
#define SBUS_SLOT1_L2_CLEAR 0x9
#define SBUS_SLOT1_L3_CLEAR 0xa
#define SBUS_SLOT1_L4_CLEAR 0xb
#define SBUS_SLOT1_L5_CLEAR 0xc
#define SBUS_SLOT1_L6_CLEAR 0xd
#define SBUS_SLOT1_L7_CLEAR 0xe
#define SBUS_SLOT2_L1_CLEAR 0x10
#define SBUS_SLOT2_L2_CLEAR 0x11
#define SBUS_SLOT2_L3_CLEAR 0x12
#define SBUS_SLOT2_L4_CLEAR 0x13
#define SBUS_SLOT2_L5_CLEAR 0x14
#define SBUS_SLOT2_L6_CLEAR 0x15
#define SBUS_SLOT2_L7_CLEAR 0x16
#define SBUS_SLOT3_L1_CLEAR 0x18
#define SBUS_SLOT3_L2_CLEAR 0x19
#define SBUS_SLOT3_L3_CLEAR 0x1a
#define SBUS_SLOT3_L4_CLEAR 0x1b
#define SBUS_SLOT3_L5_CLEAR 0x1c
#define SBUS_SLOT3_L6_CLEAR 0x1d
#define SBUS_SLOT3_L7_CLEAR 0x1e
#define ESP_CLEAR 0x7f
#define ETHER_CLEAR 0x80
#define PP_CLEAR 0x81
#define AUDIO_CLEAR 0x82
#define KBDMOUSE_CLEAR 0x84
#define FLOPPY_CLEAR 0x85
#define THERMAL_CLEAR 0x86
#define TIMER0_CLEAR 0x8B
#define TIMER1_CLEAR 0x8C
#define UE_ECC_CLEAR 0x8D
#define CE_ECC_CLEAR 0x8E
#define SBUS_ERR_CLEAR 0x8F
#define PM_WAKEUP_CLEAR 0x90
/*
* Bit shift for accessing the keyboard mouse interrupt state reg.
* note - The external devices are the only other devices where
* we need to check the interrupt state before adding or removing
* interrupts. There is an algorithm to calculate their bit shift.
*/
#define ESP_INTR_STATE_SHIFT 0
#define ETHER_INTR_STATE_SHIFT 2
#define PP_INTR_STATE_SHIFT 4
#define AUDIO_INTR_STATE_SHIFT 6
#define KBDMOUSE_INTR_STATE_SHIFT 10
#define FLOPPY_INTR_STATE_SHIFT 12
#define THERMAL_INTR_STATE_SHIFT 14
#define TIMER0_INTR_STATE_SHIFT 22
#define TIMER1_INTR_STATE_SHIFT 24
#define UE_INTR_STATE_SHIFT 26
#define CE_INTR_STATE_SHIFT 28
#define SERR_INTR_STATE_SHIFT 30
#define PM_INTR_STATE_SHIFT 32
#define MAX_MONDO_EXTERNAL 0x1f
#define SBUS_MAX_INO 0x3f
#define THERMAL_MONDO 0x2a
#define UE_ECC_MONDO 0x34
#define CE_ECC_MONDO 0x35
#define SBUS_ERR_MONDO 0x36
/* used for the picN kstats */
#define SBUS_NUM_PICS 2
#define SBUS_NUM_EVENTS 14
/* Offsets for Performance registers */
#define OFF_SBUS_PCR 0x100
#define OFF_SBUS_PIC 0x108
/*
* used to build array of event-names and pcr-mask values
*/
typedef struct sbus_event_mask {
char *event_name;
/*
* This type is used to describe addresses that we expect a device
* to place on a bus i.e. addresses from the iommu address space.
*/
/*
* sysio sbus soft state data structure.
* We use the sbus_ctrl_reg to flush hardware store buffers because
* there is very little hardware contention on this register.
*/
struct sbus_soft_state {
int upa_id; /* UPA ID of this SYSIO */
/*
* device node address property:
*/
/*
* access handles in case we need to map the registers ourself:
*/
volatile uint64_t *iommu_ctrl_reg;
volatile uint64_t *iommu_tlb_tag;
volatile uint64_t *iommu_tlb_data;
volatile uint64_t *sbus_slot_config_reg;
volatile uint64_t *clr_intr_reg;
volatile uint64_t *intr_retry_reg;
volatile uint64_t *sbus_intr_state;
volatile uint64_t *obio_intr_state;
volatile uint64_t *str_buf_flush_reg;
volatile uint64_t *str_buf_sync_reg;
volatile uint64_t *str_buf_pg_tag_diag;
int stream_buf_off;
int dma_reserve; /* Size reserved for fast DVMA */
int bto_ctr; /* counter for timeouts thereafter */
struct iophyslist *sbus_io_ranges;
int intr_mapping_ign; /* placeholder for the IGN */
#ifdef _STARFIRE
#endif /* _STARFIRE */
#ifdef DEBUG
#endif /* DEBUG */
/*
* Performance registers and kstat.
*/
};
/*
* Ugly interrupt cruft due to sysio inconsistencies.
*/
struct sbus_slot_entry {
int diagreg_shift;
};
struct sbus_intr_handler {
struct sbus_intr_handler *next;
};
/* sbus Interrupt routine wrapper structure */
struct sbus_wrapper_arg {
struct sbus_soft_state *softsp;
struct sbus_intr_handler *handler_list;
};
/*
* SYSIO parent private data structure contains register, interrupt, property
* and range information.
* Note: the only thing different from the "generic" sbus parent private
* data is the interrupt specification.
*/
struct sysio_parent_private_data {
int par_nreg; /* number of regs */
int par_nintr; /* number of interrupts */
int par_nrng; /* number of ranges */
};
#define SYSIO_PD(d) \
/* Used for legacy interrupts */
#define SBUS_INTR_STATE_DISABLE 0 /* disabled */
struct io_mem_list {
struct io_mem_list *next;
};
/*
* Function prototypes.
*/
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SYSIOSBUS_H */