mirror of https://gitee.com/openkylin/qemu.git
fw_cfg: move QOM type defines and fw_cfg types into fw_cfg.h
By exposing FWCfgIoState and FWCfgMemState internals we allow the possibility for the internal MemoryRegion fields to be mapped by name for boards that wish to wire up the fw_cfg device themselves. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <1500025208-14827-4-git-send-email-mark.cave-ayland@ilande.co.uk> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
38f3adc34d
commit
39736e18cd
|
@ -37,14 +37,6 @@
|
||||||
|
|
||||||
#define FW_CFG_FILE_SLOTS_DFLT 0x20
|
#define FW_CFG_FILE_SLOTS_DFLT 0x20
|
||||||
|
|
||||||
#define TYPE_FW_CFG "fw_cfg"
|
|
||||||
#define TYPE_FW_CFG_IO "fw_cfg_io"
|
|
||||||
#define TYPE_FW_CFG_MEM "fw_cfg_mem"
|
|
||||||
|
|
||||||
#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
|
|
||||||
#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
|
|
||||||
#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
|
|
||||||
|
|
||||||
/* FW_CFG_VERSION bits */
|
/* FW_CFG_VERSION bits */
|
||||||
#define FW_CFG_VERSION 0x01
|
#define FW_CFG_VERSION 0x01
|
||||||
#define FW_CFG_VERSION_DMA 0x02
|
#define FW_CFG_VERSION_DMA 0x02
|
||||||
|
@ -58,51 +50,12 @@
|
||||||
|
|
||||||
#define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */
|
#define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */
|
||||||
|
|
||||||
typedef struct FWCfgEntry {
|
struct FWCfgEntry {
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
bool allow_write;
|
bool allow_write;
|
||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
void *callback_opaque;
|
void *callback_opaque;
|
||||||
FWCfgReadCallback read_callback;
|
FWCfgReadCallback read_callback;
|
||||||
} FWCfgEntry;
|
|
||||||
|
|
||||||
struct FWCfgState {
|
|
||||||
/*< private >*/
|
|
||||||
SysBusDevice parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
uint16_t file_slots;
|
|
||||||
FWCfgEntry *entries[2];
|
|
||||||
int *entry_order;
|
|
||||||
FWCfgFiles *files;
|
|
||||||
uint16_t cur_entry;
|
|
||||||
uint32_t cur_offset;
|
|
||||||
Notifier machine_ready;
|
|
||||||
|
|
||||||
int fw_cfg_order_override;
|
|
||||||
|
|
||||||
bool dma_enabled;
|
|
||||||
dma_addr_t dma_addr;
|
|
||||||
AddressSpace *dma_as;
|
|
||||||
MemoryRegion dma_iomem;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FWCfgIoState {
|
|
||||||
/*< private >*/
|
|
||||||
FWCfgState parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
MemoryRegion comb_iomem;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FWCfgMemState {
|
|
||||||
/*< private >*/
|
|
||||||
FWCfgState parent_obj;
|
|
||||||
/*< public >*/
|
|
||||||
|
|
||||||
MemoryRegion ctl_iomem, data_iomem;
|
|
||||||
uint32_t data_width;
|
|
||||||
MemoryRegionOps wide_data_ops;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define JPG_FILE 0
|
#define JPG_FILE 0
|
||||||
|
|
|
@ -1,8 +1,19 @@
|
||||||
#ifndef FW_CFG_H
|
#ifndef FW_CFG_H
|
||||||
#define FW_CFG_H
|
#define FW_CFG_H
|
||||||
|
|
||||||
|
#include "qemu/typedefs.h"
|
||||||
#include "exec/hwaddr.h"
|
#include "exec/hwaddr.h"
|
||||||
#include "hw/nvram/fw_cfg_keys.h"
|
#include "hw/nvram/fw_cfg_keys.h"
|
||||||
|
#include "hw/sysbus.h"
|
||||||
|
#include "sysemu/dma.h"
|
||||||
|
|
||||||
|
#define TYPE_FW_CFG "fw_cfg"
|
||||||
|
#define TYPE_FW_CFG_IO "fw_cfg_io"
|
||||||
|
#define TYPE_FW_CFG_MEM "fw_cfg_mem"
|
||||||
|
|
||||||
|
#define FW_CFG(obj) OBJECT_CHECK(FWCfgState, (obj), TYPE_FW_CFG)
|
||||||
|
#define FW_CFG_IO(obj) OBJECT_CHECK(FWCfgIoState, (obj), TYPE_FW_CFG_IO)
|
||||||
|
#define FW_CFG_MEM(obj) OBJECT_CHECK(FWCfgMemState, (obj), TYPE_FW_CFG_MEM)
|
||||||
|
|
||||||
typedef struct FWCfgFile {
|
typedef struct FWCfgFile {
|
||||||
uint32_t size; /* file size */
|
uint32_t size; /* file size */
|
||||||
|
@ -35,6 +46,45 @@ typedef struct FWCfgDmaAccess {
|
||||||
|
|
||||||
typedef void (*FWCfgReadCallback)(void *opaque);
|
typedef void (*FWCfgReadCallback)(void *opaque);
|
||||||
|
|
||||||
|
struct FWCfgState {
|
||||||
|
/*< private >*/
|
||||||
|
SysBusDevice parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
uint16_t file_slots;
|
||||||
|
FWCfgEntry *entries[2];
|
||||||
|
int *entry_order;
|
||||||
|
FWCfgFiles *files;
|
||||||
|
uint16_t cur_entry;
|
||||||
|
uint32_t cur_offset;
|
||||||
|
Notifier machine_ready;
|
||||||
|
|
||||||
|
int fw_cfg_order_override;
|
||||||
|
|
||||||
|
bool dma_enabled;
|
||||||
|
dma_addr_t dma_addr;
|
||||||
|
AddressSpace *dma_as;
|
||||||
|
MemoryRegion dma_iomem;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FWCfgIoState {
|
||||||
|
/*< private >*/
|
||||||
|
FWCfgState parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
MemoryRegion comb_iomem;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct FWCfgMemState {
|
||||||
|
/*< private >*/
|
||||||
|
FWCfgState parent_obj;
|
||||||
|
/*< public >*/
|
||||||
|
|
||||||
|
MemoryRegion ctl_iomem, data_iomem;
|
||||||
|
uint32_t data_width;
|
||||||
|
MemoryRegionOps wide_data_ops;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fw_cfg_add_bytes:
|
* fw_cfg_add_bytes:
|
||||||
* @s: fw_cfg device being modified
|
* @s: fw_cfg device being modified
|
||||||
|
|
|
@ -30,6 +30,7 @@ typedef struct DisplaySurface DisplaySurface;
|
||||||
typedef struct DriveInfo DriveInfo;
|
typedef struct DriveInfo DriveInfo;
|
||||||
typedef struct Error Error;
|
typedef struct Error Error;
|
||||||
typedef struct EventNotifier EventNotifier;
|
typedef struct EventNotifier EventNotifier;
|
||||||
|
typedef struct FWCfgEntry FWCfgEntry;
|
||||||
typedef struct FWCfgIoState FWCfgIoState;
|
typedef struct FWCfgIoState FWCfgIoState;
|
||||||
typedef struct FWCfgMemState FWCfgMemState;
|
typedef struct FWCfgMemState FWCfgMemState;
|
||||||
typedef struct FWCfgState FWCfgState;
|
typedef struct FWCfgState FWCfgState;
|
||||||
|
|
Loading…
Reference in New Issue