sghsc.h revision 03831d35f7499c87d51205817c93e9a8d42c4bae
/*
* 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 2001 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_SGHSC_H
#define _SYS_SGHSC_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Serengeti CompactPCI Hot Swap Controller Driver header file. This file is
* structured in a following way: common, sghsc data (defines and structures)
* and mailbox related data (defines and structures).
*/
#include <sys/sgsbbc_mailbox.h>
/*
* sghsc node path with insert placeholders
*/
#define SGHSC_PATH "/ssm@%x,0/pci@%x,%x00000"
/*
* Mutex short hands
*/
#define SGHSC_MUTEX(sghsc) \
(&sghsc->sghsc_mutex)
#define SGHSC_MUTEX_OWNED(sghsc) \
#define SGHSC_MUTEX_ENTER(sghsc) \
#define SGHSC_MUTEX_EXIT(sghsc) \
/*
* Misc definitions
*/
#define SGHSC_ALL_SLOTS_ENABLE 0x3F
#define SGHSC_SLOT_ENABLE 0x01
#define SGHSC_ALL_SLOTS_DISABLE 0x02
#define SGHSC_SLOT_DISABLE 0x03
#define SGHSC_ALL_LEDS_ENABLE 0x3F3F
#define SGHSC_LED_ENABLE 0x04
#define SGHSC_ALL_LEDS_DISABLE 0x05
#define SGHSC_LED_DISABLE 0x06
#define SGHSC_LED_BLINKING 0x07
#define SGHSC_SLOT_ISOLATE 0x08
#define SGHSC_SLOT_POWER 0x09
#define SGHSC_LED_ENABLE_MASK 0x0000FFFF
#define SGHSC_SAFARI_ID_EVEN 0x3fe
/* Individual events definitions */
#define SGHSC_EVENT_CARD_INSERT 0x1
#define SGHSC_EVENT_CARD_REMOVE 0x2
#define SGHSC_EVENT_LEVER_ACTION 0x3
#define SGHSC_EVENT_HEALTHY_LOST 0x4
#define SGHSC_EVENT_POWER_ON 0x5
#define SGHSC_EVENT_POWER_OFF 0x6
/* Slot flags */
#define SGHSC_SLOT_AUTO_CFG_EN 0x1
#define SGHSC_SLOT_HEALTHY_LOST 0x2
/* LED definitions */
#define SGHSC_POWER_LED 0x10
#define SGHSC_FAULT_LED 0x20
#define SGHSC_ACTIVE_LED 0x40
#define SGHSC_ATTN_LED 0x80
/* Ring buffer size, has to be power of 2 */
#define SGHSC_RING_BUFFER_SZ 0x10
/*
* Per Hot Swappable Slot info
*/
typedef struct sghsc_slot {
/*
* Mutex for each slots for state change
*/
/*
* pathname of bus node
*/
char nexus_path[MAXPATHLEN];
/*
* property, status, cap for each slot
*/
/*
* PCI Bus number for each slot
*/
/*
* dynamically allocated hpc_slot_ops_t
* and register slot handle
*/
/*
* Leds for each slot are not cached
*/
/*
* slot state, flags, board type
*/
} sghsc_slot_t;
/*
* Per Serenget CompactPCI HSC instance soft state structure
*/
typedef struct sghsc {
} sghsc_t;
/*
* Slot map descriptor (slot to bus segment mapping)
*/
typedef struct sdesc {
} sdesc_t;
/*
* Mailbox related data and structures
*/
#define CPCI_GET_SLOT_STATUS 0x5000
#define CPCI_SET_SLOT_FAULT_LED 0x5001
#define CPCI_SET_SLOT_STATUS 0x5002
#define CPCI_SET_SLOT_POWER 0x5003
#define CPCI_GET_NUM_SLOTS 0x5004
#define CPCI_SET_ENUM_CLEARED 0x5005
#define CPCI_BOARD_TYPE 0x5006
/*
* Bit definition for Boat Type
*/
#define NO_BOARD_TYPE 0
#define PCI_BOARD 1
#define CPCI_BOARD 2
#define SP_CPCI_BOARD 3
#define WCI_CPCI_BOARD 4
#define WCI_SP_CPCI_BOARD 5
/*
* Shifts definition for CPCI_GET_SLOT_STATUS
*/
#define ONE_BIT 1
#define TWO_BITS 3
#define THREE_BITS 7
#define CPCI_STAT_POWER_ON_SHIFT 0
#define CPCI_STAT_LED_POWER_SHIFT 1
#define CPCI_STAT_LED_FAULT_SHIFT 2
#define CPCI_STAT_LED_HP_SHIFT 3
#define CPCI_STAT_SLOT_EMPTY_SHIFT 4
#define CPCI_STAT_HOT_SWAP_STATUS_SHIFT 5
/*
* Bit definition for CPCI_SET_SLOT_STATUS
*/
#define CPCI_SET_STATUS_SLOT_RESET 0x00001
#define CPCI_SET_STATUS_SLOT_READY 0x00000
/*
* Bit definition for CPCI_SET_SLOT_STATUS_FAULT_LED
*/
#define CPCI_SET_FAULT_LED_OFF 0x00000
#define CPCI_SET_FAULT_LED_ON 0x00001
#define CPCI_SET_FAULT_LED_KEEP 0x00002
#define CPCI_SET_FAULT_LED_TOGGLE 0x00003
/*
* Bit definition for CPCI_SET_SLOT_POWER
*/
#define CPCI_POWER_OFF 0x0
#define CPCI_POWER_ON 0x1
/*
* Mailbox timeout
*/
#define SGHSC_MBX_TIMEOUT 600
/*
* cPCI command codes (internal)
*/
typedef struct {
typedef struct {
typedef enum { SGHSC_RB_EMPTY, SGHSC_RB_FLOAT,
typedef struct sghsc_event {
int type;
int node_id;
int board;
int slot;
int info;
typedef struct sghsc_rb_head {
int put_idx;
int get_idx;
int size;
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SGHSC_H */