mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
hw/ssi: Rename SSI 'slave' as 'peripheral'
In order to use inclusive terminology, rename SSI 'slave' as 'peripheral', following the specification resolution: https://www.oshwa.org/a-resolution-to-redefine-spi-signal-names/ Patch created mechanically using: $ sed -i s/SSISlave/SSIPeripheral/ $(git grep -l SSISlave) $ sed -i s/SSI_SLAVE/SSI_PERIPHERAL/ $(git grep -l SSI_SLAVE) $ sed -i s/ssi-slave/ssi-peripheral/ $(git grep -l ssi-slave) $ sed -i s/ssi_slave/ssi_peripheral/ $(git grep -l ssi_slave) $ sed -i s/ssi_create_slave/ssi_create_peripheral/ \ $(git grep -l ssi_create_slave) Then in VMStateDescription vmstate_ssi_peripheral we restored the "SSISlave" migration stream name (to avoid breaking migration). Finally the following files have been manually tweaked: - hw/ssi/pl022.c - hw/ssi/xilinx_spips.c Suggested-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Message-Id: <20201012124955.3409127-4-f4bug@amsat.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
9ce89a22ae
commit
ec7e429bd2
14 changed files with 118 additions and 117 deletions
|
@ -2,11 +2,11 @@
|
|||
|
||||
/*
|
||||
* In principle SSI is a point-point interface. As such the qemu
|
||||
* implementation has a single slave device on a "bus".
|
||||
* However it is fairly common for boards to have multiple slaves
|
||||
* implementation has a single peripheral on a "bus".
|
||||
* However it is fairly common for boards to have multiple peripherals
|
||||
* connected to a single master, and select devices with an external
|
||||
* chip select. This is implemented in qemu by having an explicit mux device.
|
||||
* It is assumed that master and slave are both using the same transfer
|
||||
* It is assumed that master and peripheral are both using the same transfer
|
||||
* width.
|
||||
*/
|
||||
|
||||
|
@ -18,9 +18,9 @@
|
|||
|
||||
typedef enum SSICSMode SSICSMode;
|
||||
|
||||
#define TYPE_SSI_SLAVE "ssi-slave"
|
||||
OBJECT_DECLARE_TYPE(SSISlave, SSISlaveClass,
|
||||
SSI_SLAVE)
|
||||
#define TYPE_SSI_PERIPHERAL "ssi-peripheral"
|
||||
OBJECT_DECLARE_TYPE(SSIPeripheral, SSIPeripheralClass,
|
||||
SSI_PERIPHERAL)
|
||||
|
||||
#define SSI_GPIO_CS "ssi-gpio-cs"
|
||||
|
||||
|
@ -30,21 +30,21 @@ enum SSICSMode {
|
|||
SSI_CS_HIGH,
|
||||
};
|
||||
|
||||
/* Slave devices. */
|
||||
struct SSISlaveClass {
|
||||
/* Peripherals. */
|
||||
struct SSIPeripheralClass {
|
||||
DeviceClass parent_class;
|
||||
|
||||
void (*realize)(SSISlave *dev, Error **errp);
|
||||
void (*realize)(SSIPeripheral *dev, Error **errp);
|
||||
|
||||
/* if you have standard or no CS behaviour, just override transfer.
|
||||
* This is called when the device cs is active (true by default).
|
||||
*/
|
||||
uint32_t (*transfer)(SSISlave *dev, uint32_t val);
|
||||
uint32_t (*transfer)(SSIPeripheral *dev, uint32_t val);
|
||||
/* called when the CS line changes. Optional, devices only need to implement
|
||||
* this if they have side effects associated with the cs line (beyond
|
||||
* tristating the txrx lines).
|
||||
*/
|
||||
int (*set_cs)(SSISlave *dev, bool select);
|
||||
int (*set_cs)(SSIPeripheral *dev, bool select);
|
||||
/* define whether or not CS exists and is active low/high */
|
||||
SSICSMode cs_polarity;
|
||||
|
||||
|
@ -53,30 +53,30 @@ struct SSISlaveClass {
|
|||
* cs_polarity are unused if this is overwritten. Transfer_raw will
|
||||
* always be called for the device for every txrx access to the parent bus
|
||||
*/
|
||||
uint32_t (*transfer_raw)(SSISlave *dev, uint32_t val);
|
||||
uint32_t (*transfer_raw)(SSIPeripheral *dev, uint32_t val);
|
||||
};
|
||||
|
||||
struct SSISlave {
|
||||
struct SSIPeripheral {
|
||||
DeviceState parent_obj;
|
||||
|
||||
/* Chip select state */
|
||||
bool cs;
|
||||
};
|
||||
|
||||
extern const VMStateDescription vmstate_ssi_slave;
|
||||
extern const VMStateDescription vmstate_ssi_peripheral;
|
||||
|
||||
#define VMSTATE_SSI_SLAVE(_field, _state) { \
|
||||
#define VMSTATE_SSI_PERIPHERAL(_field, _state) { \
|
||||
.name = (stringify(_field)), \
|
||||
.size = sizeof(SSISlave), \
|
||||
.vmsd = &vmstate_ssi_slave, \
|
||||
.size = sizeof(SSIPeripheral), \
|
||||
.vmsd = &vmstate_ssi_peripheral, \
|
||||
.flags = VMS_STRUCT, \
|
||||
.offset = vmstate_offset_value(_state, _field, SSISlave), \
|
||||
.offset = vmstate_offset_value(_state, _field, SSIPeripheral), \
|
||||
}
|
||||
|
||||
DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
|
||||
DeviceState *ssi_create_peripheral(SSIBus *bus, const char *name);
|
||||
/**
|
||||
* ssi_realize_and_unref: realize and unref an SSI slave device
|
||||
* @dev: SSI slave device to realize
|
||||
* ssi_realize_and_unref: realize and unref an SSI peripheral
|
||||
* @dev: SSI peripheral to realize
|
||||
* @bus: SSI bus to put it on
|
||||
* @errp: error pointer
|
||||
*
|
||||
|
@ -87,10 +87,10 @@ DeviceState *ssi_create_slave(SSIBus *bus, const char *name);
|
|||
* This function is useful if you have created @dev via qdev_new()
|
||||
* (which takes a reference to the device it returns to you), so that
|
||||
* you can set properties on it before realizing it. If you don't need
|
||||
* to set properties then ssi_create_slave() is probably better (as it
|
||||
* to set properties then ssi_create_peripheral() is probably better (as it
|
||||
* does the create, init and realize in one step).
|
||||
*
|
||||
* If you are embedding the SSI slave into another QOM device and
|
||||
* If you are embedding the SSI peripheral into another QOM device and
|
||||
* initialized it via some variant on object_initialize_child() then
|
||||
* do not use this function, because that family of functions arrange
|
||||
* for the only reference to the child device to be held by the parent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue