4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * CDDL HEADER START
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * The contents of this file are subject to the terms of the
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Common Development and Distribution License (the "License").
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * You may not use this file except in compliance with the License.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * See the License for the specific language governing permissions
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * and limitations under the License.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * When distributing Covered Code, include this CDDL HEADER in each
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * If applicable, add the following below this CDDL HEADER, with the
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * fields enclosed by brackets "[]" replaced with your own identifying
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * information: Portions Copyright [yyyy] [name of copyright owner]
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * CDDL HEADER END
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Use is subject to license terms.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Definitions which deal with things other than registers.
4df55fde49134f9735f84011f23a767c75e393c7Janie Luextern "C" {
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#define NAMEINST(dip) ddi_driver_name(dip), ddi_get_instance(dip)
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu/* Used for data structure retrieval during kstat update. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu/* State structure. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu iospc_ksinfo_t *iospc_ksinfo_p[IOSPC_MAX_NUM_GRPS];
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Description of a counter's events. Each counter will have an array of these,
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * to define the events it can be programmed to report. Nonprogrammable
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * counters still need an array of these, to contain the name busstat will
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * display for it, and a CLEAR_PIC entry.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#define NUM_EVTS(x) (sizeof (x) / sizeof (iospc_event_t))
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Counter description, including its access logistics and how to zero it.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu uint64_t fld_mask; /* Width of the active part of the register */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu off_t zero_regoff; /* Offset of register used to zero counter. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu uint64_t zero_value; /* Value to write to zero_regoff, to clr cntr */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#define FULL64BIT -1ULL /* Can use this for fld_mask. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#define NUM_CTRS(x) (sizeof (x) / sizeof (iospc_cntr_t))
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Description of a counter's event selection. There will be one entry for
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * each counter in the group.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu uint64_t event_mask; /* Width of the event field. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Description of a group's select register.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu iospc_regsel_fld_t *fields_p; /* select reg subfield descriptions. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#define NUM_FLDS(x) (sizeof (x) / sizeof (iospc_regsel_fld_t))
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu/* Standin symbol for when there is no register. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu * Group description.
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu char *grp_name; /* Name, shows up as busstat "module" name. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu iospc_cntr_t *counters_p; /* Counter definitions. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu int num_counters; /* Size of the counters array. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu int (*access_init)(iospc_t *iospc_p, iospc_ksinfo_t *ksinfo_p);
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu int (*access)(iospc_t *iospc_p, void *, int op, int regid,
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu int (*access_fini)(iospc_t *iospc_p, iospc_ksinfo_t *ksinfo_p);
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu kstat_t **name_kstats_pp; /* Named kstats. One for all instances. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu/* Debugging facility. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#endif /* DEBUG */
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu/* Function definitions exported among different modules. */
4df55fde49134f9735f84011f23a767c75e393c7Janie Luextern int iospc_kstat_init(void);
4df55fde49134f9735f84011f23a767c75e393c7Janie Luextern void iospc_kstat_fini(void);
4df55fde49134f9735f84011f23a767c75e393c7Janie Luextern void rfios_unbind_group(void);
4df55fde49134f9735f84011f23a767c75e393c7Janie Lu#endif /* _IOSPC_H */