static int
create_visor_device(struct visorbus_devdata *devdata,
struct visorchipset_device_info *dev_info,
- struct visorchipset_channel_info chan_info,
u64 partition_handle)
{
int rc = -1;
- struct visorchannel *visorchannel = NULL;
struct visor_device *dev = NULL;
bool gotten = false, registered1 = false, registered2 = false;
u32 chipset_bus_no = dev_info->bus_no;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no,
POSTCODE_SEVERITY_INFO);
- /* prepare chan_hdr (abstraction to read/write channel memory) */
- visorchannel = visorchannel_create(chan_info.channel_addr,
- chan_info.n_channel_bytes,
- GFP_KERNEL,
- chan_info.channel_type_uuid);
- if (!visorchannel) {
- POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
- DIAG_SEVERITY_ERR);
- goto away;
- }
dev = kmalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, chipset_dev_no,
}
memset(dev, 0, sizeof(struct visor_device));
- dev->visorchannel = visorchannel;
- dev->channel_type_guid = chan_info.channel_type_uuid;
- dev->channel_bytes = chan_info.n_channel_bytes;
+ dev->visorchannel = dev_info->visorchannel;
+ dev->channel_type_guid = dev_info->channel_type_guid;
dev->chipset_bus_no = chipset_bus_no;
dev->chipset_dev_no = chipset_dev_no;
dev->device.parent = &devdata->dev;
unregister_devmajorminor_attributes(dev);
if (gotten)
put_device(&dev->device);
- if (visorchannel)
- visorchannel_destroy(visorchannel);
kfree(dev);
} else {
total_devices_created++;
}
static struct visor_device *
-find_visor_device_by_channel(u64 channel_physaddr)
+find_visor_device_by_channel(struct visorchannel *channel)
{
struct list_head *listentry, *listtmp;
struct visor_device *dev = list_entry(listentry,
struct visor_device,
list_all);
- if (visorchannel_get_physaddr(dev->visorchannel) ==
- channel_physaddr)
+ if (dev->visorchannel == channel)
return dev;
}
return NULL;
goto away;
}
devdata->devno = id;
- if ((bus_info->chan_info.channel_addr > 0) &&
- (bus_info->chan_info.n_channel_bytes > 0)) {
- u64 channel_addr = bus_info->chan_info.channel_addr;
- unsigned long n_channel_bytes =
- (unsigned long)
- bus_info->chan_info.n_channel_bytes;
- uuid_le channel_type_guid =
- bus_info->chan_info.channel_type_uuid;
-
- devdata->chan = visorchannel_create(channel_addr,
- n_channel_bytes,
- GFP_KERNEL,
- channel_type_guid);
- if (!devdata->chan) {
- POSTCODE_LINUX_3(DEVICE_CREATE_FAILURE_PC, channel_addr,
- POSTCODE_SEVERITY_ERR);
- } else {
- if (bus_info->flags.server) {
- init_vbus_channel(devdata->chan);
- } else {
- if (get_vbus_header_info(devdata->chan,
- &devdata->
- vbus_hdr_info) >= 0) {
- devdata->vbus_valid = true;
- write_vbus_chp_info(devdata->chan,
- &devdata->
- vbus_hdr_info,
- &chipset_driverinfo
- );
- write_vbus_bus_info(devdata->chan,
- &devdata->
- vbus_hdr_info,
- &clientbus_driverinfo);
- }
- }
+ devdata->chan = bus_info->visorchannel;
+ if (bus_info->flags.server) {
+ init_vbus_channel(devdata->chan);
+ } else {
+ if (get_vbus_header_info(devdata->chan,
+ &devdata->
+ vbus_hdr_info) >= 0) {
+ devdata->vbus_valid = true;
+ write_vbus_chp_info(devdata->chan,
+ &devdata->
+ vbus_hdr_info,
+ &chipset_driverinfo
+ );
+ write_vbus_bus_info(devdata->chan,
+ &devdata->
+ vbus_hdr_info,
+ &clientbus_driverinfo);
}
}
bus_count++;
}
static bool entered_testing_mode;
-static struct visorchipset_channel_info test_channel_infos[MAXDEVICETEST];
+static struct visorchannel *test_channel_infos[MAXDEVICETEST];
static unsigned long test_bus_nos[MAXDEVICETEST];
static unsigned long test_dev_nos[MAXDEVICETEST];
if (visorbus_devicetest)
if (total_devices_created < MAXDEVICETEST) {
test_channel_infos[total_devices_created] =
- dev_info->chan_info;
+ dev_info->visorchannel;
test_bus_nos[total_devices_created] = bus_no;
test_dev_nos[total_devices_created] = dev_no;
}
return;
}
devdata = (struct visorbus_devdata *)(bus_info.bus_driver_context);
- rc = create_visor_device(devdata, dev_info,
- dev_info->chan_info,
- bus_info.partition_handle);
+ rc = create_visor_device(devdata, dev_info, bus_info.partition_handle);
POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO);
if (rc < 0)
if (entered_testing_mode)
return;
- dev = find_visor_device_by_channel(dev_info->chan_info.channel_addr);
+ dev = find_visor_device_by_channel(dev_info->visorchannel);
if (!dev)
goto away;
rc = 0;
if (!notify_func)
goto away;
- dev = find_visor_device_by_channel(dev_info->chan_info.channel_addr);
+ dev = find_visor_device_by_channel(dev_info->visorchannel);
if (!dev)
goto away;
u32 bus_no = cmd->create_bus.bus_no;
int rc = CONTROLVM_RESP_SUCCESS;
struct visorchipset_bus_info *bus_info;
+ struct visorchannel *visorchannel;
bus_info = bus_find(&bus_info_list, bus_no);
if (bus_info && (bus_info->state.created == 1)) {
POSTCODE_LINUX_3(BUS_CREATE_ENTRY_PC, bus_no, POSTCODE_SEVERITY_INFO);
- if (inmsg->hdr.flags.test_message == 1)
- bus_info->chan_info.addr_type = ADDRTYPE_LOCALTEST;
- else
- bus_info->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL;
-
bus_info->flags.server = inmsg->hdr.flags.server;
- bus_info->chan_info.channel_addr = cmd->create_bus.channel_addr;
- bus_info->chan_info.n_channel_bytes = cmd->create_bus.channel_bytes;
- bus_info->chan_info.channel_type_uuid =
- cmd->create_bus.bus_data_type_uuid;
- bus_info->chan_info.channel_inst_uuid = cmd->create_bus.bus_inst_uuid;
+ visorchannel = visorchannel_create(cmd->create_bus.channel_addr,
+ cmd->create_bus.channel_bytes,
+ GFP_KERNEL,
+ cmd->create_bus.bus_data_type_uuid);
+
+ if (!visorchannel) {
+ POSTCODE_LINUX_3(BUS_CREATE_FAILURE_PC, bus_no,
+ POSTCODE_SEVERITY_ERR);
+ rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
+ kfree(bus_info);
+ bus_info = NULL;
+ goto cleanup;
+ }
+ bus_info->visorchannel = visorchannel;
list_add(&bus_info->entry, &bus_info_list);
POSTCODE_LINUX_3(BUS_CREATE_EXIT_PC, bus_no, POSTCODE_SEVERITY_INFO);
POSTCODE_SEVERITY_ERR);
rc = -CONTROLVM_RESP_ERROR_MESSAGE_ID_INVALID_FOR_CLIENT;
} else {
- bus_info->partition_handle = cmd->configure_bus.guest_handle;
+ visorchannel_set_clientpartition(bus_info->visorchannel,
+ cmd->configure_bus.guest_handle);
bus_info->partition_uuid = parser_id_get(parser_ctx);
parser_param_start(parser_ctx, PARSERSTRING_NAME);
bus_info->name = parser_string_get(parser_ctx);
u32 dev_no = cmd->create_device.dev_no;
struct visorchipset_device_info *dev_info;
struct visorchipset_bus_info *bus_info;
+ struct visorchannel *visorchannel;
int rc = CONTROLVM_RESP_SUCCESS;
dev_info = device_find(&dev_info_list, bus_no, dev_no);
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO);
- if (inmsg->hdr.flags.test_message == 1)
- dev_info->chan_info.addr_type = ADDRTYPE_LOCALTEST;
- else
- dev_info->chan_info.addr_type = ADDRTYPE_LOCALPHYSICAL;
- dev_info->chan_info.channel_addr = cmd->create_device.channel_addr;
- dev_info->chan_info.n_channel_bytes = cmd->create_device.channel_bytes;
- dev_info->chan_info.channel_type_uuid =
- cmd->create_device.data_type_uuid;
+ visorchannel = visorchannel_create(cmd->create_device.channel_addr,
+ cmd->create_device.channel_bytes,
+ GFP_KERNEL,
+ cmd->create_device.data_type_uuid);
+
+ if (!visorchannel) {
+ POSTCODE_LINUX_4(DEVICE_CREATE_FAILURE_PC, dev_no, bus_no,
+ POSTCODE_SEVERITY_ERR);
+ rc = -CONTROLVM_RESP_ERROR_KMALLOC_FAILED;
+ kfree(dev_info);
+ dev_info = NULL;
+ goto cleanup;
+ }
+ dev_info->visorchannel = visorchannel;
+ dev_info->channel_type_guid = cmd->create_device.data_type_uuid;
list_add(&dev_info->entry, &dev_info_list);
POSTCODE_LINUX_4(DEVICE_CREATE_EXIT_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO);
cleanup:
/* get the bus and devNo for DiagPool channel */
if (dev_info &&
- is_diagpool_channel(dev_info->chan_info.channel_type_uuid)) {
+ is_diagpool_channel(cmd->create_device.data_type_uuid)) {
g_diagpool_bus_no = bus_no;
g_diagpool_dev_no = dev_no;
}