s390/sclp: move sclp_service_interrupt into the sclp device
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Wed, 13 May 2015 13:06:44 +0000 (15:06 +0200)
committerCornelia Huck <cornelia.huck@de.ibm.com>
Mon, 7 Sep 2015 14:10:43 +0000 (16:10 +0200)
Let's make that function a method of the new sclp device, keeping
the wrapper for existing users.

We can now let go of get_event_facility().

Reviewed-by: Matthew Rosato <mjrosato@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
hw/s390x/sclp.c
include/hw/s390x/sclp.h

index c367ff8..87f4902 100644 (file)
 #include "hw/s390x/event-facility.h"
 #include "hw/s390x/s390-pci-bus.h"
 
-static inline SCLPEventFacility *get_event_facility(void)
-{
-    return EVENT_FACILITY(object_resolve_path_type("", TYPE_SCLP_EVENT_FACILITY,
-                                                   NULL));
-}
-
 static inline SCLPDevice *get_sclp_device(void)
 {
     return SCLP(object_resolve_path_type("", TYPE_SCLP, NULL));
@@ -417,15 +411,15 @@ int sclp_service_call(CPUS390XState *env, uint64_t sccb, uint32_t code)
     cpu_physical_memory_write(sccb, &work_sccb,
                               be16_to_cpu(work_sccb.h.length));
 
-    sclp_service_interrupt(sccb);
+    sclp_c->service_interrupt(sclp, sccb);
 
 out:
     return r;
 }
 
-void sclp_service_interrupt(uint32_t sccb)
+static void service_interrupt(SCLPDevice *sclp, uint32_t sccb)
 {
-    SCLPEventFacility *ef = get_event_facility();
+    SCLPEventFacility *ef = sclp->event_facility;
     SCLPEventFacilityClass *efc = EVENT_FACILITY_GET_CLASS(ef);
 
     uint32_t param = sccb & ~3;
@@ -440,6 +434,14 @@ void sclp_service_interrupt(uint32_t sccb)
     s390_sclp_extint(param);
 }
 
+void sclp_service_interrupt(uint32_t sccb)
+{
+    SCLPDevice *sclp = get_sclp_device();
+    SCLPDeviceClass *sclp_c = SCLP_GET_CLASS(sclp);
+
+    sclp_c->service_interrupt(sclp, sccb);
+}
+
 /* qemu object creation and initialization functions */
 
 void s390_sclp_init(void)
@@ -499,6 +501,7 @@ static void sclp_class_init(ObjectClass *oc, void *data)
     sc->unassign_storage = unassign_storage;
     sc->read_cpu_info = sclp_read_cpu_info;
     sc->execute = sclp_execute;
+    sc->service_interrupt = service_interrupt;
 }
 
 static TypeInfo sclp_info = {
index 60db98c..50094eb 100644 (file)
@@ -192,6 +192,7 @@ typedef struct SCLPDeviceClass {
 
     /* public */
     void (*execute)(SCLPDevice *sclp, SCCB *sccb, uint32_t code);
+    void (*service_interrupt)(SCLPDevice *sclp, uint32_t sccb);
 } SCLPDeviceClass;
 
 typedef struct sclpMemoryHotplugDev sclpMemoryHotplugDev;