Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/bhnd/siba/sibavar.h
Show All 33 Lines | |||||
*/ | */ | ||||
#ifndef _SIBA_SIBAVAR_H_ | #ifndef _SIBA_SIBAVAR_H_ | ||||
#define _SIBA_SIBAVAR_H_ | #define _SIBA_SIBAVAR_H_ | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/bus.h> | #include <sys/bus.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/lock.h> | |||||
#include <sys/mutex.h> | |||||
#include <machine/bus.h> | #include <machine/bus.h> | ||||
#include <sys/rman.h> | #include <sys/rman.h> | ||||
#include "siba.h" | #include "siba.h" | ||||
/* | /* | ||||
* Internal definitions shared by siba(4) driver implementations. | * Internal definitions shared by siba(4) driver implementations. | ||||
*/ | */ | ||||
struct siba_addrspace; | struct siba_addrspace; | ||||
struct siba_cfg_block; | struct siba_cfg_block; | ||||
struct siba_devinfo; | struct siba_devinfo; | ||||
struct siba_core_id; | struct siba_core_id; | ||||
struct siba_softc; | |||||
int siba_probe(device_t dev); | int siba_probe(device_t dev); | ||||
int siba_attach(device_t dev); | int siba_attach(device_t dev); | ||||
int siba_detach(device_t dev); | int siba_detach(device_t dev); | ||||
int siba_resume(device_t dev); | int siba_resume(device_t dev); | ||||
int siba_suspend(device_t dev); | int siba_suspend(device_t dev); | ||||
u_int siba_get_intr_count(device_t dev, device_t child); | u_int siba_get_intr_count(device_t dev, device_t child); | ||||
int siba_get_intr_ivec(device_t dev, device_t child, | int siba_get_intr_ivec(device_t dev, device_t child, | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | struct siba_core_id { | ||||
uint8_t num_addrspace; /**< number of address ranges mapped to | uint8_t num_addrspace; /**< number of address ranges mapped to | ||||
this core. */ | this core. */ | ||||
uint8_t num_cfg_blocks; /**< number of Sonics configuration register | uint8_t num_cfg_blocks; /**< number of Sonics configuration register | ||||
blocks mapped to the core's enumeration | blocks mapped to the core's enumeration | ||||
space */ | space */ | ||||
}; | }; | ||||
/** | /** | ||||
* siba(4) per-core PMU allocation state. | |||||
*/ | |||||
typedef enum { | |||||
SIBA_PMU_NONE, /**< If the core has not yet allocated PMU state */ | |||||
SIBA_PMU_BHND, /**< If standard bhnd(4) PMU support should be used */ | |||||
SIBA_PMU_PWRCTL, /**< If legacy PWRCTL PMU support should be used */ | |||||
} siba_pmu_state; | |||||
/** | |||||
* siba(4) per-device info | * siba(4) per-device info | ||||
*/ | */ | ||||
struct siba_devinfo { | struct siba_devinfo { | ||||
struct resource_list resources; /**< per-core memory regions. */ | struct resource_list resources; /**< per-core memory regions. */ | ||||
struct siba_core_id core_id; /**< core identification info */ | struct siba_core_id core_id; /**< core identification info */ | ||||
struct siba_addrspace addrspace[SIBA_MAX_ADDRSPACE]; /**< memory map descriptors */ | struct siba_addrspace addrspace[SIBA_MAX_ADDRSPACE]; /**< memory map descriptors */ | ||||
struct siba_cfg_block cfg[SIBA_MAX_CFG]; /**< config block descriptors */ | struct siba_cfg_block cfg[SIBA_MAX_CFG]; /**< config block descriptors */ | ||||
struct siba_intr intr; /**< interrupt flag descriptor, if any */ | struct siba_intr intr; /**< interrupt flag descriptor, if any */ | ||||
bool intr_en; /**< if true, core has an assigned interrupt flag */ | bool intr_en; /**< if true, core has an assigned interrupt flag */ | ||||
struct bhnd_resource *cfg_res[SIBA_MAX_CFG]; /**< bus-mapped config block registers */ | struct bhnd_resource *cfg_res[SIBA_MAX_CFG]; /**< bus-mapped config block registers */ | ||||
int cfg_rid[SIBA_MAX_CFG]; /**< bus-mapped config block resource IDs */ | int cfg_rid[SIBA_MAX_CFG]; /**< bus-mapped config block resource IDs */ | ||||
struct bhnd_core_pmu_info *pmu_info; /**< Bus-managed PMU state, or NULL */ | siba_pmu_state pmu_state; /**< per-core PMU state */ | ||||
union { | |||||
void *bhnd_info; /**< if SIBA_PMU_BHND, bhnd(4)-managed per-core PMU info. */ | |||||
device_t pwrctl; /**< if SIBA_PMU_PWRCTL, legacy PWRCTL provider. */ | |||||
} pmu; | |||||
}; | }; | ||||
/** siba(4) per-instance state */ | /** siba(4) per-instance state */ | ||||
struct siba_softc { | struct siba_softc { | ||||
struct bhnd_softc bhnd_sc; /**< bhnd state */ | struct bhnd_softc bhnd_sc; /**< bhnd state */ | ||||
device_t dev; /**< siba device */ | device_t dev; /**< siba device */ | ||||
struct mtx mtx; /**< state mutex */ | |||||
}; | }; | ||||
#define SIBA_LOCK_INIT(sc) \ | |||||
mtx_init(&(sc)->mtx, device_get_nameunit((sc)->dev), NULL, MTX_DEF) | |||||
#define SIBA_LOCK(sc) mtx_lock(&(sc)->mtx) | |||||
#define SIBA_UNLOCK(sc) mtx_unlock(&(sc)->mtx) | |||||
#define SIBA_LOCK_ASSERT(sc, what) mtx_assert(&(sc)->mtx, what) | |||||
#define SIBA_LOCK_DESTROY(sc) mtx_destroy(&(sc)->mtx) | |||||
#endif /* _SIBA_SIBAVAR_H_ */ | #endif /* _SIBA_SIBAVAR_H_ */ |