Commit b4b598fd authored by Don Zickus's avatar Don Zickus Committed by Greg Kroah-Hartman

staging: unisys: Convert device functions to pass dev_info pointer around

Most device functions pass bus_no and dev_no around and then do a lookup
inside each function to find the dev_info struct.  Instead just pass the
pointer.

This prepares us for a later conversion to using visor device.

No real technical changes.  Just function header changes and little
cleanups as a result.
Signed-off-by: default avatarDon Zickus <dzickus@redhat.com>
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3032aedd
...@@ -43,7 +43,7 @@ struct visor_device; ...@@ -43,7 +43,7 @@ struct visor_device;
extern struct bus_type visorbus_type; extern struct bus_type visorbus_type;
typedef void (*visorbus_state_complete_func) (struct visor_device *dev, typedef void (*visorbus_state_complete_func) (struct visor_device *dev,
int status); int status, void *dev_info);
struct visorchipset_state { struct visorchipset_state {
u32 created:1; u32 created:1;
u32 attached:1; u32 attached:1;
...@@ -106,9 +106,11 @@ struct visor_driver { ...@@ -106,9 +106,11 @@ struct visor_driver {
* fails or completes successfully. * fails or completes successfully.
*/ */
int (*pause)(struct visor_device *dev, int (*pause)(struct visor_device *dev,
visorbus_state_complete_func complete_func); visorbus_state_complete_func complete_func,
void *dev_info);
int (*resume)(struct visor_device *dev, int (*resume)(struct visor_device *dev,
visorbus_state_complete_func complete_func); visorbus_state_complete_func complete_func,
void *dev_info);
/** These fields are for private use by the bus driver only. */ /** These fields are for private use by the bus driver only. */
struct device_driver driver; struct device_driver driver;
......
...@@ -110,10 +110,10 @@ static long long total_devices_created; ...@@ -110,10 +110,10 @@ static long long total_devices_created;
static void chipset_bus_create(struct visorchipset_bus_info *bus_info); static void chipset_bus_create(struct visorchipset_bus_info *bus_info);
static void chipset_bus_destroy(struct visorchipset_bus_info *bus_info); static void chipset_bus_destroy(struct visorchipset_bus_info *bus_info);
static void chipset_device_create(u32 bus_no, u32 dev_no); static void chipset_device_create(struct visorchipset_device_info *dev_info);
static void chipset_device_destroy(u32 bus_no, u32 dev_no); static void chipset_device_destroy(struct visorchipset_device_info *dev_info);
static void chipset_device_pause(u32 bus_no, u32 dev_no); static void chipset_device_pause(struct visorchipset_device_info *dev_info);
static void chipset_device_resume(u32 bus_no, u32 dev_no); static void chipset_device_resume(struct visorchipset_device_info *dev_info);
/** These functions are implemented herein, and are called by the chipset /** These functions are implemented herein, and are called by the chipset
* driver to notify us about specific events. * driver to notify us about specific events.
...@@ -813,11 +813,17 @@ visordriver_probe_device(struct device *xdev) ...@@ -813,11 +813,17 @@ visordriver_probe_device(struct device *xdev)
* initialized. * initialized.
*/ */
if (!dev->responded_to_device_create) { if (!dev->responded_to_device_create) {
struct visorchipset_device_info dev_info;
if (!visorchipset_get_device_info(dev->chipset_bus_no,
dev->chipset_dev_no,
&dev_info))
/* hmm, what to do here */
return rc;
dev->responded_to_device_create = true; dev->responded_to_device_create = true;
if (chipset_responders.device_create) if (chipset_responders.device_create)
(*chipset_responders.device_create)(dev->chipset_bus_no, (*chipset_responders.device_create)(&dev_info, rc);
dev->chipset_dev_no,
rc);
} }
return rc; return rc;
} }
...@@ -1003,7 +1009,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts); ...@@ -1003,7 +1009,7 @@ EXPORT_SYMBOL_GPL(visorbus_disable_channel_interrupts);
*/ */
static int static int
create_visor_device(struct visorbus_devdata *devdata, create_visor_device(struct visorbus_devdata *devdata,
unsigned long chipset_bus_no, unsigned long chipset_dev_no, struct visorchipset_device_info *dev_info,
struct visorchipset_channel_info chan_info, struct visorchipset_channel_info chan_info,
u64 partition_handle) u64 partition_handle)
{ {
...@@ -1011,6 +1017,8 @@ create_visor_device(struct visorbus_devdata *devdata, ...@@ -1011,6 +1017,8 @@ create_visor_device(struct visorbus_devdata *devdata,
struct visorchannel *visorchannel = NULL; struct visorchannel *visorchannel = NULL;
struct visor_device *dev = NULL; struct visor_device *dev = NULL;
bool gotten = false, registered1 = false, registered2 = false; bool gotten = false, registered1 = false, registered2 = false;
u32 chipset_bus_no = dev_info->bus_no;
u32 chipset_dev_no = dev_info->dev_no;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no, POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, chipset_dev_no, chipset_bus_no,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
...@@ -1061,7 +1069,7 @@ create_visor_device(struct visorbus_devdata *devdata, ...@@ -1061,7 +1069,7 @@ create_visor_device(struct visorbus_devdata *devdata,
* (NOT bus instance). That's why we need to include the bus * (NOT bus instance). That's why we need to include the bus
* number within the name. * number within the name.
*/ */
dev_set_name(&dev->device, "vbus%lu:dev%lu", dev_set_name(&dev->device, "vbus%u:dev%u",
chipset_bus_no, chipset_dev_no); chipset_bus_no, chipset_dev_no);
/* device_add does this: /* device_add does this:
...@@ -1512,26 +1520,25 @@ chipset_bus_destroy(struct visorchipset_bus_info *bus_info) ...@@ -1512,26 +1520,25 @@ chipset_bus_destroy(struct visorchipset_bus_info *bus_info)
} }
static void static void
chipset_device_create(u32 bus_no, u32 dev_no) chipset_device_create(struct visorchipset_device_info *dev_info)
{ {
struct visorchipset_device_info dev_info;
struct visorchipset_bus_info bus_info; struct visorchipset_bus_info bus_info;
struct visorbus_devdata *devdata = NULL; struct visorbus_devdata *devdata = NULL;
int rc = -1; int rc = -1;
u32 bus_no = dev_info->bus_no;
u32 dev_no = dev_info->dev_no;
POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no, POSTCODE_LINUX_4(DEVICE_CREATE_ENTRY_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
if (entered_testing_mode) if (entered_testing_mode)
return; return;
if (!visorchipset_get_device_info(bus_no, dev_no, &dev_info))
goto away;
if (!visorchipset_get_bus_info(bus_no, &bus_info)) if (!visorchipset_get_bus_info(bus_no, &bus_info))
goto away; goto away;
if (visorbus_devicetest) if (visorbus_devicetest)
if (total_devices_created < MAXDEVICETEST) { if (total_devices_created < MAXDEVICETEST) {
test_channel_infos[total_devices_created] = test_channel_infos[total_devices_created] =
dev_info.chan_info; dev_info->chan_info;
test_bus_nos[total_devices_created] = bus_no; test_bus_nos[total_devices_created] = bus_no;
test_dev_nos[total_devices_created] = dev_no; test_dev_nos[total_devices_created] = dev_no;
} }
...@@ -1545,27 +1552,25 @@ chipset_device_create(u32 bus_no, u32 dev_no) ...@@ -1545,27 +1552,25 @@ chipset_device_create(u32 bus_no, u32 dev_no)
return; return;
} }
devdata = (struct visorbus_devdata *)(bus_info.bus_driver_context); devdata = (struct visorbus_devdata *)(bus_info.bus_driver_context);
rc = create_visor_device(devdata, bus_no, dev_no, rc = create_visor_device(devdata, dev_info,
dev_info.chan_info, bus_info.partition_handle); dev_info->chan_info,
bus_info.partition_handle);
POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no, POSTCODE_LINUX_4(DEVICE_CREATE_SUCCESS_PC, dev_no, bus_no,
POSTCODE_SEVERITY_INFO); POSTCODE_SEVERITY_INFO);
if (rc < 0) if (rc < 0)
if (chipset_responders.device_create) if (chipset_responders.device_create)
(*chipset_responders.device_create)(bus_no, dev_no, rc); (*chipset_responders.device_create)(dev_info, rc);
} }
static void static void
chipset_device_destroy(u32 bus_no, u32 dev_no) chipset_device_destroy(struct visorchipset_device_info *dev_info)
{ {
struct visorchipset_device_info dev_info;
struct visor_device *dev; struct visor_device *dev;
int rc = -1; int rc = -1;
if (entered_testing_mode) if (entered_testing_mode)
return; return;
if (!visorchipset_get_device_info(bus_no, dev_no, &dev_info)) dev = find_visor_device_by_channel(dev_info->chan_info.channel_addr);
goto away;
dev = find_visor_device_by_channel(dev_info.chan_info.channel_addr);
if (!dev) if (!dev)
goto away; goto away;
rc = 0; rc = 0;
...@@ -1574,7 +1579,7 @@ chipset_device_destroy(u32 bus_no, u32 dev_no) ...@@ -1574,7 +1579,7 @@ chipset_device_destroy(u32 bus_no, u32 dev_no)
return; return;
if (chipset_responders.device_destroy) if (chipset_responders.device_destroy)
(*chipset_responders.device_destroy) (bus_no, dev_no, rc); (*chipset_responders.device_destroy) (dev_info, rc);
remove_visor_device(dev); remove_visor_device(dev);
} }
...@@ -1583,8 +1588,11 @@ chipset_device_destroy(u32 bus_no, u32 dev_no) ...@@ -1583,8 +1588,11 @@ chipset_device_destroy(u32 bus_no, u32 dev_no)
* completed. * completed.
*/ */
static void static void
pause_state_change_complete(struct visor_device *dev, int status) pause_state_change_complete(struct visor_device *dev, int status,
void *info)
{ {
struct visorchipset_device_info *dev_info = info;
if (!dev->pausing) if (!dev->pausing)
return; return;
...@@ -1595,8 +1603,7 @@ pause_state_change_complete(struct visor_device *dev, int status) ...@@ -1595,8 +1603,7 @@ pause_state_change_complete(struct visor_device *dev, int status)
/* Notify the chipset driver that the pause is complete, which /* Notify the chipset driver that the pause is complete, which
* will presumably want to send some sort of response to the * will presumably want to send some sort of response to the
* initiator. */ * initiator. */
(*chipset_responders.device_pause) (dev->chipset_bus_no, (*chipset_responders.device_pause) (dev_info, status);
dev->chipset_dev_no, status);
} }
/* This is the callback function specified for a function driver, to /* This is the callback function specified for a function driver, to
...@@ -1604,8 +1611,11 @@ pause_state_change_complete(struct visor_device *dev, int status) ...@@ -1604,8 +1611,11 @@ pause_state_change_complete(struct visor_device *dev, int status)
* completed. * completed.
*/ */
static void static void
resume_state_change_complete(struct visor_device *dev, int status) resume_state_change_complete(struct visor_device *dev, int status,
void *info)
{ {
struct visorchipset_device_info *dev_info = info;
if (!dev->resuming) if (!dev->resuming)
return; return;
...@@ -1616,8 +1626,7 @@ resume_state_change_complete(struct visor_device *dev, int status) ...@@ -1616,8 +1626,7 @@ resume_state_change_complete(struct visor_device *dev, int status)
/* Notify the chipset driver that the resume is complete, /* Notify the chipset driver that the resume is complete,
* which will presumably want to send some sort of response to * which will presumably want to send some sort of response to
* the initiator. */ * the initiator. */
(*chipset_responders.device_resume) (dev->chipset_bus_no, (*chipset_responders.device_resume) (dev_info, status);
dev->chipset_dev_no, status);
} }
/* Tell the subordinate function driver for a specific device to pause /* Tell the subordinate function driver for a specific device to pause
...@@ -1625,13 +1634,14 @@ resume_state_change_complete(struct visor_device *dev, int status) ...@@ -1625,13 +1634,14 @@ resume_state_change_complete(struct visor_device *dev, int status)
* callback function. * callback function.
*/ */
static void static void
initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause) initiate_chipset_device_pause_resume(struct visorchipset_device_info *dev_info,
bool is_pause)
{ {
struct visorchipset_device_info dev_info;
struct visor_device *dev = NULL; struct visor_device *dev = NULL;
int rc = -1, x; int rc = -1, x;
struct visor_driver *drv = NULL; struct visor_driver *drv = NULL;
void (*notify_func)(u32 bus_no, u32 dev_no, int response) = NULL; void (*notify_func)(struct visorchipset_device_info *dev_info,
int response) = NULL;
if (is_pause) if (is_pause)
notify_func = chipset_responders.device_pause; notify_func = chipset_responders.device_pause;
...@@ -1640,10 +1650,7 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause) ...@@ -1640,10 +1650,7 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause)
if (!notify_func) if (!notify_func)
goto away; goto away;
if (!visorchipset_get_device_info(bus_no, dev_no, &dev_info)) dev = find_visor_device_by_channel(dev_info->chan_info.channel_addr);
goto away;
dev = find_visor_device_by_channel(dev_info.chan_info.channel_addr);
if (!dev) if (!dev)
goto away; goto away;
...@@ -1666,7 +1673,8 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause) ...@@ -1666,7 +1673,8 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause)
goto away; goto away;
dev->pausing = true; dev->pausing = true;
x = drv->pause(dev, pause_state_change_complete); x = drv->pause(dev, pause_state_change_complete,
(void *)dev_info);
} else { } else {
/* This should be done at BUS resume time, but an /* This should be done at BUS resume time, but an
* existing problem prevents us from ever getting a bus * existing problem prevents us from ever getting a bus
...@@ -1678,7 +1686,8 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause) ...@@ -1678,7 +1686,8 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause)
goto away; goto away;
dev->resuming = true; dev->resuming = true;
x = drv->resume(dev, resume_state_change_complete); x = drv->resume(dev, resume_state_change_complete,
(void *)dev_info);
} }
if (x < 0) { if (x < 0) {
if (is_pause) if (is_pause)
...@@ -1691,20 +1700,20 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause) ...@@ -1691,20 +1700,20 @@ initiate_chipset_device_pause_resume(u32 bus_no, u32 dev_no, bool is_pause)
away: away:
if (rc < 0) { if (rc < 0) {
if (notify_func) if (notify_func)
(*notify_func)(bus_no, dev_no, rc); (*notify_func)(dev_info, rc);
} }
} }
static void static void
chipset_device_pause(u32 bus_no, u32 dev_no) chipset_device_pause(struct visorchipset_device_info *dev_info)
{ {
initiate_chipset_device_pause_resume(bus_no, dev_no, true); initiate_chipset_device_pause_resume(dev_info, true);
} }
static void static void
chipset_device_resume(u32 bus_no, u32 dev_no) chipset_device_resume(struct visorchipset_device_info *dev_info)
{ {
initiate_chipset_device_pause_resume(bus_no, dev_no, false); initiate_chipset_device_pause_resume(dev_info, false);
} }
struct channel_size_info { struct channel_size_info {
......
...@@ -106,10 +106,10 @@ struct visorchipset_bus_info { ...@@ -106,10 +106,10 @@ struct visorchipset_bus_info {
struct visorchipset_busdev_notifiers { struct visorchipset_busdev_notifiers {
void (*bus_create)(struct visorchipset_bus_info *bus_info); void (*bus_create)(struct visorchipset_bus_info *bus_info);
void (*bus_destroy)(struct visorchipset_bus_info *bus_info); void (*bus_destroy)(struct visorchipset_bus_info *bus_info);
void (*device_create)(u32 bus_no, u32 dev_no); void (*device_create)(struct visorchipset_device_info *bus_info);
void (*device_destroy)(u32 bus_no, u32 dev_no); void (*device_destroy)(struct visorchipset_device_info *bus_info);
void (*device_pause)(u32 bus_no, u32 dev_no); void (*device_pause)(struct visorchipset_device_info *bus_info);
void (*device_resume)(u32 bus_no, u32 dev_no); void (*device_resume)(struct visorchipset_device_info *bus_info);
}; };
/* These functions live inside visorchipset, and will be called to indicate /* These functions live inside visorchipset, and will be called to indicate
...@@ -121,10 +121,11 @@ struct visorchipset_busdev_notifiers { ...@@ -121,10 +121,11 @@ struct visorchipset_busdev_notifiers {
struct visorchipset_busdev_responders { struct visorchipset_busdev_responders {
void (*bus_create)(struct visorchipset_bus_info *p, int response); void (*bus_create)(struct visorchipset_bus_info *p, int response);
void (*bus_destroy)(struct visorchipset_bus_info *p, int response); void (*bus_destroy)(struct visorchipset_bus_info *p, int response);
void (*device_create)(u32 bus_no, u32 dev_no, int response); void (*device_create)(struct visorchipset_device_info *p, int response);
void (*device_destroy)(u32 bus_no, u32 dev_no, int response); void (*device_destroy)(struct visorchipset_device_info *p,
void (*device_pause)(u32 bus_no, u32 dev_no, int response); int response);
void (*device_resume)(u32 bus_no, u32 dev_no, int response); void (*device_pause)(struct visorchipset_device_info *p, int response);
void (*device_resume)(struct visorchipset_device_info *p, int response);
}; };
/** Register functions (in the bus driver) to get called by visorchipset /** Register functions (in the bus driver) to get called by visorchipset
......
...@@ -230,12 +230,16 @@ static struct visorchipset_busdev_notifiers busdev_notifiers; ...@@ -230,12 +230,16 @@ static struct visorchipset_busdev_notifiers busdev_notifiers;
static void bus_create_response(struct visorchipset_bus_info *p, int response); static void bus_create_response(struct visorchipset_bus_info *p, int response);
static void bus_destroy_response(struct visorchipset_bus_info *p, int response); static void bus_destroy_response(struct visorchipset_bus_info *p, int response);
static void device_create_response(u32 bus_no, u32 dev_no, int response); static void device_create_response(struct visorchipset_device_info *p,
static void device_destroy_response(u32 bus_no, u32 dev_no, int response); int response);
static void device_resume_response(u32 bus_no, u32 dev_no, int response); static void device_destroy_response(struct visorchipset_device_info *p,
int response);
static void device_resume_response(struct visorchipset_device_info *p,
int response);
static void visorchipset_device_pause_response(u32 bus_no, u32 dev_no, static void
int response); visorchipset_device_pause_response(struct visorchipset_device_info *p,
int response);
static struct visorchipset_busdev_responders busdev_responders = { static struct visorchipset_busdev_responders busdev_responders = {
.bus_create = bus_create_response, .bus_create = bus_create_response,
...@@ -993,13 +997,13 @@ bus_responder(enum controlvm_id cmd_id, struct visorchipset_bus_info *p, ...@@ -993,13 +997,13 @@ bus_responder(enum controlvm_id cmd_id, struct visorchipset_bus_info *p,
static void static void
device_changestate_responder(enum controlvm_id cmd_id, device_changestate_responder(enum controlvm_id cmd_id,
u32 bus_no, u32 dev_no, int response, struct visorchipset_device_info *p, int response,
struct spar_segment_state response_state) struct spar_segment_state response_state)
{ {
struct visorchipset_device_info *p;
struct controlvm_message outmsg; struct controlvm_message outmsg;
u32 bus_no = p->bus_no;
u32 dev_no = p->dev_no;
p = device_find(&dev_info_list, bus_no, dev_no);
if (!p) if (!p)
return; return;
if (p->pending_msg_hdr.id == CONTROLVM_INVALID) if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
...@@ -1021,12 +1025,11 @@ device_changestate_responder(enum controlvm_id cmd_id, ...@@ -1021,12 +1025,11 @@ device_changestate_responder(enum controlvm_id cmd_id,
} }
static void static void
device_responder(enum controlvm_id cmd_id, u32 bus_no, u32 dev_no, int response) device_responder(enum controlvm_id cmd_id, struct visorchipset_device_info *p,
int response)
{ {
struct visorchipset_device_info *p;
bool need_clear = false; bool need_clear = false;
p = device_find(&dev_info_list, bus_no, dev_no);
if (!p) if (!p)
return; return;
if (response >= 0) { if (response >= 0) {
...@@ -1094,15 +1097,16 @@ bus_epilog(struct visorchipset_bus_info *bus_info, ...@@ -1094,15 +1097,16 @@ bus_epilog(struct visorchipset_bus_info *bus_info,
} }
static void static void
device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, device_epilog(struct visorchipset_device_info *dev_info,
struct spar_segment_state state, u32 cmd,
struct controlvm_message_header *msg_hdr, int response, struct controlvm_message_header *msg_hdr, int response,
bool need_response, bool for_visorbus) bool need_response, bool for_visorbus)
{ {
struct visorchipset_busdev_notifiers *notifiers; struct visorchipset_busdev_notifiers *notifiers;
bool notified = false; bool notified = false;
u32 bus_no = dev_info->bus_no;
u32 dev_no = dev_info->dev_no;
struct visorchipset_device_info *dev_info =
device_find(&dev_info_list, bus_no, dev_no);
char *envp[] = { char *envp[] = {
"SPARSP_DIAGPOOL_PAUSED_STATE = 1", "SPARSP_DIAGPOOL_PAUSED_STATE = 1",
NULL NULL
...@@ -1125,7 +1129,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, ...@@ -1125,7 +1129,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
switch (cmd) { switch (cmd) {
case CONTROLVM_DEVICE_CREATE: case CONTROLVM_DEVICE_CREATE:
if (notifiers->device_create) { if (notifiers->device_create) {
(*notifiers->device_create) (bus_no, dev_no); (*notifiers->device_create) (dev_info);
notified = true; notified = true;
} }
break; break;
...@@ -1135,8 +1139,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, ...@@ -1135,8 +1139,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
state.operating == state.operating ==
segment_state_running.operating) { segment_state_running.operating) {
if (notifiers->device_resume) { if (notifiers->device_resume) {
(*notifiers->device_resume) (bus_no, (*notifiers->device_resume) (dev_info);
dev_no);
notified = true; notified = true;
} }
} }
...@@ -1148,8 +1151,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, ...@@ -1148,8 +1151,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
* where server is lost * where server is lost
*/ */
if (notifiers->device_pause) { if (notifiers->device_pause) {
(*notifiers->device_pause) (bus_no, (*notifiers->device_pause) (dev_info);
dev_no);
notified = true; notified = true;
} }
} else if (state.alive == segment_state_paused.alive && } else if (state.alive == segment_state_paused.alive &&
...@@ -1171,7 +1173,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, ...@@ -1171,7 +1173,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
break; break;
case CONTROLVM_DEVICE_DESTROY: case CONTROLVM_DEVICE_DESTROY:
if (notifiers->device_destroy) { if (notifiers->device_destroy) {
(*notifiers->device_destroy) (bus_no, dev_no); (*notifiers->device_destroy) (dev_info);
notified = true; notified = true;
} }
break; break;
...@@ -1184,7 +1186,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd, ...@@ -1184,7 +1186,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
*/ */
; ;
else else
device_responder(cmd, bus_no, dev_no, response); device_responder(cmd, dev_info, response);
up(&notifier_lock); up(&notifier_lock);
} }
...@@ -1359,7 +1361,7 @@ my_device_create(struct controlvm_message *inmsg) ...@@ -1359,7 +1361,7 @@ my_device_create(struct controlvm_message *inmsg)
g_diagpool_bus_no = bus_no; g_diagpool_bus_no = bus_no;
g_diagpool_dev_no = dev_no; g_diagpool_dev_no = dev_no;
} }
device_epilog(bus_no, dev_no, segment_state_running, device_epilog(dev_info, segment_state_running,
CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc, CONTROLVM_DEVICE_CREATE, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, 1); inmsg->hdr.flags.response_expected == 1, 1);
} }
...@@ -1385,7 +1387,7 @@ my_device_changestate(struct controlvm_message *inmsg) ...@@ -1385,7 +1387,7 @@ my_device_changestate(struct controlvm_message *inmsg)
rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID; rc = -CONTROLVM_RESP_ERROR_DEVICE_INVALID;
} }
if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info)
device_epilog(bus_no, dev_no, state, device_epilog(dev_info, state,
CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc, CONTROLVM_DEVICE_CHANGESTATE, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, 1); inmsg->hdr.flags.response_expected == 1, 1);
} }
...@@ -1406,7 +1408,7 @@ my_device_destroy(struct controlvm_message *inmsg) ...@@ -1406,7 +1408,7 @@ my_device_destroy(struct controlvm_message *inmsg)
rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE; rc = -CONTROLVM_RESP_ERROR_ALREADY_DONE;
if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info) if ((rc >= CONTROLVM_RESP_SUCCESS) && dev_info)
device_epilog(bus_no, dev_no, segment_state_running, device_epilog(dev_info, segment_state_running,
CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc, CONTROLVM_DEVICE_DESTROY, &inmsg->hdr, rc,
inmsg->hdr.flags.response_expected == 1, 1); inmsg->hdr.flags.response_expected == 1, 1);
} }
...@@ -2121,30 +2123,31 @@ bus_destroy_response(struct visorchipset_bus_info *bus_info, int response) ...@@ -2121,30 +2123,31 @@ bus_destroy_response(struct visorchipset_bus_info *bus_info, int response)
} }
static void static void
device_create_response(u32 bus_no, u32 dev_no, int response) device_create_response(struct visorchipset_device_info *dev_info, int response)
{ {
device_responder(CONTROLVM_DEVICE_CREATE, bus_no, dev_no, response); device_responder(CONTROLVM_DEVICE_CREATE, dev_info, response);
} }
static void static void
device_destroy_response(u32 bus_no, u32 dev_no, int response) device_destroy_response(struct visorchipset_device_info *dev_info, int response)
{ {
device_responder(CONTROLVM_DEVICE_DESTROY, bus_no, dev_no, response); device_responder(CONTROLVM_DEVICE_DESTROY, dev_info, response);
} }
static void static void
visorchipset_device_pause_response(u32 bus_no, u32 dev_no, int response) visorchipset_device_pause_response(struct visorchipset_device_info *dev_info,
int response)
{ {
device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
bus_no, dev_no, response, dev_info, response,
segment_state_standby); segment_state_standby);
} }
static void static void
device_resume_response(u32 bus_no, u32 dev_no, int response) device_resume_response(struct visorchipset_device_info *dev_info, int response)
{ {
device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE, device_changestate_responder(CONTROLVM_DEVICE_CHANGESTATE,
bus_no, dev_no, response, dev_info, response,
segment_state_running); segment_state_running);
} }
...@@ -2184,12 +2187,9 @@ visorchipset_get_device_info(u32 bus_no, u32 dev_no, ...@@ -2184,12 +2187,9 @@ visorchipset_get_device_info(u32 bus_no, u32 dev_no,
EXPORT_SYMBOL_GPL(visorchipset_get_device_info); EXPORT_SYMBOL_GPL(visorchipset_get_device_info);
bool bool
visorchipset_set_device_context(u32 bus_no, u32 dev_no, void *context) visorchipset_set_device_context(struct visorchipset_device_info *p,
void *context)
{ {
struct visorchipset_device_info *p;
p = device_find(&dev_info_list, bus_no, dev_no);
if (!p) if (!p)
return false; return false;
p->bus_driver_context = context; p->bus_driver_context = context;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment