aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Borntraeger <borntraeger@de.ibm.com>2013-09-17 13:07:30 +0200
committerChristian Borntraeger <borntraeger@de.ibm.com>2013-09-20 13:55:30 +0200
commitc3d9f24a392979cbd6a40d102c71eab018117f3e (patch)
tree7c388959933006386e8a17ba5915c69fdf093979
parent8b8b1138df5e512dc8a89896c44b67d192dd3d7d (diff)
s390/eventfacility: allow childs to handle more than 1 event type
Currently all handlers (quiesce, console) only handle one event type. Some drivers will handle multiple (compatible) event types. Rework the code accordingly. Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Alexander Graf <agraf@suse.de>
-rw-r--r--hw/char/sclpconsole.c6
-rw-r--r--hw/s390x/event-facility.c2
-rw-r--r--hw/s390x/sclpquiesce.c6
-rw-r--r--include/hw/s390x/event-facility.h5
4 files changed, 9 insertions, 10 deletions
diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c
index 8cb0e41fa0..16d77c5e27 100644
--- a/hw/char/sclpconsole.c
+++ b/hw/char/sclpconsole.c
@@ -79,9 +79,9 @@ static void chr_read(void *opaque, const uint8_t *buf, int size)
/* functions to be called by event facility */
-static int event_type(void)
+static bool can_handle_event(uint8_t type)
{
- return SCLP_EVENT_ASCII_CONSOLE_DATA;
+ return type == SCLP_EVENT_ASCII_CONSOLE_DATA;
}
static unsigned int send_mask(void)
@@ -272,7 +272,7 @@ static void console_class_init(ObjectClass *klass, void *data)
ec->exit = console_exit;
ec->get_send_mask = send_mask;
ec->get_receive_mask = receive_mask;
- ec->event_type = event_type;
+ ec->can_handle_event = can_handle_event;
ec->read_event_data = read_event_data;
ec->write_event_data = write_event_data;
}
diff --git a/hw/s390x/event-facility.c b/hw/s390x/event-facility.c
index d2fd22776b..25951a020a 100644
--- a/hw/s390x/event-facility.c
+++ b/hw/s390x/event-facility.c
@@ -120,7 +120,7 @@ static uint16_t handle_write_event_buf(SCLPEventFacility *ef,
ec = SCLP_EVENT_GET_CLASS(event);
if (ec->write_event_data &&
- ec->event_type() == event_buf->type) {
+ ec->can_handle_event(event_buf->type)) {
rc = ec->write_event_data(event, event_buf);
break;
}
diff --git a/hw/s390x/sclpquiesce.c b/hw/s390x/sclpquiesce.c
index 616267883c..a3c4bd6272 100644
--- a/hw/s390x/sclpquiesce.c
+++ b/hw/s390x/sclpquiesce.c
@@ -22,9 +22,9 @@ typedef struct SignalQuiesce {
uint8_t unit;
} QEMU_PACKED SignalQuiesce;
-static int event_type(void)
+static bool can_handle_event(uint8_t type)
{
- return SCLP_EVENT_SIGNAL_QUIESCE;
+ return type == SCLP_EVENT_SIGNAL_QUIESCE;
}
static unsigned int send_mask(void)
@@ -121,7 +121,7 @@ static void quiesce_class_init(ObjectClass *klass, void *data)
k->get_send_mask = send_mask;
k->get_receive_mask = receive_mask;
- k->event_type = event_type;
+ k->can_handle_event = can_handle_event;
k->read_event_data = read_event_data;
k->write_event_data = NULL;
}
diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h
index ff0f625860..c0f5d196f5 100644
--- a/include/hw/s390x/event-facility.h
+++ b/include/hw/s390x/event-facility.h
@@ -87,9 +87,8 @@ typedef struct SCLPEventClass {
int (*write_event_data)(SCLPEvent *event, EventBufferHeader *evt_buf_hdr);
- /* returns the supported event type */
- int (*event_type)(void);
-
+ /* can we handle this event type? */
+ bool (*can_handle_event)(uint8_t type);
} SCLPEventClass;
#endif