xref: /openbmc/qemu/include/hw/platform-bus.h (revision a68694cd)
1 #ifndef HW_PLATFORM_BUS_H
2 #define HW_PLATFORM_BUS_H
3 
4 /*
5  *  Platform Bus device to support dynamic Sysbus devices
6  *
7  * Copyright (C) 2014 Freescale Semiconductor, Inc. All rights reserved.
8  *
9  * Author: Alexander Graf, <agraf@suse.de>
10  *
11  * This library is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU Lesser General Public
13  * License as published by the Free Software Foundation; either
14  * version 2 of the License, or (at your option) any later version.
15  *
16  * This library is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19  * Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public
22  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
23  */
24 
25 #include "hw/sysbus.h"
26 #include "qom/object.h"
27 
28 typedef struct PlatformBusDevice PlatformBusDevice;
29 
30 #define TYPE_PLATFORM_BUS_DEVICE "platform-bus-device"
31 DECLARE_INSTANCE_CHECKER(PlatformBusDevice, PLATFORM_BUS_DEVICE,
32                          TYPE_PLATFORM_BUS_DEVICE)
33 
34 struct PlatformBusDevice {
35     /*< private >*/
36     SysBusDevice parent_obj;
37 
38     /*< public >*/
39     uint32_t mmio_size;
40     MemoryRegion mmio;
41 
42     uint32_t num_irqs;
43     qemu_irq *irqs;
44     unsigned long *used_irqs;
45 };
46 
47 int platform_bus_get_irqn(PlatformBusDevice *platform_bus, SysBusDevice *sbdev,
48                           int n);
49 hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev,
50                                   int n);
51 
52 void platform_bus_link_device(PlatformBusDevice *pbus, SysBusDevice *sbdev);
53 
54 #endif /* HW_PLATFORM_BUS_H */
55