/*
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 2010, Intel Corporation.
* All rights reserved.
*/
#ifndef _SYS_DR_H
#define _SYS_DR_H
#include <sys/processor.h>
#include <sys/mem_config.h>
#include <sys/sbd_ioctl.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* helper macros for constructing and reporting internal error messages.
* NOTE: each module which uses one or more this these macros is expected
* to supply a char *dr_ie_fmt string containing the SCCS filename
* expansion macro (percent M percent) and a sprintf %d to render the
* line number argument.
*/
/*
* Macros for keeping an error code and an associated list of integers.
*/
/* Number of device node types. */
/* used to map sbd_comp_type_t to array index */
#define DEVSET_NIX(t) \
(((t) == SBD_COMP_CPU) ? 0 : \
((t) == SBD_COMP_MEM) ? 1 : \
((t) == SBD_COMP_IO) ? 2 : \
((t) == SBD_COMP_CMP) ? 0 : DR_MAXNUM_NT)
/*
* Format of dr_devset_t bit masks:
*
* 64 56 48 40 32 24 16 8 0
* |....|IIII|IIII|IIII|IIII|MMMM|MMMM|CCCC|CCCC|CCCC|CCCC|CCCC|CCCC|CCCC|CCCC|
*
* I = I/O, M = Memory, C = CPU.
*/
#define DEVSET_CPU_OFFSET 0
#define DEVSET_BIX(t) \
(((t) == SBD_COMP_CPU) ? DEVSET_CPU_OFFSET : \
((t) == SBD_COMP_MEM) ? DEVSET_MEM_OFFSET : \
((t) == SBD_COMP_IO) ? DEVSET_IO_OFFSET : \
((t) == SBD_COMP_CMP) ? DEVSET_CPU_OFFSET : 0)
#if (DEVSET_MAX_BITS <= 64)
#define DEVSET_NMASK(t) \
(((t) == SBD_COMP_CPU) ? DEVSET_CPU_NMASK : \
((t) == SBD_COMP_MEM) ? DEVSET_MEM_NMASK : \
((t) == SBD_COMP_IO) ? DEVSET_IO_NMASK : \
((t) == SBD_COMP_CMP) ? DEVSET_CPU_NMASK : 0)
#define DEVSET_MASK \
((DEVSET_CPU_NMASK << DEVSET_CPU_OFFSET) | \
(DEVSET_MEM_NMASK << DEVSET_MEM_OFFSET) | \
#define DEVSET(t, u) \
(((u) == DEVSET_ANYUNIT) ? \
((DEVSET_NMASK(t) << DEVSET_NT2DEVPOS((t), 0)) & \
DEVSET_MASK) : \
((t) == SBD_COMP_CMP) ? \
(DEVSET_CMP_NMASK << DEVSET_NT2DEVPOS((t), (u))) : \
(DEVSET_ONEUNIT << DEVSET_NT2DEVPOS((t), (u))))
#else /* DEVSET_MAX_BITS <= 64 */
#endif /* DEVSET_MAX_BITS <= 64 */
/*
* Ops for dr_board_t.b_dev_*
*/
(cp)->sbdev_type, \
(cp)->sbdev_unum)
(cp)->sbdev_type, \
(cp)->sbdev_unum)
(cp)->sbdev_type, \
(cp)->sbdev_unum)
/*
* Ops for dr_board_t.b_dev_present
*/
/*
* Ops for dr_board_t.b_dev_attached
*/
/*
* Ops for dr_board_t.b_dev_released
*/
/*
* Ops for dr_board_t.b_dev_unreferenced
*/
((bp)->b_dev_present)
((bp)->b_dev_attached)
((bp)->b_dev_released)
((bp)->b_dev_unreferenced)
/*
* CMP Specific Helpers
*/
/*
* For CPU and CMP devices, DR_UNUM2SBD_UNUM is used to extract the physical
*/
#define DR_UNUM2SBD_UNUM(n, d) \
((d) == SBD_COMP_CPU ? ((n) / MAX_CORES_PER_CMP) : \
(d) == SBD_COMP_CMP ? ((n) / MAX_CORES_PER_CMP) : (n))
/*
* Some stuff to assist in debug.
*/
#ifdef DEBUG
#else /* DEBUG */
#endif /* DEBUG */
/*
* dr_board_t b_sflags.
*/
typedef const char *fn_t;
/*
* Unsafe devices based on dr.conf prop "unsupported-io-drivers"
*/
typedef struct {
char **devnames;
/*
* Device states.
* PARTIAL state is really only relevant for board state.
*/
typedef enum {
DR_STATE_EMPTY = 0,
} dr_state_t;
typedef struct dr_handle {
} dr_handle_t;
typedef struct dr_common_unit {
int sbdev_busy;
int sbdev_unum;
typedef struct dr_mem_unit {
/*
* The following fields are used during
* the memory detach process only. sbm_mlist
* will be used to store the board memlist
* following a detach. The memlist will be
* used to re-attach the board when configuring
* the unit directly after an unconfigure.
*/
/*
* Currently only maintain state information for individual
* components.
*/
typedef struct dr_cpu_unit {
int sbc_speed;
int sbc_ecache;
int sbc_cpu_impl;
typedef struct dr_io_unit {
} dr_io_unit_t;
typedef union {
typedef struct dr_board {
int b_busy;
int b_assigned;
} dr_board_t;
/*
* dr_quiesce.c interfaces
*/
struct dr_sr_handle;
int len, int *refcount_non_gldv3);
/*
* dr_cpu.c interface
*/
/*
* dr_mem.c interface
*/
/*
* dr_io.c interface
*/
/*
* dr.c interface
*/
extern char *dr_nt_to_dev_type(int type);
#ifdef __cplusplus
}
#endif
#endif /* _SYS_DR_H */