* visorchipset_get_client_device_info() or
* visorchipset_get_server_device_info().
*/
-typedef struct {
+struct visorchipset_device_info {
struct list_head entry;
- u32 busNo;
- u32 devNo;
- uuid_le devInstGuid;
+ u32 bus_no;
+ u32 dev_no;
+ uuid_le dev_inst_uuid;
struct visorchipset_state state;
- struct visorchipset_channel_info chanInfo;
- u32 Reserved1; /* control_vm_id */
- u64 Reserved2;
- u32 switchNo; /* when devState.attached==1 */
- u32 internalPortNo; /* when devState.attached==1 */
- struct controlvm_message_header pendingMsgHdr; /* CONTROLVM_MESSAGE */
+ struct visorchipset_channel_info chan_info;
+ u32 reserved1; /* control_vm_id */
+ u64 reserved2;
+ u32 switch_no; /* when devState.attached==1 */
+ u32 internal_port_no; /* when devState.attached==1 */
+ struct controlvm_message_header pending_msg_hdr;/* CONTROLVM_MESSAGE */
/** For private use by the bus driver */
void *bus_driver_context;
-} VISORCHIPSET_DEVICE_INFO;
+};
-static inline VISORCHIPSET_DEVICE_INFO *
+static inline struct visorchipset_device_info *
finddevice(struct list_head *list, u32 busNo, u32 devNo)
{
- VISORCHIPSET_DEVICE_INFO *p;
+ struct visorchipset_device_info *p;
list_for_each_entry(p, list, entry) {
- if (p->busNo == busNo && p->devNo == devNo)
+ if (p->bus_no == busNo && p->dev_no == devNo)
return p;
}
return NULL;
static inline void delbusdevices(struct list_head *list, u32 busNo)
{
- VISORCHIPSET_DEVICE_INFO *p, *tmp;
+ struct visorchipset_device_info *p, *tmp;
list_for_each_entry_safe(p, tmp, list, entry) {
- if (p->busNo == busNo) {
+ if (p->bus_no == busNo) {
list_del(&p->entry);
kfree(p);
}
BOOL visorchipset_get_bus_info(ulong busNo, VISORCHIPSET_BUS_INFO *busInfo);
BOOL visorchipset_get_device_info(ulong busNo, ulong devNo,
- VISORCHIPSET_DEVICE_INFO *devInfo);
+ struct visorchipset_device_info *devInfo);
BOOL visorchipset_get_switch_info(ulong switchNo,
VISORCHIPSET_SWITCH_INFO *switchInfo);
BOOL visorchipset_get_externalport_info(ulong switchNo, ulong externalPortNo,
static void
devInfo_clear(void *v)
{
- VISORCHIPSET_DEVICE_INFO *p = (VISORCHIPSET_DEVICE_INFO *) (v);
+ struct visorchipset_device_info *p =
+ (struct visorchipset_device_info *)(v);
p->state.created = 0;
- memset(p, 0, sizeof(VISORCHIPSET_DEVICE_INFO));
+ memset(p, 0, sizeof(struct visorchipset_device_info));
}
static u8
cleanup_controlvm_structures(void)
{
VISORCHIPSET_BUS_INFO *bi, *tmp_bi;
- VISORCHIPSET_DEVICE_INFO *di, *tmp_di;
+ struct visorchipset_device_info *di, *tmp_di;
list_for_each_entry_safe(bi, tmp_bi, &BusInfoList, entry) {
busInfo_clear(bi);
ulong busNo, ulong devNo, int response,
struct spar_segment_state responseState)
{
- VISORCHIPSET_DEVICE_INFO *p = NULL;
+ struct visorchipset_device_info *p = NULL;
struct controlvm_message outmsg;
p = finddevice(&DevInfoList, busNo, devNo);
LOGERR("internal error; busNo=%lu, devNo=%lu", busNo, devNo);
return;
}
- if (p->pendingMsgHdr.id == CONTROLVM_INVALID) {
+ if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
LOGERR("device_responder no pending msg");
return; /* no controlvm response needed */
}
- if (p->pendingMsgHdr.id != cmdId) {
- LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id);
+ if (p->pending_msg_hdr.id != cmdId) {
+ LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
return;
}
- controlvm_init_response(&outmsg, &p->pendingMsgHdr, response);
+ controlvm_init_response(&outmsg, &p->pending_msg_hdr, response);
outmsg.cmd.device_change_state.bus_no = busNo;
outmsg.cmd.device_change_state.dev_no = devNo;
return;
}
- p->pendingMsgHdr.id = CONTROLVM_INVALID;
+ p->pending_msg_hdr.id = CONTROLVM_INVALID;
}
static void
device_responder(enum controlvm_id cmdId, ulong busNo, ulong devNo,
int response)
{
- VISORCHIPSET_DEVICE_INFO *p = NULL;
+ struct visorchipset_device_info *p = NULL;
BOOL need_clear = FALSE;
p = finddevice(&DevInfoList, busNo, devNo);
need_clear = TRUE;
}
- if (p->pendingMsgHdr.id == CONTROLVM_INVALID) {
+ if (p->pending_msg_hdr.id == CONTROLVM_INVALID) {
LOGERR("device_responder no pending msg");
return; /* no controlvm response needed */
}
- if (p->pendingMsgHdr.id != (u32) cmdId) {
- LOGERR("expected=%d, found=%d", cmdId, p->pendingMsgHdr.id);
+ if (p->pending_msg_hdr.id != (u32) cmdId) {
+ LOGERR("expected=%d, found=%d", cmdId, p->pending_msg_hdr.id);
return;
}
- controlvm_respond(&p->pendingMsgHdr, response);
- p->pendingMsgHdr.id = CONTROLVM_INVALID;
+ controlvm_respond(&p->pending_msg_hdr, response);
+ p->pending_msg_hdr.id = CONTROLVM_INVALID;
if (need_clear)
devInfo_clear(p);
}
VISORCHIPSET_BUSDEV_NOTIFIERS *notifiers = NULL;
BOOL notified = FALSE;
- VISORCHIPSET_DEVICE_INFO *pDevInfo =
+ struct visorchipset_device_info *pDevInfo =
finddevice(&DevInfoList, busNo, devNo);
char *envp[] = {
"SPARSP_DIAGPOOL_PAUSED_STATE = 1",
else
notifiers = &BusDev_Client_Notifiers;
if (needResponse) {
- memcpy(&pDevInfo->pendingMsgHdr, msgHdr,
+ memcpy(&pDevInfo->pending_msg_hdr, msgHdr,
sizeof(struct controlvm_message_header));
} else
- pDevInfo->pendingMsgHdr.id = CONTROLVM_INVALID;
+ pDevInfo->pending_msg_hdr.id = CONTROLVM_INVALID;
down(&NotifierLock);
if (response >= 0) {
struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->create_device.bus_no;
ulong devNo = cmd->create_device.dev_no;
- VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL;
+ struct visorchipset_device_info *pDevInfo = NULL;
VISORCHIPSET_BUS_INFO *pBusInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS;
rc = -CONTROLVM_RESP_ERROR_BUS_INVALID;
goto Away;
}
- pDevInfo = kzalloc(sizeof(VISORCHIPSET_DEVICE_INFO), GFP_KERNEL);
+ pDevInfo = kzalloc(sizeof(struct visorchipset_device_info), GFP_KERNEL);
if (pDevInfo == NULL) {
LOGERR("CONTROLVM_DEVICE_CREATE Failed: busNo=%lu, devNo=%lu kmaloc failed",
busNo, devNo);
}
INIT_LIST_HEAD(&pDevInfo->entry);
- pDevInfo->busNo = busNo;
- pDevInfo->devNo = devNo;
- pDevInfo->devInstGuid = cmd->create_device.dev_inst_uuid;
+ pDevInfo->bus_no = busNo;
+ pDevInfo->dev_no = devNo;
+ pDevInfo->dev_inst_uuid = cmd->create_device.dev_inst_uuid;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, devNo, busNo,
POSTCODE_SEVERITY_INFO);
if (inmsg->hdr.flags.test_message == 1)
- pDevInfo->chanInfo.addr_type = ADDRTYPE_LOCALTEST;
+ pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALTEST;
else
- pDevInfo->chanInfo.addr_type = ADDRTYPE_LOCALPHYSICAL;
- pDevInfo->chanInfo.channel_addr = cmd->create_device.channel_addr;
- pDevInfo->chanInfo.n_channel_bytes = cmd->create_device.channel_bytes;
- pDevInfo->chanInfo.channel_type_uuid =
+ pDevInfo->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL;
+ pDevInfo->chan_info.channel_addr = cmd->create_device.channel_addr;
+ pDevInfo->chan_info.n_channel_bytes = cmd->create_device.channel_bytes;
+ pDevInfo->chan_info.channel_type_uuid =
cmd->create_device.data_type_uuid;
- pDevInfo->chanInfo.intr = cmd->create_device.intr;
+ pDevInfo->chan_info.intr = cmd->create_device.intr;
list_add(&pDevInfo->entry, &DevInfoList);
POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, devNo, busNo,
POSTCODE_SEVERITY_INFO);
Away:
/* get the bus and devNo for DiagPool channel */
- if (is_diagpool_channel(pDevInfo->chanInfo.channel_type_uuid)) {
+ if (is_diagpool_channel(pDevInfo->chan_info.channel_type_uuid)) {
g_diagpoolBusNo = busNo;
g_diagpoolDevNo = devNo;
LOGINF("CONTROLVM_DEVICE_CREATE for DiagPool channel: busNo=%lu, devNo=%lu",
device_epilog(busNo, devNo, segment_state_running,
CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1,
- FOR_VISORBUS(pDevInfo->chanInfo.channel_type_uuid));
+ FOR_VISORBUS(pDevInfo->chan_info.channel_type_uuid));
}
static void
ulong busNo = cmd->device_change_state.bus_no;
ulong devNo = cmd->device_change_state.dev_no;
struct spar_segment_state state = cmd->device_change_state.state;
- VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL;
+ struct visorchipset_device_info *pDevInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS;
pDevInfo = finddevice(&DevInfoList, busNo, devNo);
&inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1,
FOR_VISORBUS(
- pDevInfo->chanInfo.channel_type_uuid));
+ pDevInfo->chan_info.channel_type_uuid));
}
static void
struct controlvm_message_packet *cmd = &inmsg->cmd;
ulong busNo = cmd->destroy_device.bus_no;
ulong devNo = cmd->destroy_device.dev_no;
- VISORCHIPSET_DEVICE_INFO *pDevInfo = NULL;
+ struct visorchipset_device_info *pDevInfo = NULL;
int rc = CONTROLVM_RESP_SUCCESS;
pDevInfo = finddevice(&DevInfoList, busNo, devNo);
CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1,
FOR_VISORBUS(
- pDevInfo->chanInfo.channel_type_uuid));
+ pDevInfo->chan_info.channel_type_uuid));
}
/* When provided with the physical address of the controlvm channel
BOOL
visorchipset_get_device_info(ulong busNo, ulong devNo,
- VISORCHIPSET_DEVICE_INFO *devInfo)
+ struct visorchipset_device_info *devInfo)
{
void *p = finddevice(&DevInfoList, busNo, devNo);
LOGERR("(%lu,%lu) failed", busNo, devNo);
return FALSE;
}
- memcpy(devInfo, p, sizeof(VISORCHIPSET_DEVICE_INFO));
+ memcpy(devInfo, p, sizeof(struct visorchipset_device_info));
return TRUE;
}
EXPORT_SYMBOL_GPL(visorchipset_get_device_info);
BOOL
visorchipset_set_device_context(ulong busNo, ulong devNo, void *context)
{
- VISORCHIPSET_DEVICE_INFO *p = finddevice(&DevInfoList, busNo, devNo);
+ struct visorchipset_device_info *p =
+ finddevice(&DevInfoList, busNo, devNo);
if (!p) {
LOGERR("(%lu,%lu) failed", busNo, devNo);