bscv_impl.h revision dd4eeefdb8e4583c47e28a7f315db6087931ef06
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_BSCV_IMPL_H
#define _SYS_BSCV_IMPL_H
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Implementation private header file for bscv driver.
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/lom_priv.h>
/*
* Local #defines
*/
#define BSCV_SUCCESS DDI_SUCCESS
#define BSCV_FAILURE DDI_FAILURE
/*
* The following are used as progress indicators in bscv_attach()
*/
#define BSCV_LOCKS 0x01
#define BSCV_MAPPED_REGS 0x02
#define BSCV_NODES 0x04
#define BSCV_THREAD 0x08
#define BSCV_HOSTNAME_DONE 0x10
#define BSCV_WDOG_CFG 0x20
#define BSCV_SIG_SENT 0x40
/*
* macros to encode device minors and provide mapping to device instances.
* The following is designed to get around the problem of a 32-bit app not
* supporting a 32-bit minor number on an LP64 model system.
*/
#ifdef NBITSMINOR
#define NBITSMINOR 18
#endif
#define BSCV_MONITOR_NODE 0
/*
* The maximum number of leds which are supported by this lom implementation.
*/
#define MAX_LED_ID 7
/*
* general driver configuration constants which may be changed to improve
*/
/*
* Event processing task status flags.
*/
#define TASK_ALIVE_FLG 0x01
#define TASK_STOP_FLG 0x02
#define TASK_SLEEPING_FLG 0x04
#define TASK_PAUSE_FLG 0x08
#define TASK_EVENT_PENDING_FLG 0x10
#define TASK_EVENT_CONSUMER_FLG 0x20
/*
* strace(1M) prints out the debug data once the debug value is set in
* the bscv.conf file and the debug driver is installed.
*
* Debug flags
*
* '@' - Register (@)ccess
* 'A' - (A)ttach
* 'B' - (B)lom1 attach extra
* 'C' - lom1 (C)allback
* 'D' - (D)aemon
* 'E' - (E)vents
* 'F' - Sel(F)test
* 'I' - (I)octl
* 'L' - TSa(L)arms
* 'M' - (M)odel parameters
* 'N' - I(N)terrupt Service Routine
* 'P' - (P)rogramming
* 'Q' - (Q)ueue things
* 'S' - Event (S)trings
* 'U' - Programming ioctls
* 'V' - ???
* 'W' - (W)atchdog
* 'X' - additional X86 functional calls
* 'Z' - Temporary - just log things
*/
/*
* Debug tips :
*
* strace(1M) prints out the debug data.
* A nice way to work out the debug value set in bscv.conf is to use mdb
* Say we want to show 'D' Daemon and 'I' IOCTL processing,
* you calculate the debug value with the following mdb session :
* # mdb
* > 1<<('D'-'@') | 1<<('I'-'@') = X
* 210
* > $q
* When you insert "debug=0x210;" into bscv.conf, it causes the next
* reboot with the debug driver to trace Daemon and IOCTL functionality.
*/
/*
* Xbus channel access data
*/
struct xbus_channel {
};
#define BSCV_MINCHANNELS 2
#define BSCV_MAXCHANNELS 16
/*
* soft state structure
*/
typedef
struct {
/*
* Hardware instance variables
*/
int instance; /* instance number for the device */
int nchannels;
int progress; /* progress indicator for attach */
int bad_resync; /* Number of bad resyncs */
/*
*/
int serial_reporting;
int reporting_level;
/*
* lom2 static information.
* setup at driver attach and restart after programming.
*/
int num_fans;
/* dont have to re-read names */
/* dont have to re-read names */
/* dont have to re-read names */
/*
* lom2 firmware communication
*/
/*
* cmd_mutex protects the lom2 command progress variables.
*
* command_error - acts as a return code and may be read
* without the mutex held if a command is not in progress.
* Note a read only returns failure if the lom does not respond.
* So you might need to check the error code to see if things really
* did work!
*
* addr_mu is used to protect stopping and starting of the queue.
* BUT when programming it has different semantics and relies
* on only the programming thread being in the ioctl routine
* whilst programming is in progress. The event queue must also
* be paused at this time.
*/
int command_error; /* error code from last command */
/* valid until the next command */
/* starts. */
/*
* Programming variables
*/
/* the lom */
/* the BSC */
int prog_index; /* data buffer number - bit */
/* 0x8000 set if last buffer */
int image_ptr; /* ptr to next byte in image buffer */
/* for programming */
/* programming */
/* 2 BSC images being processed */
/*
* LOM eeprom window access state
* Access under bscv_enter/bscv_exit protection.
*/
/*
* Communication with the event processing thread
*
* Change these variables with task_mu held and signal task_cv
*/
int task_flags; /* To monitor/stop the event thread */
volatile int event_active_count; /* Count of event thread runs */
#ifdef __sparc
#endif /* __sparc */
/* unschedule the panic callback */
#endif /* __i386 || __amd64 */
struct bscv_idi_callout {
};
#define BSCV_IDI_CALLOUT_MAGIC 0xb5c1ca11
#define BSCV_IDI_ERR_MSG_THRESHOLD 10
struct bscv_idi_callout_mgr {
/*
* To allow for sanity check.
*/
/*
* The instance number of "an" instance of the driver. This is assigned
* during driver attach.
*/
/*
* Table of services offered via the idi interface.
*/
struct bscv_idi_callout *tbl;
/*
* Error message count since last successful use of the idi interface.
*/
};
#define BSC_ADDR_CACHE_LIMIT \
#define BSC_INFORM_ONLINE 0x4f530100
#define BSC_INFORM_OFFLINE 0x4f530201
#define BSC_INFORM_PANIC 0x4f530204
#include <sys/lom_ebuscodes.h>
typedef uint32_t bscv_addr_t;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_BSCV_IMPL_H */