wrsm_driver.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 (c) 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ifndef _SYS_WRSM_DRIVER_H
#define _SYS_WRSM_DRIVER_H
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/wci_offsets.h>
#include <sys/wrsm_common.h>
#include <sys/wrsm_config.h>
#include <sys/wci_common.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* only wrsm_driver.c should include this header.
* all others should include wrsm_lc.c
*/
/*
* Timeout periods in seconds. (Multiplied by MICROSEC to get the number
* of microsecs for the requested number of seconds - for drv_to_hz().)
*/
/* shortterm interval is given in minutes */
#define WRSM_AVG_WEIGHT 10
#define WRSM_SHORTTERM_INTERVAL 60
#define WRSM_SHORTS_PER_LONGTERM 24
/*
* index of register ranges in "registers" property
*/
#define WRSM_REGS 0
#define WRSM_SRAM 1
#define MASKALL 0xFFFFFFFFFFFFFFFFULL
/*
* WRSM OBP properties
*/
#define OBP_WRSM_PORTID "portid"
#define WRSM_RSM_CTR "rsm_controller"
#define WRSM_ADMIN "admin"
#define MAXERRORS 1000
typedef union {
struct {
} reasons;
typedef enum {
wrsm_device, /* a real WCI */
wrsm_rsm_controller, /* a pseudo dev for an RSM controller */
wrsm_admin /* the wrsm admin pseudo dev */
typedef struct {
/* for links just coming up */
} link_t;
/* globals */
/* weight of old average in error average */
extern uint_t wrsm_avg_weight;
/* minutes in shortterm error interval */
extern uint_t wrsm_shortterm_interval;
/* number of shortterm intervals per long term interval */
extern uint_t wrsm_shorts_per_longterm;
/*
* lc_mutex primarily is used to secure changes to the link states
* however, in addition to protecting per link states changes, the counters:
* oldlink_waitdown_cnt and newlink_waitup_cnt must also
* be protected from changes of different threads. lc_mutex is also
* used to protect any access to softsp->config.
* newlink_waitup_cnt is important for keeping track of the NEW bringup
* link requested initiated in lc_installconfig.
* oldlink_waitdown_cnt is important for keeping track of the lc_cleanconfig
* initiated takedown request.
* the count of oldlink_waitdown_cnt & newlink_waitup_cnt is how the LC
* differentiates between events in the LC forcing takedowns and bringup
* and external events requesting takedown and bringups. These two counters
* increment on request and they are decremented when the task is done.
* They are both 0 when there are no pending external request.
* Polling on a link starts in wciinit and ends in wcifini
*/
struct wrsm_soft_state {
int instance; /* DDI instance */
int minor; /* device minor number */
int board; /* Board number */
/* lc_installconfig clear to go */
int oldlink_waitdown_cnt; /* cnt of takedown request on old */
int newlink_waitup_cnt; /* cnt of new bringup link request */
int open; /* flag indicates if device is open */
unsigned char *wrsm_sram; /* paddr for SRAM */
volatile unsigned char *wrsm_regs; /* vaddr WRSM regs */
/*
* wci revision: wci1, wci2 or wci3 where
* wci 1 wci_id.parid = 0x4776
* wci 2 wci_id.parid = 0x4147
* wci 3 wci_id.parid = 0x4063
*/
int wci_rev; /* wci1, wci2, wci3 .. ? */
/* pre-calc offset of ecc registers */
volatile uint64_t *wci_dco_ce_cnt_vaddr;
volatile uint64_t *wci_dc_esr_vaddr;
volatile uint64_t *wci_dco_state_vaddr;
volatile uint64_t *wci_ca_esr_0_vaddr;
volatile uint64_t *wci_ra_esr_1_vaddr;
volatile uint64_t *wci_ca_ecc_addr_vaddr;
volatile uint64_t *wci_ra_ecc_addr_vaddr;
volatile uint64_t *wci_cci_esr_vaddr;
/* WCI common soft state */
/* kstat structs */
/* kstat saved values */
};
typedef struct wrsm_soft_state wrsm_softstate_t;
/*
* wrsm open flag
*/
#define WRSM_OPEN_EXCLUSIVE (-1)
#ifdef __cplusplus
}
#endif
#endif /* _SYS_WRSM_DRIVER_H */