iospc.h revision 4df55fde49134f9735f84011f23a767c75e393c7
/*
* 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 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _IOSPC_H
#define _IOSPC_H
/*
* Definitions which deal with things other than registers.
*/
#ifdef __cplusplus
extern "C" {
#endif
#define SUCCESS 0
#define FAILURE -1
/* Used for data structure retrieval during kstat update. */
typedef struct iospc_ksinfo {
void *arg;
#define IOSPC_MAX_NUM_GRPS 10
/* State structure. */
typedef struct iospc {
} iospc_t;
/*
* Description of a counter's events. Each counter will have an array of these,
* to define the events it can be programmed to report. Nonprogrammable
* counters still need an array of these, to contain the name busstat will
* display for it, and a CLEAR_PIC entry.
*/
typedef struct iospc_event {
char *name;
#define NUM_EVTS(x) (sizeof (x) / sizeof (iospc_event_t))
/*
* Counter description, including its access logistics and how to zero it.
*/
typedef struct iospc_cntr {
} iospc_cntr_t;
#define NUM_CTRS(x) (sizeof (x) / sizeof (iospc_cntr_t))
/*
* Description of a counter's event selection. There will be one entry for
* each counter in the group.
*/
typedef struct iospc_regsel_fld {
int num_events; /* Size of events array. */
int event_offset; /* Offset of the event field. */
/*
* Description of a group's select register.
*/
typedef struct iospc_regsel {
int num_fields; /* Size of the fields array. */
#define NUM_FLDS(x) (sizeof (x) / sizeof (iospc_regsel_fld_t))
#define IOSPC_REG_READ 0
#define IOSPC_REG_WRITE 1
/* Standin symbol for when there is no register. */
/*
* Group description.
*/
typedef struct iospc_grp {
char *grp_name; /* Name, shows up as busstat "module" name. */
int num_counters; /* Size of the counters array. */
} iospc_grp_t;
/* Debugging facility. */
#ifdef DEBUG
extern int iospc_debug;
#else
#define IOSPC_DBG1 0 &&
#define IOSPC_DBG2 0 &&
#endif /* DEBUG */
/* Function definitions exported among different modules. */
extern int iospc_kstat_init(void);
extern void iospc_kstat_fini(void);
extern iospc_grp_t **rfios_bind_group(void);
extern void rfios_unbind_group(void);
#ifdef __cplusplus
}
#endif
#endif /* _IOSPC_H */