2012-02-12 12:12:21 +00:00
|
|
|
#ifndef SHPC_H
|
|
|
|
#define SHPC_H
|
|
|
|
|
|
|
|
#include "qemu-common.h"
|
2012-12-17 17:19:49 +00:00
|
|
|
#include "exec/memory.h"
|
2012-12-17 17:19:50 +00:00
|
|
|
#include "migration/vmstate.h"
|
2014-02-05 15:36:50 +00:00
|
|
|
#include "qapi/error.h"
|
|
|
|
#include "hw/hotplug.h"
|
2012-02-12 12:12:21 +00:00
|
|
|
|
|
|
|
struct SHPCDevice {
|
|
|
|
/* Capability offset in device's config space */
|
|
|
|
int cap;
|
|
|
|
|
|
|
|
/* # of hot-pluggable slots */
|
|
|
|
int nslots;
|
|
|
|
|
|
|
|
/* SHPC WRS: working register set */
|
|
|
|
uint8_t *config;
|
|
|
|
|
|
|
|
/* Used to enable checks on load. Note that writable bits are
|
|
|
|
* never checked even if set in cmask. */
|
|
|
|
uint8_t *cmask;
|
|
|
|
|
|
|
|
/* Used to implement R/W bytes */
|
|
|
|
uint8_t *wmask;
|
|
|
|
|
|
|
|
/* Used to implement RW1C(Write 1 to Clear) bytes */
|
|
|
|
uint8_t *w1cmask;
|
|
|
|
|
|
|
|
/* MMIO for the SHPC BAR */
|
|
|
|
MemoryRegion mmio;
|
|
|
|
|
|
|
|
/* Bus controlled by this SHPC */
|
|
|
|
PCIBus *sec_bus;
|
|
|
|
|
|
|
|
/* MSI already requested for this event */
|
|
|
|
int msi_requested;
|
|
|
|
};
|
|
|
|
|
|
|
|
void shpc_reset(PCIDevice *d);
|
|
|
|
int shpc_bar_size(PCIDevice *dev);
|
|
|
|
int shpc_init(PCIDevice *dev, PCIBus *sec_bus, MemoryRegion *bar, unsigned off);
|
|
|
|
void shpc_cleanup(PCIDevice *dev, MemoryRegion *bar);
|
|
|
|
void shpc_cap_write_config(PCIDevice *d, uint32_t addr, uint32_t val, int len);
|
|
|
|
|
2014-02-05 15:36:50 +00:00
|
|
|
|
|
|
|
void shpc_device_hotplug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
|
|
|
|
Error **errp);
|
2014-09-26 09:28:19 +00:00
|
|
|
void shpc_device_hot_unplug_request_cb(HotplugHandler *hotplug_dev,
|
|
|
|
DeviceState *dev, Error **errp);
|
2014-02-05 15:36:50 +00:00
|
|
|
|
2012-02-12 12:12:21 +00:00
|
|
|
extern VMStateInfo shpc_vmstate_info;
|
|
|
|
#define SHPC_VMSTATE(_field, _type) \
|
|
|
|
VMSTATE_BUFFER_UNSAFE_INFO(_field, _type, 0, shpc_vmstate_info, 0)
|
|
|
|
|
|
|
|
#endif
|