net: cadence_gem: Make phy respond to broadcast
[qemu.git] / include / hw / hotplug.h
bloba6533cb0b1b7910f010f3c589ce19cf374cbdd01
1 /*
2 * Hotplug handler interface.
4 * Copyright (c) 2014 Red Hat Inc.
6 * Authors:
7 * Igor Mammedov <imammedo@redhat.com>,
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
12 #ifndef HOTPLUG_H
13 #define HOTPLUG_H
15 #include "qom/object.h"
16 #include "qemu/typedefs.h"
18 #define TYPE_HOTPLUG_HANDLER "hotplug-handler"
20 #define HOTPLUG_HANDLER_CLASS(klass) \
21 OBJECT_CLASS_CHECK(HotplugHandlerClass, (klass), TYPE_HOTPLUG_HANDLER)
22 #define HOTPLUG_HANDLER_GET_CLASS(obj) \
23 OBJECT_GET_CLASS(HotplugHandlerClass, (obj), TYPE_HOTPLUG_HANDLER)
24 #define HOTPLUG_HANDLER(obj) \
25 INTERFACE_CHECK(HotplugHandler, (obj), TYPE_HOTPLUG_HANDLER)
28 typedef struct HotplugHandler {
29 /* <private> */
30 Object Parent;
31 } HotplugHandler;
33 /**
34 * hotplug_fn:
35 * @plug_handler: a device performing plug/uplug action
36 * @plugged_dev: a device that has been (un)plugged
37 * @errp: returns an error if this function fails
39 typedef void (*hotplug_fn)(HotplugHandler *plug_handler,
40 DeviceState *plugged_dev, Error **errp);
42 /**
43 * HotplugDeviceClass:
45 * Interface to be implemented by a device performing
46 * hardware (un)plug functions.
48 * @parent: Opaque parent interface.
49 * @plug: plug callback.
50 * @unplug: unplug callback.
52 typedef struct HotplugHandlerClass {
53 /* <private> */
54 InterfaceClass parent;
56 /* <public> */
57 hotplug_fn plug;
58 hotplug_fn unplug;
59 } HotplugHandlerClass;
61 /**
62 * hotplug_handler_plug:
64 * Call #HotplugHandlerClass.plug callback of @plug_handler.
66 void hotplug_handler_plug(HotplugHandler *plug_handler,
67 DeviceState *plugged_dev,
68 Error **errp);
70 /**
71 * hotplug_handler_unplug:
73 * Call #HotplugHandlerClass.unplug callback of @plug_handler.
75 void hotplug_handler_unplug(HotplugHandler *plug_handler,
76 DeviceState *plugged_dev,
77 Error **errp);
78 #endif