diff options
Diffstat (limited to 'include')
215 files changed, 988 insertions, 532 deletions
diff --git a/include/block/block_int.h b/include/block/block_int.h index 47b9aac..8054146 100644 --- a/include/block/block_int.h +++ b/include/block/block_int.h @@ -639,11 +639,13 @@ int is_windows_drive(const char *filename); /** * stream_start: + * @job_id: The id of the newly-created job, or %NULL to use the + * device name of @bs. * @bs: Block device to operate on. * @base: Block device that will become the new base, or %NULL to * flatten the whole backing file chain onto @bs. - * @base_id: The file name that will be written to @bs as the new - * backing file if the job completes. Ignored if @base is %NULL. + * @backing_file_str: The file name that will be written to @bs as the + * the new backing file if the job completes. Ignored if @base is %NULL. * @speed: The maximum speed, in bytes per second, or 0 for unlimited. * @on_error: The action to take upon error. * @cb: Completion function for the job. @@ -654,15 +656,18 @@ int is_windows_drive(const char *filename); * in @bs, but allocated in any image between @base and @bs (both * exclusive) will be written to @bs. At the end of a successful * streaming job, the backing file of @bs will be changed to - * @base_id in the written image and to @base in the live BlockDriverState. + * @backing_file_str in the written image and to @base in the live + * BlockDriverState. */ -void stream_start(BlockDriverState *bs, BlockDriverState *base, - const char *base_id, int64_t speed, BlockdevOnError on_error, - BlockCompletionFunc *cb, - void *opaque, Error **errp); +void stream_start(const char *job_id, BlockDriverState *bs, + BlockDriverState *base, const char *backing_file_str, + int64_t speed, BlockdevOnError on_error, + BlockCompletionFunc *cb, void *opaque, Error **errp); /** * commit_start: + * @job_id: The id of the newly-created job, or %NULL to use the + * device name of @bs. * @bs: Active block device. * @top: Top block device to be committed. * @base: Block device that will be written into, and become the new top. @@ -674,12 +679,14 @@ void stream_start(BlockDriverState *bs, BlockDriverState *base, * @errp: Error object. * */ -void commit_start(BlockDriverState *bs, BlockDriverState *base, - BlockDriverState *top, int64_t speed, - BlockdevOnError on_error, BlockCompletionFunc *cb, - void *opaque, const char *backing_file_str, Error **errp); +void commit_start(const char *job_id, BlockDriverState *bs, + BlockDriverState *base, BlockDriverState *top, int64_t speed, + BlockdevOnError on_error, BlockCompletionFunc *cb, + void *opaque, const char *backing_file_str, Error **errp); /** * commit_active_start: + * @job_id: The id of the newly-created job, or %NULL to use the + * device name of @bs. * @bs: Active block device to be committed. * @base: Block device that will be written into, and become the new top. * @speed: The maximum speed, in bytes per second, or 0 for unlimited. @@ -689,13 +696,15 @@ void commit_start(BlockDriverState *bs, BlockDriverState *base, * @errp: Error object. * */ -void commit_active_start(BlockDriverState *bs, BlockDriverState *base, - int64_t speed, +void commit_active_start(const char *job_id, BlockDriverState *bs, + BlockDriverState *base, int64_t speed, BlockdevOnError on_error, BlockCompletionFunc *cb, void *opaque, Error **errp); /* * mirror_start: + * @job_id: The id of the newly-created job, or %NULL to use the + * device name of @bs. * @bs: Block device to operate on. * @target: Block device to write to. * @replaces: Block graph node name to replace once the mirror is done. Can @@ -717,8 +726,8 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base, * manually completed. At the end of a successful mirroring job, * @bs will be switched to read from @target. */ -void mirror_start(BlockDriverState *bs, BlockDriverState *target, - const char *replaces, +void mirror_start(const char *job_id, BlockDriverState *bs, + BlockDriverState *target, const char *replaces, int64_t speed, uint32_t granularity, int64_t buf_size, MirrorSyncMode mode, BlockMirrorBackingMode backing_mode, BlockdevOnError on_source_error, @@ -729,6 +738,8 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, /* * backup_start: + * @job_id: The id of the newly-created job, or %NULL to use the + * device name of @bs. * @bs: Block device to operate on. * @target: Block device to write to. * @speed: The maximum speed, in bytes per second, or 0 for unlimited. @@ -743,9 +754,9 @@ void mirror_start(BlockDriverState *bs, BlockDriverState *target, * Start a backup operation on @bs. Clusters in @bs are written to @target * until the job is cancelled or manually completed. */ -void backup_start(BlockDriverState *bs, BlockDriverState *target, - int64_t speed, MirrorSyncMode sync_mode, - BdrvDirtyBitmap *sync_bitmap, +void backup_start(const char *job_id, BlockDriverState *bs, + BlockDriverState *target, int64_t speed, + MirrorSyncMode sync_mode, BdrvDirtyBitmap *sync_bitmap, BlockdevOnError on_source_error, BlockdevOnError on_target_error, BlockCompletionFunc *cb, void *opaque, diff --git a/include/block/blockjob.h b/include/block/blockjob.h index 7dc720c..4ddb4ae 100644 --- a/include/block/blockjob.h +++ b/include/block/blockjob.h @@ -22,8 +22,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef BLOCKJOB_H -#define BLOCKJOB_H 1 +#define BLOCKJOB_H #include "block/block.h" @@ -106,10 +107,7 @@ struct BlockJob { BlockBackend *blk; /** - * The ID of the block job. Currently the BlockBackend name of the BDS - * owning the job at the time when the job is started. - * - * TODO Decouple block job IDs from BlockBackend names + * The ID of the block job. */ char *id; @@ -214,7 +212,19 @@ struct BlockJob { BlockJob *block_job_next(BlockJob *job); /** + * block_job_get: + * @id: The id of the block job. + * + * Get the block job identified by @id (which must not be %NULL). + * + * Returns the requested job, or %NULL if it doesn't exist. + */ +BlockJob *block_job_get(const char *id); + +/** * block_job_create: + * @job_id: The id of the newly-created job, or %NULL to have one + * generated automatically. * @job_type: The class object for the newly-created job. * @bs: The block * @speed: The maximum speed, in bytes per second, or 0 for unlimited. @@ -231,9 +241,9 @@ BlockJob *block_job_next(BlockJob *job); * This function is not part of the public job interface; it should be * called from a wrapper that is specific to the job type. */ -void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs, - int64_t speed, BlockCompletionFunc *cb, - void *opaque, Error **errp); +void *block_job_create(const char *job_id, const BlockJobDriver *driver, + BlockDriverState *bs, int64_t speed, + BlockCompletionFunc *cb, void *opaque, Error **errp); /** * block_job_sleep_ns: diff --git a/include/block/scsi.h b/include/block/scsi.h index 8b966d7..cdf0a58 100644 --- a/include/block/scsi.h +++ b/include/block/scsi.h @@ -19,8 +19,9 @@ * This header file contains public constants and structures used by * the scsi code for linux. */ -#ifndef HW_SCSI_DEFS_H -#define HW_SCSI_DEFS_H 1 + +#ifndef BLOCK_SCSI_H +#define BLOCK_SCSI_H /* * SCSI opcodes diff --git a/include/block/thread-pool.h b/include/block/thread-pool.h index 42eb5e8..7dd7d73 100644 --- a/include/block/thread-pool.h +++ b/include/block/thread-pool.h @@ -16,7 +16,7 @@ */ #ifndef QEMU_THREAD_POOL_H -#define QEMU_THREAD_POOL_H 1 +#define QEMU_THREAD_POOL_H #include "block/block.h" diff --git a/include/crypto/afsplit.h b/include/crypto/afsplit.h index 4cc4ca4..7dd21f0 100644 --- a/include/crypto/afsplit.h +++ b/include/crypto/afsplit.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_AFSPLIT_H__ -#define QCRYPTO_AFSPLIT_H__ +#ifndef QCRYPTO_AFSPLIT_H +#define QCRYPTO_AFSPLIT_H #include "crypto/hash.h" @@ -132,4 +132,4 @@ int qcrypto_afsplit_decode(QCryptoHashAlgorithm hash, uint8_t *out, Error **errp); -#endif /* QCRYPTO_AFSPLIT_H__ */ +#endif /* QCRYPTO_AFSPLIT_H */ diff --git a/include/crypto/block.h b/include/crypto/block.h index a21e11f..8955211 100644 --- a/include/crypto/block.h +++ b/include/crypto/block.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_BLOCK_H__ -#define QCRYPTO_BLOCK_H__ +#ifndef QCRYPTO_BLOCK_H +#define QCRYPTO_BLOCK_H #include "crypto/cipher.h" #include "crypto/ivgen.h" @@ -229,4 +229,4 @@ uint64_t qcrypto_block_get_payload_offset(QCryptoBlock *block); */ void qcrypto_block_free(QCryptoBlock *block); -#endif /* QCRYPTO_BLOCK_H__ */ +#endif /* QCRYPTO_BLOCK_H */ diff --git a/include/crypto/cipher.h b/include/crypto/cipher.h index d770c48..376654d 100644 --- a/include/crypto/cipher.h +++ b/include/crypto/cipher.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_CIPHER_H__ -#define QCRYPTO_CIPHER_H__ +#ifndef QCRYPTO_CIPHER_H +#define QCRYPTO_CIPHER_H #include "qapi-types.h" @@ -230,4 +230,4 @@ int qcrypto_cipher_setiv(QCryptoCipher *cipher, const uint8_t *iv, size_t niv, Error **errp); -#endif /* QCRYPTO_CIPHER_H__ */ +#endif /* QCRYPTO_CIPHER_H */ diff --git a/include/crypto/desrfb.h b/include/crypto/desrfb.h index 773667e..7ca596c 100644 --- a/include/crypto/desrfb.h +++ b/include/crypto/desrfb.h @@ -9,8 +9,9 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef D3DES_H -#define D3DES_H 1 + +#ifndef QCRYPTO_DESRFB_H +#define QCRYPTO_DESRFB_H /* d3des.h - * diff --git a/include/crypto/hash.h b/include/crypto/hash.h index f38caed..ca3267f 100644 --- a/include/crypto/hash.h +++ b/include/crypto/hash.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_HASH_H__ -#define QCRYPTO_HASH_H__ +#ifndef QCRYPTO_HASH_H +#define QCRYPTO_HASH_H #include "qapi-types.h" @@ -189,4 +189,4 @@ int qcrypto_hash_base64(QCryptoHashAlgorithm alg, char **base64, Error **errp); -#endif /* QCRYPTO_HASH_H__ */ +#endif /* QCRYPTO_HASH_H */ diff --git a/include/crypto/init.h b/include/crypto/init.h index 2513ed0..04c1edf 100644 --- a/include/crypto/init.h +++ b/include/crypto/init.h @@ -18,9 +18,9 @@ * */ -#ifndef QCRYPTO_INIT_H__ -#define QCRYPTO_INIT_H__ +#ifndef QCRYPTO_INIT_H +#define QCRYPTO_INIT_H int qcrypto_init(Error **errp); -#endif /* QCRYPTO_INIT_H__ */ +#endif /* QCRYPTO_INIT_H */ diff --git a/include/crypto/ivgen.h b/include/crypto/ivgen.h index 09cdb6f..0350cd2 100644 --- a/include/crypto/ivgen.h +++ b/include/crypto/ivgen.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_IVGEN_H__ -#define QCRYPTO_IVGEN_H__ +#ifndef QCRYPTO_IVGEN_H +#define QCRYPTO_IVGEN_H #include "crypto/cipher.h" #include "crypto/hash.h" @@ -203,4 +203,4 @@ QCryptoHashAlgorithm qcrypto_ivgen_get_hash(QCryptoIVGen *ivgen); */ void qcrypto_ivgen_free(QCryptoIVGen *ivgen); -#endif /* QCRYPTO_IVGEN_H__ */ +#endif /* QCRYPTO_IVGEN_H */ diff --git a/include/crypto/pbkdf.h b/include/crypto/pbkdf.h index 58a1fe6..e9e4cec 100644 --- a/include/crypto/pbkdf.h +++ b/include/crypto/pbkdf.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_PBKDF_H__ -#define QCRYPTO_PBKDF_H__ +#ifndef QCRYPTO_PBKDF_H +#define QCRYPTO_PBKDF_H #include "crypto/hash.h" @@ -149,4 +149,4 @@ int qcrypto_pbkdf2_count_iters(QCryptoHashAlgorithm hash, const uint8_t *salt, size_t nsalt, Error **errp); -#endif /* QCRYPTO_PBKDF_H__ */ +#endif /* QCRYPTO_PBKDF_H */ diff --git a/include/crypto/random.h b/include/crypto/random.h index f9308f4..a101353 100644 --- a/include/crypto/random.h +++ b/include/crypto/random.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_RANDOM_H__ -#define QCRYPTO_RANDOM_H__ +#ifndef QCRYPTO_RANDOM_H +#define QCRYPTO_RANDOM_H #include "qemu-common.h" #include "qapi/error.h" @@ -41,4 +41,4 @@ int qcrypto_random_bytes(uint8_t *buf, Error **errp); -#endif /* QCRYPTO_RANDOM_H__ */ +#endif /* QCRYPTO_RANDOM_H */ diff --git a/include/crypto/secret.h b/include/crypto/secret.h index b7392c6..07a963e 100644 --- a/include/crypto/secret.h +++ b/include/crypto/secret.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_SECRET_H__ -#define QCRYPTO_SECRET_H__ +#ifndef QCRYPTO_SECRET_H +#define QCRYPTO_SECRET_H #include "qom/object.h" @@ -143,4 +143,4 @@ extern char *qcrypto_secret_lookup_as_utf8(const char *secretid, extern char *qcrypto_secret_lookup_as_base64(const char *secretid, Error **errp); -#endif /* QCRYPTO_SECRET_H__ */ +#endif /* QCRYPTO_SECRET_H */ diff --git a/include/crypto/tlscreds.h b/include/crypto/tlscreds.h index 59e9187..ad47d88 100644 --- a/include/crypto/tlscreds.h +++ b/include/crypto/tlscreds.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_TLSCRED_H__ -#define QCRYPTO_TLSCRED_H__ +#ifndef QCRYPTO_TLSCREDS_H +#define QCRYPTO_TLSCREDS_H #include "qom/object.h" @@ -63,5 +63,4 @@ struct QCryptoTLSCredsClass { }; -#endif /* QCRYPTO_TLSCRED_H__ */ - +#endif /* QCRYPTO_TLSCREDS_H */ diff --git a/include/crypto/tlscredsanon.h b/include/crypto/tlscredsanon.h index d3976b8..4d6b7e4 100644 --- a/include/crypto/tlscredsanon.h +++ b/include/crypto/tlscredsanon.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_TLSCRED_ANON_H__ -#define QCRYPTO_TLSCRED_ANON_H__ +#ifndef QCRYPTO_TLSCREDSANON_H +#define QCRYPTO_TLSCREDSANON_H #include "crypto/tlscreds.h" @@ -108,5 +108,4 @@ struct QCryptoTLSCredsAnonClass { }; -#endif /* QCRYPTO_TLSCRED_H__ */ - +#endif /* QCRYPTO_TLSCREDSANON_H */ diff --git a/include/crypto/tlscredsx509.h b/include/crypto/tlscredsx509.h index 25796d7..66ad6a7 100644 --- a/include/crypto/tlscredsx509.h +++ b/include/crypto/tlscredsx509.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_TLSCRED_X509_H__ -#define QCRYPTO_TLSCRED_X509_H__ +#ifndef QCRYPTO_TLSCREDSX509_H +#define QCRYPTO_TLSCREDSX509_H #include "crypto/tlscreds.h" @@ -110,5 +110,4 @@ struct QCryptoTLSCredsX509Class { }; -#endif /* QCRYPTO_TLSCRED_X509_H__ */ - +#endif /* QCRYPTO_TLSCREDSX509_H */ diff --git a/include/crypto/tlssession.h b/include/crypto/tlssession.h index c1bad9e..1c7414e 100644 --- a/include/crypto/tlssession.h +++ b/include/crypto/tlssession.h @@ -18,8 +18,8 @@ * */ -#ifndef QCRYPTO_TLS_SESSION_H__ -#define QCRYPTO_TLS_SESSION_H__ +#ifndef QCRYPTO_TLSSESSION_H +#define QCRYPTO_TLSSESSION_H #include "crypto/tlscreds.h" @@ -319,4 +319,4 @@ int qcrypto_tls_session_get_key_size(QCryptoTLSSession *sess, */ char *qcrypto_tls_session_get_peer_name(QCryptoTLSSession *sess); -#endif /* QCRYPTO_TLS_SESSION_H__ */ +#endif /* QCRYPTO_TLSSESSION_H */ diff --git a/include/crypto/xts.h b/include/crypto/xts.h index c2924d8..da32ab8 100644 --- a/include/crypto/xts.h +++ b/include/crypto/xts.h @@ -23,9 +23,8 @@ * */ - -#ifndef QCRYPTO_XTS_H_ -#define QCRYPTO_XTS_H_ +#ifndef QCRYPTO_XTS_H +#define QCRYPTO_XTS_H #include "qemu-common.h" #include "qapi/error.h" @@ -83,4 +82,4 @@ void xts_encrypt(const void *datactx, const uint8_t *src); -#endif /* QCRYPTO_XTS_H_ */ +#endif /* QCRYPTO_XTS_H */ diff --git a/include/disas/bfd.h b/include/disas/bfd.h index a87b8a1..64c9544 100644 --- a/include/disas/bfd.h +++ b/include/disas/bfd.h @@ -6,8 +6,8 @@ interface, for making instruction-processing programs more independent of the instruction set being processed. */ -#ifndef DIS_ASM_H -#define DIS_ASM_H +#ifndef DISAS_BFD_H +#define DISAS_BFD_H #include "qemu/fprintf-fn.h" @@ -489,4 +489,4 @@ bfd_vma bfd_getl16 (const bfd_byte *addr); bfd_vma bfd_getb16 (const bfd_byte *addr); typedef bool bfd_boolean; -#endif /* ! defined (DIS_ASM_H) */ +#endif /* DISAS_BFD_H */ diff --git a/include/disas/disas.h b/include/disas/disas.h index 4930d78..e549ca2 100644 --- a/include/disas/disas.h +++ b/include/disas/disas.h @@ -1,5 +1,5 @@ -#ifndef _QEMU_DISAS_H -#define _QEMU_DISAS_H +#ifndef QEMU_DISAS_H +#define QEMU_DISAS_H #include "qemu-common.h" @@ -42,4 +42,4 @@ struct syminfo { /* Filled in by elfload.c. Simplistic, but will do for now. */ extern struct syminfo *syminfos; -#endif /* _QEMU_DISAS_H */ +#endif /* QEMU_DISAS_H */ diff --git a/include/elf.h b/include/elf.h index 745739a..1c2975d 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1,6 +1,5 @@ -#ifndef _QEMU_ELF_H -#define _QEMU_ELF_H - +#ifndef QEMU_ELF_H +#define QEMU_ELF_H /* 32-bit ELF base types. */ typedef uint32_t Elf32_Addr; @@ -1573,4 +1572,4 @@ struct elf32_fdpic_loadmap { #endif /* ELF_CLASS */ -#endif /* _QEMU_ELF_H */ +#endif /* QEMU_ELF_H */ diff --git a/include/exec/address-spaces.h b/include/exec/address-spaces.h index 3d12cdd..db8bfa9 100644 --- a/include/exec/address-spaces.h +++ b/include/exec/address-spaces.h @@ -11,8 +11,8 @@ * */ -#ifndef EXEC_MEMORY_H -#define EXEC_MEMORY_H +#ifndef EXEC_ADDRESS_SPACES_H +#define EXEC_ADDRESS_SPACES_H /* * Internal interfaces between memory.c/exec.c/vl.c. Do not #include unless diff --git a/include/exec/cpu-common.h b/include/exec/cpu-common.h index aaee995..952bcfe 100644 --- a/include/exec/cpu-common.h +++ b/include/exec/cpu-common.h @@ -1,5 +1,5 @@ #ifndef CPU_COMMON_H -#define CPU_COMMON_H 1 +#define CPU_COMMON_H /* CPU interfaces that are target independent. */ @@ -23,12 +23,6 @@ typedef struct CPUListState { FILE *file; } CPUListState; -typedef enum MMUAccessType { - MMU_DATA_LOAD = 0, - MMU_DATA_STORE = 1, - MMU_INST_FETCH = 2 -} MMUAccessType; - #if !defined(CONFIG_USER_ONLY) enum device_endian { @@ -123,4 +117,4 @@ int qemu_ram_foreach_block(RAMBlockIterFunc func, void *opaque); #endif -#endif /* !CPU_COMMON_H */ +#endif /* CPU_COMMON_H */ diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index c1f59fa..acda7b6 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -17,8 +17,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef _EXEC_ALL_H_ -#define _EXEC_ALL_H_ +#ifndef EXEC_ALL_H +#define EXEC_ALL_H #include "qemu-common.h" #include "exec/tb-context.h" @@ -361,8 +361,8 @@ extern uintptr_t tci_tb_ptr; struct MemoryRegion *iotlb_to_region(CPUState *cpu, hwaddr index, MemTxAttrs attrs); -void tlb_fill(CPUState *cpu, target_ulong addr, int is_write, int mmu_idx, - uintptr_t retaddr); +void tlb_fill(CPUState *cpu, target_ulong addr, MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr); #endif diff --git a/include/exec/gen-icount.h b/include/exec/gen-icount.h index a011324..1af03d8 100644 --- a/include/exec/gen-icount.h +++ b/include/exec/gen-icount.h @@ -1,5 +1,5 @@ #ifndef GEN_ICOUNT_H -#define GEN_ICOUNT_H 1 +#define GEN_ICOUNT_H #include "qemu/timer.h" diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h index 0d0da3a..8239ffc 100644 --- a/include/exec/helper-gen.h +++ b/include/exec/helper-gen.h @@ -2,9 +2,9 @@ This one expands generation functions for tcg opcodes. */ #ifndef HELPER_GEN_H -#define HELPER_GEN_H 1 +#define HELPER_GEN_H -#include <exec/helper-head.h> +#include "exec/helper-head.h" #define DEF_HELPER_FLAGS_0(name, flags, ret) \ static inline void glue(gen_helper_, name)(dh_retvar_decl0(ret)) \ diff --git a/include/exec/helper-head.h b/include/exec/helper-head.h index 74f8f03..1cfc43b 100644 --- a/include/exec/helper-head.h +++ b/include/exec/helper-head.h @@ -15,9 +15,8 @@ GEN_HELPER 2 to do runtime registration helper functions. */ -#ifndef DEF_HELPER_H -#define DEF_HELPER_H 1 - +#ifndef EXEC_HELPER_HEAD_H +#define EXEC_HELPER_HEAD_H #define HELPER(name) glue(helper_, name) @@ -133,4 +132,4 @@ /* MAX_OPC_PARAM_IARGS must be set to n if last entry is DEF_HELPER_FLAGS_n. */ -#endif /* DEF_HELPER_H */ +#endif /* EXEC_HELPER_HEAD_H */ diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h index effdd43..954bef8 100644 --- a/include/exec/helper-proto.h +++ b/include/exec/helper-proto.h @@ -2,9 +2,9 @@ This one expands prototypes for the helper functions. */ #ifndef HELPER_PROTO_H -#define HELPER_PROTO_H 1 +#define HELPER_PROTO_H -#include <exec/helper-head.h> +#include "exec/helper-head.h" #define DEF_HELPER_FLAGS_0(name, flags, ret) \ dh_ctype(ret) HELPER(name) (void); diff --git a/include/exec/helper-tcg.h b/include/exec/helper-tcg.h index 79fa3c8..bb92877 100644 --- a/include/exec/helper-tcg.h +++ b/include/exec/helper-tcg.h @@ -2,9 +2,9 @@ This one defines data structures private to tcg.c. */ #ifndef HELPER_TCG_H -#define HELPER_TCG_H 1 +#define HELPER_TCG_H -#include <exec/helper-head.h> +#include "exec/helper-head.h" #define DEF_HELPER_FLAGS_0(NAME, FLAGS, ret) \ { .func = HELPER(NAME), .name = #NAME, .flags = FLAGS, \ diff --git a/include/exec/softmmu-semi.h b/include/exec/softmmu-semi.h index 3a58c3f..7eefad8 100644 --- a/include/exec/softmmu-semi.h +++ b/include/exec/softmmu-semi.h @@ -6,8 +6,9 @@ * * This code is licensed under the GPL */ + #ifndef SOFTMMU_SEMI_H -#define SOFTMMU_SEMI_H 1 +#define SOFTMMU_SEMI_H static inline uint64_t softmmu_tget64(CPUArchState *env, target_ulong addr) { diff --git a/include/exec/tb-context.h b/include/exec/tb-context.h index e209c1c..dce95d9 100644 --- a/include/exec/tb-context.h +++ b/include/exec/tb-context.h @@ -17,8 +17,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef QEMU_TB_CONTEXT_H_ -#define QEMU_TB_CONTEXT_H_ +#ifndef QEMU_TB_CONTEXT_H +#define QEMU_TB_CONTEXT_H #include "qemu/thread.h" #include "qemu/qht.h" diff --git a/include/exec/tb-hash-xx.h b/include/exec/tb-hash-xx.h index 9f3fc05..2c40b5c 100644 --- a/include/exec/tb-hash-xx.h +++ b/include/exec/tb-hash-xx.h @@ -30,10 +30,11 @@ * You can contact the author at : * - xxHash source repository : https://github.com/Cyan4973/xxHash */ -#ifndef EXEC_TB_HASH_XX -#define EXEC_TB_HASH_XX -#include <qemu/bitops.h> +#ifndef EXEC_TB_HASH_XX_H +#define EXEC_TB_HASH_XX_H + +#include "qemu/bitops.h" #define PRIME32_1 2654435761U #define PRIME32_2 2246822519U @@ -91,4 +92,4 @@ uint32_t tb_hash_func5(uint64_t a0, uint64_t b0, uint32_t e) return h32; } -#endif /* EXEC_TB_HASH_XX */ +#endif /* EXEC_TB_HASH_XX_H */ diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 1d0200b..2c27490 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -17,8 +17,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef EXEC_TB_HASH -#define EXEC_TB_HASH +#ifndef EXEC_TB_HASH_H +#define EXEC_TB_HASH_H #include "exec/tb-hash-xx.h" diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h index 80eedac..a09d6c6 100644 --- a/include/exec/user/abitypes.h +++ b/include/exec/user/abitypes.h @@ -1,5 +1,6 @@ -#ifndef QEMU_TYPES_H -#define QEMU_TYPES_H +#ifndef EXEC_USER_ABITYPES_H +#define EXEC_USER_ABITYPES_H + #include "cpu.h" #ifdef TARGET_ABI32 diff --git a/include/fpu/softfloat.h b/include/fpu/softfloat.h index 95a1103..0e57ee5 100644 --- a/include/fpu/softfloat.h +++ b/include/fpu/softfloat.h @@ -751,4 +751,4 @@ static inline int float128_is_any_nan(float128 a) *----------------------------------------------------------------------------*/ float128 float128_default_nan(float_status *status); -#endif /* !SOFTFLOAT_H */ +#endif /* SOFTFLOAT_H */ diff --git a/include/hw/acpi/acpi.h b/include/hw/acpi/acpi.h index c717f15..7b3d93c 100644 --- a/include/hw/acpi/acpi.h +++ b/include/hw/acpi/acpi.h @@ -1,5 +1,6 @@ #ifndef QEMU_HW_ACPI_H #define QEMU_HW_ACPI_H + /* * Copyright (c) 2009 Isaku Yamahata <yamahata at valinux co jp> * VA Linux Systems Japan K.K. @@ -188,4 +189,4 @@ struct AcpiSlicOem { }; int acpi_get_slic_oem(AcpiSlicOem *oem); -#endif /* !QEMU_HW_ACPI_H */ +#endif /* QEMU_HW_ACPI_H */ diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index e7a1a4c..e5f0878 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -1,5 +1,5 @@ -#ifndef HW_ACPI_GEN_UTILS_H -#define HW_ACPI_GEN_UTILS_H +#ifndef HW_ACPI_AML_BUILD_H +#define HW_ACPI_AML_BUILD_H #include "hw/acpi/acpi-defs.h" #include "hw/acpi/bios-linker-loader.h" diff --git a/include/hw/acpi/cpu_hotplug.h b/include/hw/acpi/cpu_hotplug.h index b995ef2..3b932ab 100644 --- a/include/hw/acpi/cpu_hotplug.h +++ b/include/hw/acpi/cpu_hotplug.h @@ -9,8 +9,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#ifndef ACPI_HOTPLUG_H -#define ACPI_HOTPLUG_H + +#ifndef HW_ACPI_CPU_HOTPLUG_H +#define HW_ACPI_CPU_HOTPLUG_H #include "hw/acpi/acpi.h" #include "hw/acpi/pc-hotplug.h" diff --git a/include/hw/arm/arm.h b/include/hw/arm/arm.h index 8b49a98..aeeebfe 100644 --- a/include/hw/arm/arm.h +++ b/include/hw/arm/arm.h @@ -8,8 +8,8 @@ * */ -#ifndef ARM_MISC_H -#define ARM_MISC_H 1 +#ifndef HW_ARM_H +#define HW_ARM_H #include "exec/memory.h" #include "target-arm/cpu-qom.h" @@ -140,4 +140,4 @@ void arm_write_secure_board_setup_dummy_smc(ARMCPU *cpu, ticks. */ extern int system_clock_scale; -#endif /* !ARM_MISC_H */ +#endif /* HW_ARM_H */ diff --git a/include/hw/arm/exynos4210.h b/include/hw/arm/exynos4210.h index b6d929d..29fef8b 100644 --- a/include/hw/arm/exynos4210.h +++ b/include/hw/arm/exynos4210.h @@ -22,9 +22,8 @@ * */ - -#ifndef EXYNOS4210_H_ -#define EXYNOS4210_H_ +#ifndef EXYNOS4210_H +#define EXYNOS4210_H #include "qemu-common.h" #include "exec/memory.h" @@ -135,4 +134,4 @@ DeviceState *exynos4210_uart_create(hwaddr addr, CharDriverState *chr, qemu_irq irq); -#endif /* EXYNOS4210_H_ */ +#endif /* EXYNOS4210_H */ diff --git a/include/hw/arm/pxa.h b/include/hw/arm/pxa.h index 074feac..dd1a48b 100644 --- a/include/hw/arm/pxa.h +++ b/include/hw/arm/pxa.h @@ -6,8 +6,9 @@ * * This code is licensed under the GNU GPL v2. */ + #ifndef PXA_H -# define PXA_H "pxa.h" +#define PXA_H #include "exec/memory.h" #include "target-arm/cpu-qom.h" @@ -189,4 +190,4 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space, unsigned int sdram_size, const char *revision); PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size); -#endif /* PXA_H */ +#endif /* PXA_H */ diff --git a/include/hw/arm/soc_dma.h b/include/hw/arm/soc_dma.h index 7379731..fae3229 100644 --- a/include/hw/arm/soc_dma.h +++ b/include/hw/arm/soc_dma.h @@ -19,8 +19,7 @@ */ #ifndef HW_SOC_DMA_H -#define HW_SOC_DMA_H 1 - +#define HW_SOC_DMA_H #include "exec/memory.h" #include "hw/irq.h" diff --git a/include/hw/arm/stm32f205_soc.h b/include/hw/arm/stm32f205_soc.h index 0390eff..779b5da 100644 --- a/include/hw/arm/stm32f205_soc.h +++ b/include/hw/arm/stm32f205_soc.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#ifndef HW_ARM_STM32F205SOC_H -#define HW_ARM_STM32F205SOC_H +#ifndef HW_ARM_STM32F205_SOC_H +#define HW_ARM_STM32F205_SOC_H #include "hw/misc/stm32f2xx_syscfg.h" #include "hw/timer/stm32f2xx_timer.h" diff --git a/include/hw/audio/audio.h b/include/hw/audio/audio.h index b28abdd..55d40f7 100644 --- a/include/hw/audio/audio.h +++ b/include/hw/audio/audio.h @@ -1,5 +1,5 @@ -#ifndef HW_AUDIODEV_H -#define HW_AUDIODEV_H 1 +#ifndef HW_AUDIO_H +#define HW_AUDIO_H void isa_register_soundhw(const char *name, const char *descr, int (*init_isa)(ISABus *bus)); diff --git a/include/hw/audio/pcspk.h b/include/hw/audio/pcspk.h index 33e46a5..172afbf 100644 --- a/include/hw/audio/pcspk.h +++ b/include/hw/audio/pcspk.h @@ -44,4 +44,4 @@ static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit) return isadev; } -#endif /* !HW_PCSPK_H */ +#endif /* HW_PCSPK_H */ diff --git a/include/hw/block/block.h b/include/hw/block/block.h index 984660e..df9d207 100644 --- a/include/hw/block/block.h +++ b/include/hw/block/block.h @@ -8,8 +8,8 @@ * later. See the COPYING file in the top-level directory. */ -#ifndef HW_BLOCK_COMMON_H -#define HW_BLOCK_COMMON_H +#ifndef HW_BLOCK_H +#define HW_BLOCK_H #include "qemu-common.h" @@ -25,6 +25,9 @@ typedef struct BlockConf { uint32_t discard_granularity; /* geometry, not all devices use this */ uint32_t cyls, heads, secs; + OnOffAuto wce; + BlockdevOnError rerror; + BlockdevOnError werror; } BlockConf; static inline unsigned int get_physical_block_exp(BlockConf *conf) @@ -49,13 +52,20 @@ static inline unsigned int get_physical_block_exp(BlockConf *conf) DEFINE_PROP_UINT16("min_io_size", _state, _conf.min_io_size, 0), \ DEFINE_PROP_UINT32("opt_io_size", _state, _conf.opt_io_size, 0), \ DEFINE_PROP_UINT32("discard_granularity", _state, \ - _conf.discard_granularity, -1) + _conf.discard_granularity, -1), \ + DEFINE_PROP_ON_OFF_AUTO("write-cache", _state, _conf.wce, ON_OFF_AUTO_AUTO) #define DEFINE_BLOCK_CHS_PROPERTIES(_state, _conf) \ DEFINE_PROP_UINT32("cyls", _state, _conf.cyls, 0), \ DEFINE_PROP_UINT32("heads", _state, _conf.heads, 0), \ DEFINE_PROP_UINT32("secs", _state, _conf.secs, 0) +#define DEFINE_BLOCK_ERROR_PROPERTIES(_state, _conf) \ + DEFINE_PROP_BLOCKDEV_ON_ERROR("rerror", _state, _conf.rerror, \ + BLOCKDEV_ON_ERROR_AUTO), \ + DEFINE_PROP_BLOCKDEV_ON_ERROR("werror", _state, _conf.werror, \ + BLOCKDEV_ON_ERROR_AUTO) + /* Configuration helpers */ void blkconf_serial(BlockConf *conf, char **serial); @@ -63,6 +73,7 @@ void blkconf_geometry(BlockConf *conf, int *trans, unsigned cyls_max, unsigned heads_max, unsigned secs_max, Error **errp); void blkconf_blocksizes(BlockConf *conf); +void blkconf_apply_backend_options(BlockConf *conf); /* Hard disk geometry */ diff --git a/include/hw/block/flash.h b/include/hw/block/flash.h index a088baa..67c3aa3 100644 --- a/include/hw/block/flash.h +++ b/include/hw/block/flash.h @@ -1,5 +1,5 @@ #ifndef HW_FLASH_H -#define HW_FLASH_H 1 +#define HW_FLASH_H /* NOR flash devices */ diff --git a/include/hw/bt.h b/include/hw/bt.h index c7c7909..185e79d 100644 --- a/include/hw/bt.h +++ b/include/hw/bt.h @@ -24,7 +24,7 @@ */ #ifndef HW_BT_H -#define HW_BT_H 1 +#define HW_BT_H #include "hw/irq.h" diff --git a/include/hw/char/escc.h b/include/hw/char/escc.h index 2742d70..297e2eb 100644 --- a/include/hw/char/escc.h +++ b/include/hw/char/escc.h @@ -1,5 +1,5 @@ #ifndef HW_ESCC_H -#define HW_ESCC_H 1 +#define HW_ESCC_H /* escc.c */ #define TYPE_ESCC "escc" diff --git a/include/hw/char/lm32_juart.h b/include/hw/char/lm32_juart.h index 70dc416..e7c6fb5 100644 --- a/include/hw/char/lm32_juart.h +++ b/include/hw/char/lm32_juart.h @@ -10,4 +10,4 @@ uint32_t lm32_juart_get_jrx(DeviceState *d); void lm32_juart_set_jtx(DeviceState *d, uint32_t jtx); void lm32_juart_set_jrx(DeviceState *d, uint32_t jrx); -#endif /* QEMU_HW_LM32_JUART_H */ +#endif /* QEMU_HW_CHAR_LM32_JUART_H */ diff --git a/include/hw/char/pl011.h b/include/hw/char/pl011.h index 93bd7ee..0ca7c19 100644 --- a/include/hw/char/pl011.h +++ b/include/hw/char/pl011.h @@ -12,8 +12,8 @@ * this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef PL011_UART_H -#define PL011_UART_H +#ifndef HW_PL011_H +#define HW_PL011_H static inline DeviceState *pl011_create(hwaddr addr, qemu_irq irq, diff --git a/include/hw/char/serial.h b/include/hw/char/serial.h index 9feddc6..a4fd3d5 100644 --- a/include/hw/char/serial.h +++ b/include/hw/char/serial.h @@ -22,8 +22,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef HW_SERIAL_H -#define HW_SERIAL_H 1 +#define HW_SERIAL_H #include "hw/hw.h" #include "sysemu/sysemu.h" diff --git a/include/hw/cris/etraxfs.h b/include/hw/cris/etraxfs.h index eb66418..723a275 100644 --- a/include/hw/cris/etraxfs.h +++ b/include/hw/cris/etraxfs.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#ifndef HW_EXTRAXFS_H -#define HW_EXTRAXFS_H 1 +#ifndef HW_ETRAXFS_H +#define HW_ETRAXFS_H #include "net/net.h" #include "hw/cris/etraxfs_dma.h" diff --git a/include/hw/cris/etraxfs_dma.h b/include/hw/cris/etraxfs_dma.h index 38104a6..f6f33e0 100644 --- a/include/hw/cris/etraxfs_dma.h +++ b/include/hw/cris/etraxfs_dma.h @@ -1,5 +1,5 @@ #ifndef HW_ETRAXFS_DMA_H -#define HW_ETRAXFS_DMA_H 1 +#define HW_ETRAXFS_DMA_H struct dma_context_metadata { /* data descriptor md */ diff --git a/include/hw/display/dpcd.h b/include/hw/display/dpcd.h index 274dc2e..6880ee3 100644 --- a/include/hw/display/dpcd.h +++ b/include/hw/display/dpcd.h @@ -102,4 +102,4 @@ typedef struct DPCDState DPCDState; #define DPCD_SINK_STATUS 0x205 #define DPCD_RECEIVE_PORT_0_STATUS 0x01 -#endif /* !DPCD_H */ +#endif /* DPCD_H */ diff --git a/include/hw/dma/xlnx_dpdma.h b/include/hw/dma/xlnx_dpdma.h index ae571a0..664df28 100644 --- a/include/hw/dma/xlnx_dpdma.h +++ b/include/hw/dma/xlnx_dpdma.h @@ -82,4 +82,4 @@ void xlnx_dpdma_set_host_data_location(XlnxDPDMAState *s, uint8_t channel, */ void xlnx_dpdma_trigger_vsync_irq(XlnxDPDMAState *s); -#endif /* !XLNX_DPDMA_H */ +#endif /* XLNX_DPDMA_H */ diff --git a/include/hw/empty_slot.h b/include/hw/empty_slot.h index 6079602..123a9f8 100644 --- a/include/hw/empty_slot.h +++ b/include/hw/empty_slot.h @@ -1,5 +1,5 @@ #ifndef HW_EMPTY_SLOT_H -#define HW_EMPTY_SLOT_H 1 +#define HW_EMPTY_SLOT_H /* empty_slot.c */ void empty_slot_init(hwaddr addr, uint64_t slot_size); diff --git a/include/hw/fw-path-provider.h b/include/hw/fw-path-provider.h index 7afaec0..050cb05 100644 --- a/include/hw/fw-path-provider.h +++ b/include/hw/fw-path-provider.h @@ -16,7 +16,7 @@ */ #ifndef FW_PATH_PROVIDER_H -#define FW_PATH_PROVIDER_H 1 +#define FW_PATH_PROVIDER_H #include "qemu-common.h" #include "qom/object.h" diff --git a/include/hw/gpio/imx_gpio.h b/include/hw/gpio/imx_gpio.h index b15a09f..ffab437 100644 --- a/include/hw/gpio/imx_gpio.h +++ b/include/hw/gpio/imx_gpio.h @@ -17,10 +17,10 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef __IMX_GPIO_H_ -#define __IMX_GPIO_H_ +#ifndef IMX_GPIO_H +#define IMX_GPIO_H -#include <hw/sysbus.h> +#include "hw/sysbus.h" #define TYPE_IMX_GPIO "imx.gpio" #define IMX_GPIO(obj) OBJECT_CHECK(IMXGPIOState, (obj), TYPE_IMX_GPIO) @@ -60,4 +60,4 @@ typedef struct IMXGPIOState { qemu_irq output[IMX_GPIO_PIN_COUNT]; } IMXGPIOState; -#endif /* __IMX_GPIO_H_ */ +#endif /* IMX_GPIO_H */ diff --git a/include/hw/i2c/i2c-ddc.h b/include/hw/i2c/i2c-ddc.h index cb8e62d..d9b5f33 100644 --- a/include/hw/i2c/i2c-ddc.h +++ b/include/hw/i2c/i2c-ddc.h @@ -16,8 +16,8 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef I2C_DDC -#define I2C_DDC +#ifndef I2C_DDC_H +#define I2C_DDC_H /* A simple I2C slave which just returns the contents of its EDID blob. */ @@ -35,4 +35,4 @@ typedef struct I2CDDCState I2CDDCState; #define TYPE_I2CDDC "i2c-ddc" #define I2CDDC(obj) OBJECT_CHECK(I2CDDCState, (obj), TYPE_I2CDDC) -#endif /* !I2C_DDC */ +#endif /* I2C_DDC_H */ diff --git a/include/hw/i2c/imx_i2c.h b/include/hw/i2c/imx_i2c.h index e2ee8ea..7c73a1f 100644 --- a/include/hw/i2c/imx_i2c.h +++ b/include/hw/i2c/imx_i2c.h @@ -18,10 +18,10 @@ * */ -#ifndef __IMX_I2C_H_ -#define __IMX_I2C_H_ +#ifndef IMX_I2C_H +#define IMX_I2C_H -#include <hw/sysbus.h> +#include "hw/sysbus.h" #define TYPE_IMX_I2C "imx.i2c" #define IMX_I2C(obj) OBJECT_CHECK(IMXI2CState, (obj), TYPE_IMX_I2C) @@ -84,4 +84,4 @@ typedef struct IMXI2CState { uint16_t i2dr_write; } IMXI2CState; -#endif /* __IMX_I2C_H_ */ +#endif /* IMX_I2C_H */ diff --git a/include/hw/i2c/pm_smbus.h b/include/hw/i2c/pm_smbus.h index 926603f..2a837af 100644 --- a/include/hw/i2c/pm_smbus.h +++ b/include/hw/i2c/pm_smbus.h @@ -17,4 +17,4 @@ typedef struct PMSMBus { void pm_smbus_init(DeviceState *parent, PMSMBus *smb); -#endif /* !PM_SMBUS_H */ +#endif /* PM_SMBUS_H */ diff --git a/include/hw/i386/apic_internal.h b/include/hw/i386/apic_internal.h index 74fe935..73ce716 100644 --- a/include/hw/i386/apic_internal.h +++ b/include/hw/i386/apic_internal.h @@ -17,6 +17,7 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/> */ + #ifndef QEMU_APIC_INTERNAL_H #define QEMU_APIC_INTERNAL_H @@ -222,4 +223,4 @@ static inline int apic_get_bit(uint32_t *tab, int index) return !!(tab[i] & mask); } -#endif /* !QEMU_APIC_INTERNAL_H */ +#endif /* QEMU_APIC_INTERNAL_H */ diff --git a/include/hw/i386/ioapic.h b/include/hw/i386/ioapic.h index 6245388..9c8816f 100644 --- a/include/hw/i386/ioapic.h +++ b/include/hw/i386/ioapic.h @@ -25,4 +25,4 @@ void ioapic_eoi_broadcast(int vector); -#endif /* !HW_IOAPIC_H */ +#endif /* HW_IOAPIC_H */ diff --git a/include/hw/i386/ioapic_internal.h b/include/hw/i386/ioapic_internal.h index cab9e67..0542aa1 100644 --- a/include/hw/i386/ioapic_internal.h +++ b/include/hw/i386/ioapic_internal.h @@ -112,4 +112,4 @@ void ioapic_reset_common(DeviceState *dev); void ioapic_print_redtbl(Monitor *mon, IOAPICCommonState *s); -#endif /* !QEMU_IOAPIC_INTERNAL_H */ +#endif /* QEMU_IOAPIC_INTERNAL_H */ diff --git a/include/hw/ide/ahci.h b/include/hw/ide/ahci.h index bc777ed..0ca7c65 100644 --- a/include/hw/ide/ahci.h +++ b/include/hw/ide/ahci.h @@ -24,7 +24,7 @@ #ifndef HW_IDE_AHCI_H #define HW_IDE_AHCI_H -#include <hw/sysbus.h> +#include "hw/sysbus.h" #define AHCI_MEM_BAR_SIZE 0x1000 #define AHCI_MAX_PORTS 32 diff --git a/include/hw/ide/internal.h b/include/hw/ide/internal.h index 773928a..7824bc3 100644 --- a/include/hw/ide/internal.h +++ b/include/hw/ide/internal.h @@ -6,8 +6,8 @@ * only files in hw/ide/ are supposed to include this file. * non-internal declarations are in hw/ide.h */ -#include <hw/ide.h> -#include <hw/isa/isa.h> +#include "hw/ide.h" +#include "hw/isa/isa.h" #include "sysemu/dma.h" #include "sysemu/sysemu.h" #include "hw/block/block.h" diff --git a/include/hw/ide/pci.h b/include/hw/ide/pci.h index 0f2d4b9..dbc6a03 100644 --- a/include/hw/ide/pci.h +++ b/include/hw/ide/pci.h @@ -1,7 +1,7 @@ #ifndef HW_IDE_PCI_H #define HW_IDE_PCI_H -#include <hw/ide/internal.h> +#include "hw/ide/internal.h" #define BM_STATUS_DMAING 0x01 #define BM_STATUS_ERROR 0x02 diff --git a/include/hw/input/adb.h b/include/hw/input/adb.h index db51d03..3ae8445 100644 --- a/include/hw/input/adb.h +++ b/include/hw/input/adb.h @@ -23,8 +23,8 @@ * THE SOFTWARE. */ -#if !defined(__ADB_H__) -#define __ADB_H__ +#ifndef ADB_H +#define ADB_H #include "hw/qdev.h" @@ -84,4 +84,4 @@ int adb_poll(ADBBusState *s, uint8_t *buf_out, uint16_t poll_mask); #define TYPE_ADB_KEYBOARD "adb-keyboard" #define TYPE_ADB_MOUSE "adb-mouse" -#endif /* !defined(__ADB_H__) */ +#endif /* ADB_H */ diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h index 7c45ce7..b9ceee4 100644 --- a/include/hw/input/ps2.h +++ b/include/hw/input/ps2.h @@ -35,4 +35,4 @@ void ps2_queue(void *, int b); void ps2_keyboard_set_translation(void *opaque, int mode); void ps2_mouse_fake_event(void *opaque); -#endif /* !HW_PS2_H */ +#endif /* HW_PS2_H */ diff --git a/include/hw/intc/allwinner-a10-pic.h b/include/hw/intc/allwinner-a10-pic.h index 5721b2e..1d314a7 100644 --- a/include/hw/intc/allwinner-a10-pic.h +++ b/include/hw/intc/allwinner-a10-pic.h @@ -1,5 +1,5 @@ -#ifndef AW_A10_PIC_H -#define AW_A10_PIC_H +#ifndef ALLWINNER_A10_PIC_H +#define ALLWINNER_A10_PIC_H #define TYPE_AW_A10_PIC "allwinner-a10-pic" #define AW_A10_PIC(obj) OBJECT_CHECK(AwA10PICState, (obj), TYPE_AW_A10_PIC) diff --git a/include/hw/intc/mips_gic.h b/include/hw/intc/mips_gic.h new file mode 100644 index 0000000..b98d500 --- /dev/null +++ b/include/hw/intc/mips_gic.h @@ -0,0 +1,216 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2000, 07 MIPS Technologies, Inc. + * Copyright (C) 2016 Imagination Technologies + * + */ + +#ifndef MIPS_GIC_H +#define MIPS_GIC_H + +#include "hw/timer/mips_gictimer.h" +#include "cpu.h" +/* + * GIC Specific definitions + */ + +/* The MIPS default location */ +#define GIC_BASE_ADDR 0x1bdc0000ULL +#define GIC_ADDRSPACE_SZ (128 * 1024) + +/* Constants */ +#define GIC_POL_POS 1 +#define GIC_POL_NEG 0 +#define GIC_TRIG_EDGE 1 +#define GIC_TRIG_LEVEL 0 + +#define MSK(n) ((1ULL << (n)) - 1) + +/* GIC Address Space */ +#define SHARED_SECTION_OFS 0x0000 +#define SHARED_SECTION_SIZE 0x8000 +#define VP_LOCAL_SECTION_OFS 0x8000 +#define VP_LOCAL_SECTION_SIZE 0x4000 +#define VP_OTHER_SECTION_OFS 0xc000 +#define VP_OTHER_SECTION_SIZE 0x4000 +#define USM_VISIBLE_SECTION_OFS 0x10000 +#define USM_VISIBLE_SECTION_SIZE 0x10000 + +/* Register Map for Shared Section */ + +#define GIC_SH_CONFIG_OFS 0x0000 + +/* Shared Global Counter */ +#define GIC_SH_COUNTERLO_OFS 0x0010 +#define GIC_SH_COUNTERHI_OFS 0x0014 +#define GIC_SH_REVISIONID_OFS 0x0020 + +/* Set/Clear corresponding bit in Edge Detect Register */ +#define GIC_SH_WEDGE_OFS 0x0280 + +/* Reset Mask - Disables Interrupt */ +#define GIC_SH_RMASK_OFS 0x0300 +#define GIC_SH_RMASK_LAST_OFS 0x031c + +/* Set Mask (WO) - Enables Interrupt */ +#define GIC_SH_SMASK_OFS 0x0380 +#define GIC_SH_SMASK_LAST_OFS 0x039c + +/* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */ +#define GIC_SH_MASK_OFS 0x0400 +#define GIC_SH_MASK_LAST_OFS 0x041c + +/* Pending Global Interrupts (RO) */ +#define GIC_SH_PEND_OFS 0x0480 +#define GIC_SH_PEND_LAST_OFS 0x049c + +#define GIC_SH_MAP0_PIN_OFS 0x0500 +#define GIC_SH_MAP255_PIN_OFS 0x08fc + +#define GIC_SH_MAP0_VP_OFS 0x2000 +#define GIC_SH_MAP255_VP_LAST_OFS 0x3fe4 + +/* Register Map for Local Section */ +#define GIC_VP_CTL_OFS 0x0000 +#define GIC_VP_PEND_OFS 0x0004 +#define GIC_VP_MASK_OFS 0x0008 +#define GIC_VP_RMASK_OFS 0x000c +#define GIC_VP_SMASK_OFS 0x0010 +#define GIC_VP_WD_MAP_OFS 0x0040 +#define GIC_VP_COMPARE_MAP_OFS 0x0044 +#define GIC_VP_TIMER_MAP_OFS 0x0048 +#define GIC_VP_FDC_MAP_OFS 0x004c +#define GIC_VP_PERFCTR_MAP_OFS 0x0050 +#define GIC_VP_SWINT0_MAP_OFS 0x0054 +#define GIC_VP_SWINT1_MAP_OFS 0x0058 +#define GIC_VP_OTHER_ADDR_OFS 0x0080 +#define GIC_VP_IDENT_OFS 0x0088 +#define GIC_VP_WD_CONFIG0_OFS 0x0090 +#define GIC_VP_WD_COUNT0_OFS 0x0094 +#define GIC_VP_WD_INITIAL0_OFS 0x0098 +#define GIC_VP_COMPARE_LO_OFS 0x00a0 +#define GIC_VP_COMPARE_HI_OFS 0x00a4 +#define GIC_VL_BRK_GROUP 0x3080 + +/* User-Mode Visible Section Register */ +/* Read-only alias for GIC Shared CounterLo */ +#define GIC_USER_MODE_COUNTERLO 0x0000 +/* Read-only alias for GIC Shared CounterHi */ +#define GIC_USER_MODE_COUNTERHI 0x0004 + +/* Masks */ +#define GIC_SH_CONFIG_COUNTSTOP_SHF 28 +#define GIC_SH_CONFIG_COUNTSTOP_MSK (MSK(1) << GIC_SH_CONFIG_COUNTSTOP_SHF) +#define GIC_SH_CONFIG_COUNTBITS_SHF 24 +#define GIC_SH_CONFIG_COUNTBITS_MSK (MSK(4) << GIC_SH_CONFIG_COUNTBITS_SHF) +#define GIC_SH_CONFIG_NUMINTRS_SHF 16 +#define GIC_SH_CONFIG_NUMINTRS_MSK (MSK(8) << GIC_SH_CONFIG_NUMINTRS_SHF) +#define GIC_SH_CONFIG_PVPS_SHF 0 +#define GIC_SH_CONFIG_PVPS_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPS_SHF) + +#define GIC_SH_WEDGE_RW_SHF 31 +#define GIC_SH_WEDGE_RW_MSK (MSK(1) << GIC_SH_WEDGE_RW_SHF) + +#define GIC_MAP_TO_PIN_SHF 31 +#define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF) +#define GIC_MAP_TO_NMI_SHF 30 +#define GIC_MAP_TO_NMI_MSK (MSK(1) << GIC_MAP_TO_NMI_SHF) +#define GIC_MAP_TO_YQ_SHF 29 +#define GIC_MAP_TO_YQ_MSK (MSK(1) << GIC_MAP_TO_YQ_SHF) +#define GIC_MAP_SHF 0 +#define GIC_MAP_MSK (MSK(6) << GIC_MAP_SHF) +#define GIC_MAP_TO_PIN_REG_MSK \ + (GIC_MAP_TO_PIN_MSK | GIC_MAP_TO_NMI_MSK | GIC_MAP_TO_YQ_MSK | GIC_MAP_MSK) + +/* GIC_VP_CTL Masks */ +#define GIC_VP_CTL_FDC_RTBL_SHF 4 +#define GIC_VP_CTL_FDC_RTBL_MSK (MSK(1) << GIC_VP_CTL_FDC_RTBL_SHF) +#define GIC_VP_CTL_SWINT_RTBL_SHF 3 +#define GIC_VP_CTL_SWINT_RTBL_MSK (MSK(1) << GIC_VP_CTL_SWINT_RTBL_SHF) +#define GIC_VP_CTL_PERFCNT_RTBL_SHF 2 +#define GIC_VP_CTL_PERFCNT_RTBL_MSK (MSK(1) << GIC_VP_CTL_PERFCNT_RTBL_SHF) +#define GIC_VP_CTL_TIMER_RTBL_SHF 1 +#define GIC_VP_CTL_TIMER_RTBL_MSK (MSK(1) << GIC_VP_CTL_TIMER_RTBL_SHF) +#define GIC_VP_CTL_EIC_MODE_SHF 0 +#define GIC_VP_CTL_EIC_MODE_MSK (MSK(1) << GIC_VP_CTL_EIC_MODE_SHF) + +/* GIC_VP_MASK Masks */ +#define GIC_VP_MASK_FDC_SHF 6 +#define GIC_VP_MASK_FDC_MSK (MSK(1) << GIC_VP_MASK_FDC_SHF) +#define GIC_VP_MASK_SWINT1_SHF 5 +#define GIC_VP_MASK_SWINT1_MSK (MSK(1) << GIC_VP_MASK_SWINT1_SHF) +#define GIC_VP_MASK_SWINT0_SHF 4 +#define GIC_VP_MASK_SWINT0_MSK (MSK(1) << GIC_VP_MASK_SWINT0_SHF) +#define GIC_VP_MASK_PERFCNT_SHF 3 +#define GIC_VP_MASK_PERFCNT_MSK (MSK(1) << GIC_VP_MASK_PERFCNT_SHF) +#define GIC_VP_MASK_TIMER_SHF 2 +#define GIC_VP_MASK_TIMER_MSK (MSK(1) << GIC_VP_MASK_TIMER_SHF) +#define GIC_VP_MASK_CMP_SHF 1 +#define GIC_VP_MASK_CMP_MSK (MSK(1) << GIC_VP_MASK_CMP_SHF) +#define GIC_VP_MASK_WD_SHF 0 +#define GIC_VP_MASK_WD_MSK (MSK(1) << GIC_VP_MASK_WD_SHF) +#define GIC_VP_SET_RESET_MSK (MSK(7) << GIC_VP_MASK_WD_SHF) + +#define GIC_CPU_INT_MAX 5 /* Core Interrupt 7 */ +#define GIC_CPU_PIN_OFFSET 2 + +/* Local GIC interrupts. */ +#define GIC_NUM_LOCAL_INTRS 7 +#define GIC_LOCAL_INT_FDC 6 /* CPU fast debug channel */ +#define GIC_LOCAL_INT_SWINT1 5 /* CPU software interrupt 1 */ +#define GIC_LOCAL_INT_SWINT0 4 /* CPU software interrupt 0 */ +#define GIC_LOCAL_INT_PERFCTR 3 /* CPU performance counter */ +#define GIC_LOCAL_INT_TIMER 2 /* CPU timer interrupt */ +#define GIC_LOCAL_INT_COMPARE 1 /* GIC count and compare timer */ +#define GIC_LOCAL_INT_WD 0 /* GIC watchdog */ + +#define TYPE_MIPS_GIC "mips-gic" +#define MIPS_GIC(obj) OBJECT_CHECK(MIPSGICState, (obj), TYPE_MIPS_GIC) + +/* Support up to 32 VPs and 256 IRQs */ +#define GIC_MAX_VPS 32 +#define GIC_MAX_INTRS 256 + +typedef struct MIPSGICState MIPSGICState; +typedef struct MIPSGICIRQState MIPSGICIRQState; +typedef struct MIPSGICVPState MIPSGICVPState; + +struct MIPSGICIRQState { + uint8_t enabled; + uint8_t pending; + uint32_t map_pin; + int32_t map_vp; + qemu_irq irq; +}; + +struct MIPSGICVPState { + uint32_t ctl; + uint32_t pend; + uint32_t mask; + uint32_t compare_map; + uint32_t other_addr; + CPUMIPSState *env; +}; + +struct MIPSGICState { + SysBusDevice parent_obj; + MemoryRegion mr; + + /* Shared Section Registers */ + uint32_t sh_config; + MIPSGICIRQState *irq_state; + + /* VP Local/Other Section Registers */ + MIPSGICVPState *vps; + + /* GIC VP Timer */ + MIPSGICTimerState *gic_timer; + + int32_t num_vps; + int32_t num_irq; +}; + +#endif /* MIPS_GIC_H */ diff --git a/include/hw/isa/i8257.h b/include/hw/isa/i8257.h index 8c44d36..aa211c0 100644 --- a/include/hw/isa/i8257.h +++ b/include/hw/isa/i8257.h @@ -39,4 +39,3 @@ typedef struct I8257State { } I8257State; #endif - diff --git a/include/hw/isa/i8259_internal.h b/include/hw/isa/i8259_internal.h index cded509..6954b6e 100644 --- a/include/hw/isa/i8259_internal.h +++ b/include/hw/isa/i8259_internal.h @@ -80,4 +80,4 @@ void pic_reset_common(PICCommonState *s); ISADevice *i8259_init_chip(const char *name, ISABus *bus, bool master); -#endif /* !QEMU_I8259_INTERNAL_H */ +#endif /* QEMU_I8259_INTERNAL_H */ diff --git a/include/hw/mips/cps.h b/include/hw/mips/cps.h index 4dbae9c..526b8d0 100644 --- a/include/hw/mips/cps.h +++ b/include/hw/mips/cps.h @@ -22,6 +22,7 @@ #include "hw/sysbus.h" #include "hw/misc/mips_cmgcr.h" +#include "hw/intc/mips_gic.h" #include "hw/misc/mips_cpc.h" #include "hw/misc/mips_itu.h" @@ -37,6 +38,7 @@ typedef struct MIPSCPSState { MemoryRegion container; MIPSGCRState gcr; + MIPSGICState gic; MIPSCPCState cpc; MIPSITUState itu; } MIPSCPSState; diff --git a/include/hw/misc/arm_integrator_debug.h b/include/hw/misc/arm_integrator_debug.h index 37789b6..0077dac 100644 --- a/include/hw/misc/arm_integrator_debug.h +++ b/include/hw/misc/arm_integrator_debug.h @@ -10,8 +10,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#ifndef QEMU_INTEGRATOR_DEBUG_H -#define QEMU_INTEGRATOR_DEBUG_H + +#ifndef ARM_INTEGRATOR_DEBUG_H +#define ARM_INTEGRATOR_DEBUG_H #define TYPE_INTEGRATOR_DEBUG "integrator_debug" diff --git a/include/hw/misc/auxbus.h b/include/hw/misc/auxbus.h index af39db7..68ade8a 100644 --- a/include/hw/misc/auxbus.h +++ b/include/hw/misc/auxbus.h @@ -22,8 +22,8 @@ * */ -#ifndef QEMU_AUX_H -#define QEMU_AUX_H +#ifndef HW_MISC_AUXBUS_H +#define HW_MISC_AUXBUS_H #include "hw/qdev.h" @@ -125,4 +125,4 @@ void aux_init_mmio(AUXSlave *aux_slave, MemoryRegion *mmio); DeviceState *aux_create_slave(AUXBus *bus, const char *name, uint32_t addr); -#endif /* !QEMU_AUX_H */ +#endif /* HW_MISC_AUXBUS_H */ diff --git a/include/hw/misc/mips_cmgcr.h b/include/hw/misc/mips_cmgcr.h index cc60eef..a209d91 100644 --- a/include/hw/misc/mips_cmgcr.h +++ b/include/hw/misc/mips_cmgcr.h @@ -7,8 +7,8 @@ * */ -#ifndef _MIPS_GCR_H -#define _MIPS_GCR_H +#ifndef MIPS_CMGCR_H +#define MIPS_CMGCR_H #define TYPE_MIPS_GCR "mips-gcr" #define MIPS_GCR(obj) OBJECT_CHECK(MIPSGCRState, (obj), TYPE_MIPS_GCR) @@ -26,23 +26,45 @@ #define GCR_CONFIG_OFS 0x0000 #define GCR_BASE_OFS 0x0008 #define GCR_REV_OFS 0x0030 +#define GCR_GIC_BASE_OFS 0x0080 #define GCR_CPC_BASE_OFS 0x0088 +#define GCR_GIC_STATUS_OFS 0x00D0 #define GCR_CPC_STATUS_OFS 0x00F0 #define GCR_L2_CONFIG_OFS 0x0130 /* Core Local and Core Other Block Register Map */ #define GCR_CL_CONFIG_OFS 0x0010 #define GCR_CL_OTHER_OFS 0x0018 +#define GCR_CL_RESETBASE_OFS 0x0020 /* GCR_L2_CONFIG register fields */ #define GCR_L2_CONFIG_BYPASS_SHF 20 #define GCR_L2_CONFIG_BYPASS_MSK ((0x1ULL) << GCR_L2_CONFIG_BYPASS_SHF) +/* GCR_GIC_BASE register fields */ +#define GCR_GIC_BASE_GICEN_MSK 1 +#define GCR_GIC_BASE_GICBASE_MSK 0xFFFFFFFE0000ULL +#define GCR_GIC_BASE_MSK (GCR_GIC_BASE_GICEN_MSK | GCR_GIC_BASE_GICBASE_MSK) + /* GCR_CPC_BASE register fields */ #define GCR_CPC_BASE_CPCEN_MSK 1 #define GCR_CPC_BASE_CPCBASE_MSK 0xFFFFFFFF8000ULL #define GCR_CPC_BASE_MSK (GCR_CPC_BASE_CPCEN_MSK | GCR_CPC_BASE_CPCBASE_MSK) +/* GCR_CL_OTHER_OFS register fields */ +#define GCR_CL_OTHER_VPOTHER_MSK 0x7 +#define GCR_CL_OTHER_MSK GCR_CL_OTHER_VPOTHER_MSK + +/* GCR_CL_RESETBASE_OFS register fields */ +#define GCR_CL_RESET_BASE_RESETBASE_MSK 0xFFFFF000U +#define GCR_CL_RESET_BASE_MSK GCR_CL_RESET_BASE_RESETBASE_MSK + +typedef struct MIPSGCRVPState MIPSGCRVPState; +struct MIPSGCRVPState { + uint32_t other; + uint64_t reset_base; +}; + typedef struct MIPSGCRState MIPSGCRState; struct MIPSGCRState { SysBusDevice parent_obj; @@ -52,8 +74,13 @@ struct MIPSGCRState { hwaddr gcr_base; MemoryRegion iomem; MemoryRegion *cpc_mr; + MemoryRegion *gic_mr; uint64_t cpc_base; + uint64_t gic_base; + + /* VP Local/Other Registers */ + MIPSGCRVPState *vps; }; -#endif /* _MIPS_GCR_H */ +#endif /* MIPS_CMGCR_H */ diff --git a/include/hw/misc/tmp105_regs.h b/include/hw/misc/tmp105_regs.h index 9b55aba..ef015ee 100644 --- a/include/hw/misc/tmp105_regs.h +++ b/include/hw/misc/tmp105_regs.h @@ -11,8 +11,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or * later. See the COPYING file in the top-level directory. */ -#ifndef QEMU_TMP105_MSGS_H -#define QEMU_TMP105_MSGS_H + +#ifndef TMP105_REGS_H +#define TMP105_REGS_H /** * TMP105Reg: diff --git a/include/hw/net/allwinner_emac.h b/include/hw/net/allwinner_emac.h index 9f21aa7..4cc8aab 100644 --- a/include/hw/net/allwinner_emac.h +++ b/include/hw/net/allwinner_emac.h @@ -19,8 +19,9 @@ * GNU General Public License for more details. * */ -#ifndef AW_EMAC_H -#define AW_EMAC_H + +#ifndef ALLWINNER_EMAC_H +#define ALLWINNER_EMAC_H #include "net/net.h" #include "qemu/fifo8.h" diff --git a/include/hw/nmi.h b/include/hw/nmi.h index b541772..d092c68 100644 --- a/include/hw/nmi.h +++ b/include/hw/nmi.h @@ -20,7 +20,7 @@ */ #ifndef NMI_H -#define NMI_H 1 +#define NMI_H #include "qemu-common.h" #include "qom/object.h" diff --git a/include/hw/nvram/openbios_firmware_abi.h b/include/hw/nvram/openbios_firmware_abi.h index c66ee22..74cfd56 100644 --- a/include/hw/nvram/openbios_firmware_abi.h +++ b/include/hw/nvram/openbios_firmware_abi.h @@ -1,5 +1,5 @@ -#ifndef FIRMWARE_ABI_H -#define FIRMWARE_ABI_H +#ifndef OPENBIOS_FIRMWARE_ABI_H +#define OPENBIOS_FIRMWARE_ABI_H /* OpenBIOS NVRAM partition */ struct OpenBIOS_nvpart_v1 { @@ -72,4 +72,4 @@ Sun_init_header(struct Sun_nvram *header, const uint8_t *macaddr, int machine_id header->checksum = tmp; } -#endif /* FIRMWARE_ABI_H */ +#endif /* OPENBIOS_FIRMWARE_ABI_H */ diff --git a/include/hw/pci-host/apb.h b/include/hw/pci-host/apb.h index 736db61..b19bd55 100644 --- a/include/hw/pci-host/apb.h +++ b/include/hw/pci-host/apb.h @@ -1,5 +1,5 @@ -#ifndef APB_PCI_H -#define APB_PCI_H +#ifndef PCI_HOST_APB_H +#define PCI_HOST_APB_H #include "qemu-common.h" diff --git a/include/hw/pci-host/ppce500.h b/include/hw/pci-host/ppce500.h index 61f773e..e3a3742 100644 --- a/include/hw/pci-host/ppce500.h +++ b/include/hw/pci-host/ppce500.h @@ -1,5 +1,5 @@ -#ifndef PPCE500_PCI_H -#define PPCE500_PCI_H +#ifndef PCI_HOST_PPCE500_H +#define PCI_HOST_PPCE500_H static inline int ppce500_pci_map_irq_slot(int devno, int irq_num) { diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index 193631d..5adc603 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -16,13 +16,11 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. */ -#if !defined(__HW_SPAPR_H__) -#error Please include spapr.h before this file! -#endif -#if !defined(__HW_SPAPR_PCI_H__) -#define __HW_SPAPR_PCI_H__ +#ifndef PCI_HOST_SPAPR_H +#define PCI_HOST_SPAPR_H +#include "hw/ppc/spapr.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" #include "hw/ppc/xics.h" @@ -155,4 +153,4 @@ static inline void spapr_phb_vfio_reset(DeviceState *qdev) void spapr_phb_dma_reset(sPAPRPHBState *sphb); -#endif /* __HW_SPAPR_PCI_H__ */ +#endif /* PCI_HOST_SPAPR_H */ diff --git a/include/hw/pci/pci_bridge.h b/include/hw/pci/pci_bridge.h index ed4aff6..847fd7d 100644 --- a/include/hw/pci/pci_bridge.h +++ b/include/hw/pci/pci_bridge.h @@ -67,4 +67,4 @@ void pci_bridge_map_irq(PCIBridge *br, const char* bus_name, #define PCI_BRIDGE_CTL_DISCARD_STATUS 0x400 /* Discard timer status */ #define PCI_BRIDGE_CTL_DISCARD_SERR 0x800 /* Discard timer SERR# enable */ -#endif /* QEMU_PCI_BRIDGE_H */ +#endif /* QEMU_PCI_BRIDGE_H */ diff --git a/include/hw/pci/pci_ids.h b/include/hw/pci/pci_ids.h index db85afa..d77ca60 100644 --- a/include/hw/pci/pci_ids.h +++ b/include/hw/pci/pci_ids.h @@ -7,8 +7,9 @@ * * QEMU-specific definitions belong in pci.h */ + #ifndef HW_PCI_IDS_H -#define HW_PCI_IDS_H 1 +#define HW_PCI_IDS_H /* Device classes and subclasses */ diff --git a/include/hw/pcmcia.h b/include/hw/pcmcia.h index 98406ff..79cac9c 100644 --- a/include/hw/pcmcia.h +++ b/include/hw/pcmcia.h @@ -1,5 +1,5 @@ #ifndef HW_PCMCIA_H -#define HW_PCMCIA_H 1 +#define HW_PCMCIA_H /* PCMCIA/Cardbus */ diff --git a/include/hw/platform-bus.h b/include/hw/platform-bus.h index bd42b83..a00775c 100644 --- a/include/hw/platform-bus.h +++ b/include/hw/platform-bus.h @@ -1,5 +1,5 @@ #ifndef HW_PLATFORM_BUS_H -#define HW_PLATFORM_BUS_H 1 +#define HW_PLATFORM_BUS_H /* * Platform Bus device to support dynamic Sysbus devices @@ -54,4 +54,4 @@ int platform_bus_get_irqn(PlatformBusDevice *platform_bus, SysBusDevice *sbdev, hwaddr platform_bus_get_mmio_addr(PlatformBusDevice *pbus, SysBusDevice *sbdev, int n); -#endif /* !HW_PLATFORM_BUS_H */ +#endif /* HW_PLATFORM_BUS_H */ diff --git a/include/hw/ppc/mac_dbdma.h b/include/hw/ppc/mac_dbdma.h index d15a6cc..a860387 100644 --- a/include/hw/ppc/mac_dbdma.h +++ b/include/hw/ppc/mac_dbdma.h @@ -19,8 +19,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef HW_MAC_DBDMA_H -#define HW_MAC_DBDMA_H 1 +#define HW_MAC_DBDMA_H #include "exec/memory.h" #include "qemu/iov.h" diff --git a/include/hw/ppc/openpic.h b/include/hw/ppc/openpic.h index afe950b..6137e2d 100644 --- a/include/hw/ppc/openpic.h +++ b/include/hw/ppc/openpic.h @@ -1,5 +1,5 @@ -#if !defined(__OPENPIC_H__) -#define __OPENPIC_H__ +#ifndef OPENPIC_H +#define OPENPIC_H #include "qemu-common.h" #include "hw/qdev-core.h" @@ -30,4 +30,4 @@ enum { #define TYPE_KVM_OPENPIC "kvm-openpic" int kvm_openpic_connect_vcpu(DeviceState *d, CPUState *cs); -#endif /* __OPENPIC_H__ */ +#endif /* OPENPIC_H */ diff --git a/include/hw/ppc/ppc.h b/include/hw/ppc/ppc.h index 5617dc4..520c72a 100644 --- a/include/hw/ppc/ppc.h +++ b/include/hw/ppc/ppc.h @@ -1,5 +1,5 @@ #ifndef HW_PPC_H -#define HW_PPC_H 1 +#define HW_PPC_H #include "target-ppc/cpu-qom.h" diff --git a/include/hw/ppc/ppc4xx.h b/include/hw/ppc/ppc4xx.h index 91d84ba..3b01ae8 100644 --- a/include/hw/ppc/ppc4xx.h +++ b/include/hw/ppc/ppc4xx.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#if !defined(PPC_4XX_H) -#define PPC_4XX_H +#ifndef PPC4XX_H +#define PPC4XX_H #include "hw/pci/pci.h" @@ -61,4 +61,4 @@ PCIBus *ppc4xx_pci_init(CPUPPCState *env, qemu_irq pci_irqs[4], hwaddr special_cycle, hwaddr registers); -#endif /* !defined(PPC_4XX_H) */ +#endif /* PPC4XX_H */ diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h index 2e2dd14..bd8ac28 100644 --- a/include/hw/ppc/spapr.h +++ b/include/hw/ppc/spapr.h @@ -1,5 +1,5 @@ -#if !defined(__HW_SPAPR_H__) -#define __HW_SPAPR_H__ +#ifndef HW_SPAPR_H +#define HW_SPAPR_H #include "sysemu/dma.h" #include "hw/boards.h" @@ -648,4 +648,4 @@ int spapr_rng_populate_dt(void *fdt); #define SPAPR_LMB_FLAGS_DRC_INVALID 0x00000020 #define SPAPR_LMB_FLAGS_RESERVED 0x00000080 -#endif /* !defined (__HW_SPAPR_H__) */ +#endif /* HW_SPAPR_H */ diff --git a/include/hw/ppc/spapr_drc.h b/include/hw/ppc/spapr_drc.h index 08e8411..fa531d5 100644 --- a/include/hw/ppc/spapr_drc.h +++ b/include/hw/ppc/spapr_drc.h @@ -9,12 +9,13 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#if !defined(__HW_SPAPR_DRC_H__) -#define __HW_SPAPR_DRC_H__ +#ifndef HW_SPAPR_DRC_H +#define HW_SPAPR_DRC_H + +#include <libfdt.h> #include "qom/object.h" #include "hw/qdev.h" -#include "libfdt.h" #define TYPE_SPAPR_DR_CONNECTOR "spapr-dr-connector" #define SPAPR_DR_CONNECTOR_GET_CLASS(obj) \ @@ -202,4 +203,4 @@ sPAPRDRConnector *spapr_dr_connector_by_id(sPAPRDRConnectorType type, int spapr_drc_populate_dt(void *fdt, int fdt_offset, Object *owner, uint32_t drc_type_mask); -#endif /* __HW_SPAPR_DRC_H__ */ +#endif /* HW_SPAPR_DRC_H */ diff --git a/include/hw/ppc/spapr_vio.h b/include/hw/ppc/spapr_vio.h index bdb5d2f..d4a1e2c 100644 --- a/include/hw/ppc/spapr_vio.h +++ b/include/hw/ppc/spapr_vio.h @@ -1,5 +1,6 @@ -#ifndef _HW_SPAPR_VIO_H -#define _HW_SPAPR_VIO_H +#ifndef HW_SPAPR_VIO_H +#define HW_SPAPR_VIO_H + /* * QEMU sPAPR VIO bus definitions * @@ -145,4 +146,4 @@ extern const VMStateDescription vmstate_spapr_vio; void spapr_vio_set_bypass(VIOsPAPRDevice *dev, bool bypass); -#endif /* _HW_SPAPR_VIO_H */ +#endif /* HW_SPAPR_VIO_H */ diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 6189a3b..2db9f93 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -24,8 +24,9 @@ * THE SOFTWARE. * */ -#if !defined(__XICS_H__) -#define __XICS_H__ + +#ifndef XICS_H +#define XICS_H #include "hw/sysbus.h" @@ -196,4 +197,4 @@ void ics_set_irq_type(ICSState *ics, int srcno, bool lsi); int xics_find_source(XICSState *icp, int irq); -#endif /* __XICS_H__ */ +#endif /* XICS_H */ diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h index 034b75a..2a9d2f9 100644 --- a/include/hw/qdev-properties.h +++ b/include/hw/qdev-properties.h @@ -20,6 +20,7 @@ extern PropertyInfo qdev_prop_ptr; extern PropertyInfo qdev_prop_macaddr; extern PropertyInfo qdev_prop_on_off_auto; extern PropertyInfo qdev_prop_losttickpolicy; +extern PropertyInfo qdev_prop_blockdev_on_error; extern PropertyInfo qdev_prop_bios_chs_trans; extern PropertyInfo qdev_prop_fdc_drive_type; extern PropertyInfo qdev_prop_drive; @@ -161,6 +162,9 @@ extern PropertyInfo qdev_prop_arraylen; #define DEFINE_PROP_LOSTTICKPOLICY(_n, _s, _f, _d) \ DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_losttickpolicy, \ LostTickPolicy) +#define DEFINE_PROP_BLOCKDEV_ON_ERROR(_n, _s, _f, _d) \ + DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_blockdev_on_error, \ + BlockdevOnError) #define DEFINE_PROP_BIOS_CHS_TRANS(_n, _s, _f, _d) \ DEFINE_PROP_DEFAULT(_n, _s, _f, _d, qdev_prop_bios_chs_trans, int) #define DEFINE_PROP_BLOCKSIZE(_n, _s, _f) \ diff --git a/include/hw/s390x/css-bridge.h b/include/hw/s390x/css-bridge.h new file mode 100644 index 0000000..ad73c1f --- /dev/null +++ b/include/hw/s390x/css-bridge.h @@ -0,0 +1,31 @@ +/* + * virtual css bridge definition + * + * Copyright 2012,2016 IBM Corp. + * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> + * Pierre Morel <pmorel@linux.vnet.ibm.com> + * + * This work is licensed under the terms of the GNU GPL, version 2 or (at + * your option) any later version. See the COPYING file in the top-level + * directory. + */ + +#ifndef HW_S390X_CSS_BRIDGE_H +#define HW_S390X_CSS_BRIDGE_H +#include "qom/object.h" +#include "hw/qdev-core.h" + +/* virtual css bridge */ +#define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge" + +/* virtual css bus type */ +typedef struct VirtualCssBus { + BusState parent_obj; +} VirtualCssBus; + +#define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus" +#define VIRTUAL_CSS_BUS(obj) \ + OBJECT_CHECK(VirtualCssBus, (obj), TYPE_VIRTUAL_CSS_BUS) +VirtualCssBus *virtual_css_bus_init(void); + +#endif diff --git a/include/hw/s390x/css.h b/include/hw/s390x/css.h index 38f4d77..1da63e3 100644 --- a/include/hw/s390x/css.h +++ b/include/hw/s390x/css.h @@ -17,6 +17,7 @@ #include "hw/s390x/ioinst.h" /* Channel subsystem constants. */ +#define MAX_DEVNO 65535 #define MAX_SCHID 65535 #define MAX_SSID 3 #define MAX_CSSID 254 /* 255 is reserved */ @@ -24,6 +25,8 @@ #define MAX_CIWS 62 +#define VIRTUAL_CSSID 0xfe + typedef struct CIW { uint8_t type; uint8_t command; @@ -169,4 +172,19 @@ extern PropertyInfo css_devid_propinfo; #define DEFINE_PROP_CSS_DEV_ID(_n, _s, _f) \ DEFINE_PROP(_n, _s, _f, css_devid_propinfo, CssDevId) +/** + * Create a subchannel for the given bus id. + * + * If @p bus_id is valid, verify that it uses the virtual channel + * subsystem id and is not already in use, and find a free subchannel + * id for it. If @p bus_id is not valid, find a free subchannel id and + * device number across all subchannel sets. If either of the former + * actions succeed, allocate a subchannel structure, initialise it + * with the bus id, subchannel id and device number, register it with + * the CSS and return it. Otherwise return NULL. + * + * The caller becomes owner of the returned subchannel structure and + * is responsible for unregistering and freeing it. + */ +SubchDev *css_create_virtual_sch(CssDevId bus_id, Error **errp); #endif diff --git a/include/hw/s390x/ebcdic.h b/include/hw/s390x/ebcdic.h index 1d6fde9..69a04ca 100644 --- a/include/hw/s390x/ebcdic.h +++ b/include/hw/s390x/ebcdic.h @@ -9,8 +9,8 @@ * */ -#ifndef EBCDIC_H_ -#define EBCDIC_H_ +#ifndef EBCDIC_H +#define EBCDIC_H /* EBCDIC handling */ static const uint8_t ebcdic2ascii[] = { @@ -101,4 +101,4 @@ static inline void ascii_put(uint8_t *p, const char *ebcdic, int len) } } -#endif /* EBCDIC_H_ */ +#endif /* EBCDIC_H */ diff --git a/include/hw/s390x/event-facility.h b/include/hw/s390x/event-facility.h index dd88818..def1bb0 100644 --- a/include/hw/s390x/event-facility.h +++ b/include/hw/s390x/event-facility.h @@ -15,7 +15,7 @@ #ifndef HW_S390_SCLP_EVENT_FACILITY_H #define HW_S390_SCLP_EVENT_FACILITY_H -#include <hw/qdev.h> +#include "hw/qdev.h" #include "qemu/thread.h" #include "hw/s390x/sclp.h" diff --git a/include/hw/s390x/ioinst.h b/include/hw/s390x/ioinst.h index 12d44c8..c559f53 100644 --- a/include/hw/s390x/ioinst.h +++ b/include/hw/s390x/ioinst.h @@ -9,8 +9,8 @@ * directory. */ -#ifndef IOINST_S390X_H -#define IOINST_S390X_H +#ifndef S390X_IOINST_H +#define S390X_IOINST_H /* * Channel I/O related definitions, as defined in the Principles diff --git a/include/hw/s390x/s390_flic.h b/include/hw/s390x/s390_flic.h index 1dac2ee..9094eda 100644 --- a/include/hw/s390x/s390_flic.h +++ b/include/hw/s390x/s390_flic.h @@ -10,8 +10,8 @@ * directory. */ -#ifndef __HW_S390_FLIC_H -#define __HW_S390_FLIC_H +#ifndef HW_S390_FLIC_H +#define HW_S390_FLIC_H #include "hw/sysbus.h" #include "hw/s390x/adapter.h" @@ -78,4 +78,4 @@ static inline DeviceState *s390_flic_kvm_create(void) } #endif -#endif /* __HW_S390_FLIC_H */ +#endif /* HW_S390_FLIC_H */ diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index b0c71b5..ba28d1d 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -14,8 +14,8 @@ #ifndef HW_S390_SCLP_H #define HW_S390_SCLP_H -#include <hw/sysbus.h> -#include <hw/qdev.h> +#include "hw/sysbus.h" +#include "hw/qdev.h" #define SCLP_CMD_CODE_MASK 0xffff00ff @@ -58,6 +58,7 @@ #define SCLP_RC_CONTAINED_EQUIPMENT_CHECK 0x0340 #define SCLP_RC_INSUFFICIENT_SCCB_LENGTH 0x0300 #define SCLP_RC_STANDBY_READ_COMPLETION 0x0410 +#define SCLP_RC_ADAPTER_IN_RESERVED_STATE 0x05f0 #define SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED 0x09f0 #define SCLP_RC_INVALID_FUNCTION 0x40f0 #define SCLP_RC_NO_EVENT_BUFFERS_STORED 0x60f0 diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index 72b850c..62df48e 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -9,10 +9,10 @@ * directory. */ -#ifndef __S390_STORAGE_KEYS_H -#define __S390_STORAGE_KEYS_H +#ifndef S390_STORAGE_KEYS_H +#define S390_STORAGE_KEYS_H -#include <hw/qdev.h> +#include "hw/qdev.h" #include "monitor/monitor.h" #define TYPE_S390_SKEYS "s390-skeys" @@ -57,4 +57,4 @@ S390SKeysState *s390_get_skeys_device(void); void hmp_dump_skeys(Monitor *mon, const QDict *qdict); void hmp_info_skeys(Monitor *mon, const QDict *qdict); -#endif /* __S390_STORAGE_KEYS_H */ +#endif /* S390_STORAGE_KEYS_H */ diff --git a/include/hw/sd/sd.h b/include/hw/sd/sd.h index c8a4b98..79909b2 100644 --- a/include/hw/sd/sd.h +++ b/include/hw/sd/sd.h @@ -26,8 +26,9 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef __hw_sd_h -#define __hw_sd_h 1 + +#ifndef HW_SD_H +#define HW_SD_H #include "hw/qdev.h" @@ -144,4 +145,4 @@ bool sdbus_get_readonly(SDBus *sd); void sdbus_set_inserted(SDBus *sd, bool inserted); void sdbus_set_readonly(SDBus *sd, bool inserted); -#endif /* __hw_sd_h */ +#endif /* HW_SD_H */ diff --git a/include/hw/sh4/sh_intc.h b/include/hw/sh4/sh_intc.h index b7ddcb0..7913bc4 100644 --- a/include/hw/sh4/sh_intc.h +++ b/include/hw/sh4/sh_intc.h @@ -1,5 +1,5 @@ -#ifndef __SH_INTC_H__ -#define __SH_INTC_H__ +#ifndef SH_INTC_H +#define SH_INTC_H #include "qemu-common.h" #include "hw/irq.h" @@ -80,4 +80,4 @@ int sh_intc_init(MemoryRegion *sysmem, void sh_intc_set_irl(void *opaque, int n, int level); -#endif /* __SH_INTC_H__ */ +#endif /* SH_INTC_H */ diff --git a/include/hw/smbios/smbios.h b/include/hw/smbios/smbios.h index ba36746..1cd53cc 100644 --- a/include/hw/smbios/smbios.h +++ b/include/hw/smbios/smbios.h @@ -1,5 +1,6 @@ #ifndef QEMU_SMBIOS_H #define QEMU_SMBIOS_H + /* * SMBIOS Support * @@ -266,4 +267,4 @@ void smbios_get_tables(const struct smbios_phys_mem_area *mem_array, const unsigned int mem_array_size, uint8_t **tables, size_t *tables_len, uint8_t **anchor, size_t *anchor_len); -#endif /*QEMU_SMBIOS_H */ +#endif /* QEMU_SMBIOS_H */ diff --git a/include/hw/sparc/grlib.h b/include/hw/sparc/grlib.h index 9a0db7b..afbb9bc 100644 --- a/include/hw/sparc/grlib.h +++ b/include/hw/sparc/grlib.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#ifndef _GRLIB_H_ -#define _GRLIB_H_ +#ifndef GRLIB_H +#define GRLIB_H #include "hw/qdev.h" #include "hw/sysbus.h" @@ -117,4 +117,4 @@ DeviceState *grlib_apbuart_create(hwaddr base, return dev; } -#endif /* ! _GRLIB_H_ */ +#endif /* GRLIB_H */ diff --git a/include/hw/ssi/xilinx_spips.h b/include/hw/ssi/xilinx_spips.h index dbb9eef..06aa096 100644 --- a/include/hw/ssi/xilinx_spips.h +++ b/include/hw/ssi/xilinx_spips.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#ifndef XLNX_SPIPS_H -#define XLNX_SPIPS_H +#ifndef XILINX_SPIPS_H +#define XILINX_SPIPS_H #include "hw/ssi/ssi.h" #include "qemu/fifo8.h" @@ -69,4 +69,4 @@ struct XilinxSPIPS { #define XILINX_QSPIPS(obj) \ OBJECT_CHECK(XilinxQSPIPS, (obj), TYPE_XILINX_QSPIPS) -#endif /* XLNX_SPIPS_H */ +#endif /* XILINX_SPIPS_H */ diff --git a/include/hw/stream.h b/include/hw/stream.h index 30ccc56..c370ba0 100644 --- a/include/hw/stream.h +++ b/include/hw/stream.h @@ -1,5 +1,5 @@ #ifndef STREAM_H -#define STREAM_H 1 +#define STREAM_H #include "qemu-common.h" #include "qom/object.h" diff --git a/include/hw/sysbus.h b/include/hw/sysbus.h index a495937..e73a5b2 100644 --- a/include/hw/sysbus.h +++ b/include/hw/sysbus.h @@ -1,5 +1,5 @@ #ifndef HW_SYSBUS_H -#define HW_SYSBUS_H 1 +#define HW_SYSBUS_H /* Devices attached directly to the main system bus. */ @@ -118,4 +118,4 @@ static inline DeviceState *sysbus_try_create_simple(const char *name, return sysbus_try_create_varargs(name, addr, irq, NULL); } -#endif /* !HW_SYSBUS_H */ +#endif /* HW_SYSBUS_H */ diff --git a/include/hw/timer/a9gtimer.h b/include/hw/timer/a9gtimer.h index 98d8e0a..81c4388 100644 --- a/include/hw/timer/a9gtimer.h +++ b/include/hw/timer/a9gtimer.h @@ -20,8 +20,8 @@ * with this program; if not, see <http://www.gnu.org/licenses/>. */ -#ifndef HW_TIMER_A9_GTIMER_H_H -#define HW_TIMER_A9_GTIMER_H_H +#ifndef A9GTIMER_H +#define A9GTIMER_H #include "hw/sysbus.h" @@ -94,4 +94,4 @@ typedef struct A9GTimerUpdate { uint64_t new; } A9GTimerUpdate; -#endif /* #ifdef HW_TIMER_A9_GTIMER_H_H */ +#endif /* A9GTIMER_H */ diff --git a/include/hw/timer/allwinner-a10-pit.h b/include/hw/timer/allwinner-a10-pit.h index 770bdc0..c0cc3e2 100644 --- a/include/hw/timer/allwinner-a10-pit.h +++ b/include/hw/timer/allwinner-a10-pit.h @@ -1,5 +1,5 @@ -#ifndef AW_A10_PIT_H -#define AW_A10_PIT_H +#ifndef ALLWINNER_A10_PIT_H +#define ALLWINNER_A10_PIT_H #include "hw/ptimer.h" diff --git a/include/hw/timer/hpet.h b/include/hw/timer/hpet.h index f38bcfe..f04c4d3 100644 --- a/include/hw/timer/hpet.h +++ b/include/hw/timer/hpet.h @@ -10,8 +10,9 @@ * the COPYING file in the top-level directory. * */ -#ifndef QEMU_HPET_EMUL_H -#define QEMU_HPET_EMUL_H + +#ifndef HW_HPET_H +#define HW_HPET_H #include "qom/object.h" diff --git a/include/hw/timer/i8254.h b/include/hw/timer/i8254.h index 27a0fb6..5adae9f 100644 --- a/include/hw/timer/i8254.h +++ b/include/hw/timer/i8254.h @@ -80,4 +80,4 @@ static inline ISADevice *kvm_pit_init(ISABus *bus, int base) void pit_set_gate(ISADevice *dev, int channel, int val); void pit_get_channel_info(ISADevice *dev, int channel, PITChannelInfo *info); -#endif /* !HW_I8254_H */ +#endif /* HW_I8254_H */ diff --git a/include/hw/timer/i8254_internal.h b/include/hw/timer/i8254_internal.h index e7cb757..dc09cc0 100644 --- a/include/hw/timer/i8254_internal.h +++ b/include/hw/timer/i8254_internal.h @@ -73,4 +73,4 @@ void pit_get_channel_info_common(PITCommonState *s, PITChannelState *sc, PITChannelInfo *info); void pit_reset_common(PITCommonState *s); -#endif /* !QEMU_I8254_INTERNAL_H */ +#endif /* QEMU_I8254_INTERNAL_H */ diff --git a/include/hw/timer/m48t59.h b/include/hw/timer/m48t59.h index 3367923..db5e43a 100644 --- a/include/hw/timer/m48t59.h +++ b/include/hw/timer/m48t59.h @@ -1,5 +1,5 @@ -#ifndef NVRAM_H -#define NVRAM_H +#ifndef HW_M48T59_H +#define HW_M48T59_H #include "qemu-common.h" #include "qom/object.h" @@ -31,4 +31,4 @@ Nvram *m48t59_init(qemu_irq IRQ, hwaddr mem_base, uint32_t io_base, uint16_t size, int base_year, int type); -#endif /* !NVRAM_H */ +#endif /* HW_M48T59_H */ diff --git a/include/hw/timer/mc146818rtc.h b/include/hw/timer/mc146818rtc.h index eaf6497..7c8e64b 100644 --- a/include/hw/timer/mc146818rtc.h +++ b/include/hw/timer/mc146818rtc.h @@ -10,4 +10,4 @@ ISADevice *rtc_init(ISABus *bus, int base_year, qemu_irq intercept_irq); void rtc_set_memory(ISADevice *dev, int addr, int val); int rtc_get_memory(ISADevice *dev, int addr); -#endif /* !MC146818RTC_H */ +#endif /* MC146818RTC_H */ diff --git a/include/hw/timer/mc146818rtc_regs.h b/include/hw/timer/mc146818rtc_regs.h index ccdee42..6ede6c8 100644 --- a/include/hw/timer/mc146818rtc_regs.h +++ b/include/hw/timer/mc146818rtc_regs.h @@ -21,8 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#ifndef RTC_REGS_H -#define RTC_REGS_H + +#ifndef MC146818RTC_REGS_H +#define MC146818RTC_REGS_H #define RTC_ISA_IRQ 8 diff --git a/include/hw/timer/mips_gictimer.h b/include/hw/timer/mips_gictimer.h new file mode 100644 index 0000000..c8bc5d2 --- /dev/null +++ b/include/hw/timer/mips_gictimer.h @@ -0,0 +1,46 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 2016 Imagination Technologies + * + */ + +#ifndef MIPS_GICTIMER_H +#define MIPS_GICTIMER_H + +typedef struct MIPSGICTimerVPState MIPSGICTimerVPState; +typedef struct MIPSGICTimerState MIPSGICTimerState; + +typedef void MIPSGICTimerCB(void *opaque, uint32_t vp_index); + +struct MIPSGICTimerVPState { + QEMUTimer *qtimer; + uint32_t vp_index; + uint32_t comparelo; + MIPSGICTimerState *gictimer; +}; + +struct MIPSGICTimerState { + void *opaque; + uint8_t countstop; + uint32_t sh_counterlo; + int32_t num_vps; + MIPSGICTimerVPState *vptimers; + MIPSGICTimerCB *cb; +}; + +uint32_t mips_gictimer_get_sh_count(MIPSGICTimerState *gic); +void mips_gictimer_store_sh_count(MIPSGICTimerState *gic, uint64_t count); +uint32_t mips_gictimer_get_vp_compare(MIPSGICTimerState *gictimer, + uint32_t vp_index); +void mips_gictimer_store_vp_compare(MIPSGICTimerState *gic, uint32_t vp_index, + uint64_t compare); +uint8_t mips_gictimer_get_countstop(MIPSGICTimerState *gic); +void mips_gictimer_start_count(MIPSGICTimerState *gic); +void mips_gictimer_stop_count(MIPSGICTimerState *gic); +MIPSGICTimerState *mips_gictimer_init(void *opaque, uint32_t nvps, + MIPSGICTimerCB *cb); + +#endif /* MIPS_GICTIMER_H */ diff --git a/include/hw/tricore/tricore.h b/include/hw/tricore/tricore.h index 5f132527..89ef922 100644 --- a/include/hw/tricore/tricore.h +++ b/include/hw/tricore/tricore.h @@ -1,5 +1,5 @@ -#ifndef TRICORE_MISC_H -#define TRICORE_MISC_H 1 +#ifndef HW_TRICORE_H +#define HW_TRICORE_H #include "exec/memory.h" #include "hw/irq.h" diff --git a/include/hw/unicore32/puv3.h b/include/hw/unicore32/puv3.h index f37adcb..5a4839f 100644 --- a/include/hw/unicore32/puv3.h +++ b/include/hw/unicore32/puv3.h @@ -8,6 +8,7 @@ * published by the Free Software Foundation, or any later version. * See the COPYING file in the top-level directory. */ + #ifndef QEMU_HW_PUV3_H #define QEMU_HW_PUV3_H @@ -46,4 +47,4 @@ #define DPRINTF(fmt, ...) do {} while (0) #endif -#endif /* !QEMU_HW_PUV3_H */ +#endif /* QEMU_HW_PUV3_H */ diff --git a/include/hw/usb/ehci-regs.h b/include/hw/usb/ehci-regs.h index 616f1b8..3e91b8e 100644 --- a/include/hw/usb/ehci-regs.h +++ b/include/hw/usb/ehci-regs.h @@ -1,5 +1,5 @@ #ifndef HW_USB_EHCI_REGS_H -#define HW_USB_EHCI_REGS_H 1 +#define HW_USB_EHCI_REGS_H /* Capability Registers Base Address - section 2.2 */ #define CAPLENGTH 0x0000 /* 1-byte, 0x0001 reserved */ diff --git a/include/hw/usb/uhci-regs.h b/include/hw/usb/uhci-regs.h index c7315c5..fd45d29 100644 --- a/include/hw/usb/uhci-regs.h +++ b/include/hw/usb/uhci-regs.h @@ -1,5 +1,5 @@ #ifndef HW_USB_UHCI_REGS_H -#define HW_USB_UHCI_REGS_H 1 +#define HW_USB_UHCI_REGS_H #define UHCI_CMD_FGR (1 << 4) #define UHCI_CMD_EGSM (1 << 3) diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 07f7188..94dfae3 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -17,6 +17,7 @@ * Copyright (C) 2008, Red Hat, Amit Shah (amit.shah@redhat.com) * Copyright (C) 2008, IBM, Muli Ben-Yehuda (muli@il.ibm.com) */ + #ifndef HW_VFIO_VFIO_COMMON_H #define HW_VFIO_VFIO_COMMON_H @@ -174,4 +175,4 @@ int vfio_spapr_create_window(VFIOContainer *container, int vfio_spapr_remove_window(VFIOContainer *container, hwaddr offset_within_address_space); -#endif /* !HW_VFIO_VFIO_COMMON_H */ +#endif /* HW_VFIO_VFIO_COMMON_H */ diff --git a/include/hw/vfio/vfio-platform.h b/include/hw/vfio/vfio-platform.h index b468f80..9baaa2db 100644 --- a/include/hw/vfio/vfio-platform.h +++ b/include/hw/vfio/vfio-platform.h @@ -74,4 +74,4 @@ typedef struct VFIOPlatformDeviceClass { #define VFIO_PLATFORM_DEVICE_GET_CLASS(obj) \ OBJECT_GET_CLASS(VFIOPlatformDeviceClass, (obj), TYPE_VFIO_PLATFORM) -#endif /*HW_VFIO_VFIO_PLATFORM_H*/ +#endif /* HW_VFIO_VFIO_PLATFORM_H */ diff --git a/include/hw/vfio/vfio.h b/include/hw/vfio/vfio.h index f27d599..86248f54 100644 --- a/include/hw/vfio/vfio.h +++ b/include/hw/vfio/vfio.h @@ -1,5 +1,5 @@ -#ifndef VFIO_API_H -#define VFIO_API_H +#ifndef HW_VFIO_H +#define HW_VFIO_H bool vfio_eeh_as_ok(AddressSpace *as); int vfio_eeh_as_op(AddressSpace *as, uint32_t op); diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-backend.h index 84e1cb7..cf7f0b5 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -8,9 +8,8 @@ * */ -#ifndef VHOST_BACKEND_H_ -#define VHOST_BACKEND_H_ - +#ifndef VHOST_BACKEND_H +#define VHOST_BACKEND_H typedef enum VhostBackendType { VHOST_BACKEND_TYPE_NONE = 0, @@ -110,4 +109,4 @@ extern const VhostOps user_ops; int vhost_set_backend_type(struct vhost_dev *dev, VhostBackendType backend_type); -#endif /* VHOST_BACKEND_H_ */ +#endif /* VHOST_BACKEND_H */ diff --git a/include/hw/virtio/virtio-access.h b/include/hw/virtio/virtio-access.h index 4b28038..440b455 100644 --- a/include/hw/virtio/virtio-access.h +++ b/include/hw/virtio/virtio-access.h @@ -12,8 +12,10 @@ * (at your option) any later version. * */ -#ifndef _QEMU_VIRTIO_ACCESS_H -#define _QEMU_VIRTIO_ACCESS_H + +#ifndef QEMU_VIRTIO_ACCESS_H +#define QEMU_VIRTIO_ACCESS_H + #include "hw/virtio/virtio.h" #include "exec/address-spaces.h" @@ -175,4 +177,4 @@ static inline void virtio_tswap64s(VirtIODevice *vdev, uint64_t *s) { *s = virtio_tswap64(vdev, *s); } -#endif /* _QEMU_VIRTIO_ACCESS_H */ +#endif /* QEMU_VIRTIO_ACCESS_H */ diff --git a/include/hw/virtio/virtio-balloon.h b/include/hw/virtio/virtio-balloon.h index 35f62ac..1ea13bd 100644 --- a/include/hw/virtio/virtio-balloon.h +++ b/include/hw/virtio/virtio-balloon.h @@ -12,8 +12,8 @@ * */ -#ifndef _QEMU_VIRTIO_BALLOON_H -#define _QEMU_VIRTIO_BALLOON_H +#ifndef QEMU_VIRTIO_BALLOON_H +#define QEMU_VIRTIO_BALLOON_H #include "standard-headers/linux/virtio_balloon.h" #include "hw/virtio/virtio.h" diff --git a/include/hw/virtio/virtio-blk.h b/include/hw/virtio/virtio-blk.h index e9bf463..180bd8d 100644 --- a/include/hw/virtio/virtio-blk.h +++ b/include/hw/virtio/virtio-blk.h @@ -11,8 +11,8 @@ * */ -#ifndef _QEMU_VIRTIO_BLK_H -#define _QEMU_VIRTIO_BLK_H +#ifndef QEMU_VIRTIO_BLK_H +#define QEMU_VIRTIO_BLK_H #include "standard-headers/linux/virtio_blk.h" #include "hw/virtio/virtio.h" diff --git a/include/hw/virtio/virtio-gpu.h b/include/hw/virtio/virtio-gpu.h index 3dff0c9..325354f 100644 --- a/include/hw/virtio/virtio-gpu.h +++ b/include/hw/virtio/virtio-gpu.h @@ -11,8 +11,8 @@ * See the COPYING file in the top-level directory. */ -#ifndef _QEMU_VIRTIO_VGA_H -#define _QEMU_VIRTIO_VGA_H +#ifndef HW_VIRTIO_GPU_H +#define HW_VIRTIO_GPU_H #include "qemu/queue.h" #include "ui/qemu-pixman.h" diff --git a/include/hw/virtio/virtio-input.h b/include/hw/virtio/virtio-input.h index bddbd4b..55db310 100644 --- a/include/hw/virtio/virtio-input.h +++ b/include/hw/virtio/virtio-input.h @@ -1,5 +1,5 @@ -#ifndef _QEMU_VIRTIO_INPUT_H -#define _QEMU_VIRTIO_INPUT_H +#ifndef QEMU_VIRTIO_INPUT_H +#define QEMU_VIRTIO_INPUT_H #include "ui/input.h" @@ -105,4 +105,4 @@ void virtio_input_add_config(VirtIOInput *vinput, void virtio_input_idstr_config(VirtIOInput *vinput, uint8_t select, const char *string); -#endif /* _QEMU_VIRTIO_INPUT_H */ +#endif /* QEMU_VIRTIO_INPUT_H */ diff --git a/include/hw/virtio/virtio-net.h b/include/hw/virtio/virtio-net.h index 0cabdb6..91ed97c 100644 --- a/include/hw/virtio/virtio-net.h +++ b/include/hw/virtio/virtio-net.h @@ -11,8 +11,8 @@ * */ -#ifndef _QEMU_VIRTIO_NET_H -#define _QEMU_VIRTIO_NET_H +#ifndef QEMU_VIRTIO_NET_H +#define QEMU_VIRTIO_NET_H #include "standard-headers/linux/virtio_net.h" #include "hw/virtio/virtio.h" diff --git a/include/hw/virtio/virtio-rng.h b/include/hw/virtio/virtio-rng.h index 2bc1ee5..2d40abd 100644 --- a/include/hw/virtio/virtio-rng.h +++ b/include/hw/virtio/virtio-rng.h @@ -9,8 +9,8 @@ * top-level directory. */ -#ifndef _QEMU_VIRTIO_RNG_H -#define _QEMU_VIRTIO_RNG_H +#ifndef QEMU_VIRTIO_RNG_H +#define QEMU_VIRTIO_RNG_H #include "sysemu/rng.h" #include "sysemu/rng-random.h" diff --git a/include/hw/virtio/virtio-scsi.h b/include/hw/virtio/virtio-scsi.h index b515669..5e3f088 100644 --- a/include/hw/virtio/virtio-scsi.h +++ b/include/hw/virtio/virtio-scsi.h @@ -11,8 +11,8 @@ * */ -#ifndef _QEMU_VIRTIO_SCSI_H -#define _QEMU_VIRTIO_SCSI_H +#ifndef QEMU_VIRTIO_SCSI_H +#define QEMU_VIRTIO_SCSI_H /* Override CDB/sense data size: they are dynamic (guest controlled) in QEMU */ #define VIRTIO_SCSI_CDB_SIZE 0 @@ -141,4 +141,4 @@ void virtio_scsi_dataplane_start(VirtIOSCSI *s); void virtio_scsi_dataplane_stop(VirtIOSCSI *s); void virtio_scsi_dataplane_notify(VirtIODevice *vdev, VirtIOSCSIReq *req); -#endif /* _QEMU_VIRTIO_SCSI_H */ +#endif /* QEMU_VIRTIO_SCSI_H */ diff --git a/include/hw/virtio/virtio-serial.h b/include/hw/virtio/virtio-serial.h index 12a55a1..730c88d 100644 --- a/include/hw/virtio/virtio-serial.h +++ b/include/hw/virtio/virtio-serial.h @@ -12,8 +12,9 @@ * the COPYING file in the top-level directory. * */ -#ifndef _QEMU_VIRTIO_SERIAL_H -#define _QEMU_VIRTIO_SERIAL_H + +#ifndef QEMU_VIRTIO_SERIAL_H +#define QEMU_VIRTIO_SERIAL_H #include "standard-headers/linux/virtio_console.h" #include "hw/qdev.h" diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index 96b581d..8a681f5 100644 --- a/include/hw/virtio/virtio.h +++ b/include/hw/virtio/virtio.h @@ -11,8 +11,8 @@ * */ -#ifndef _QEMU_VIRTIO_H -#define _QEMU_VIRTIO_H +#ifndef QEMU_VIRTIO_H +#define QEMU_VIRTIO_H #include "hw/hw.h" #include "net/net.h" diff --git a/include/hw/watchdog/wdt_diag288.h b/include/hw/watchdog/wdt_diag288.h index 7f3fd45..706d96b 100644 --- a/include/hw/watchdog/wdt_diag288.h +++ b/include/hw/watchdog/wdt_diag288.h @@ -33,4 +33,4 @@ typedef struct DIAG288Class { uint64_t func, uint64_t timeout); } DIAG288Class; -#endif /* WDT_DIAG288_H */ +#endif /* WDT_DIAG288_H */ diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index b2cd992..a8f3afb 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -1,5 +1,6 @@ #ifndef QEMU_HW_XEN_H -#define QEMU_HW_XEN_H 1 +#define QEMU_HW_XEN_H + /* * public xen header * stuff needed outside xen-*.c, i.e. interfaces to qemu. diff --git a/include/hw/xen/xen_backend.h b/include/hw/xen/xen_backend.h index 6e18a46..754c0a4 100644 --- a/include/hw/xen/xen_backend.h +++ b/include/hw/xen/xen_backend.h @@ -1,5 +1,5 @@ #ifndef QEMU_HW_XEN_BACKEND_H -#define QEMU_HW_XEN_BACKEND_H 1 +#define QEMU_HW_XEN_BACKEND_H #include "hw/xen/xen_common.h" #include "sysemu/sysemu.h" diff --git a/include/hw/xen/xen_common.h b/include/hw/xen/xen_common.h index 5eabf37..640c31e 100644 --- a/include/hw/xen/xen_common.h +++ b/include/hw/xen/xen_common.h @@ -1,7 +1,5 @@ #ifndef QEMU_HW_XEN_COMMON_H -#define QEMU_HW_XEN_COMMON_H 1 - - +#define QEMU_HW_XEN_COMMON_H /* * If we have new enough libxenctrl then we do not want/need these compat diff --git a/include/io/channel-buffer.h b/include/io/channel-buffer.h index 65c498b..3f4b3f2 100644 --- a/include/io/channel-buffer.h +++ b/include/io/channel-buffer.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_BUFFER_H__ -#define QIO_CHANNEL_BUFFER_H__ +#ifndef QIO_CHANNEL_BUFFER_H +#define QIO_CHANNEL_BUFFER_H #include "io/channel.h" @@ -57,4 +57,4 @@ struct QIOChannelBuffer { QIOChannelBuffer * qio_channel_buffer_new(size_t capacity); -#endif /* QIO_CHANNEL_BUFFER_H__ */ +#endif /* QIO_CHANNEL_BUFFER_H */ diff --git a/include/io/channel-command.h b/include/io/channel-command.h index cfc177e..336d47f 100644 --- a/include/io/channel-command.h +++ b/include/io/channel-command.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_COMMAND_H__ -#define QIO_CHANNEL_COMMAND_H__ +#ifndef QIO_CHANNEL_COMMAND_H +#define QIO_CHANNEL_COMMAND_H #include "io/channel.h" @@ -88,4 +88,4 @@ qio_channel_command_new_spawn(const char *const argv[], Error **errp); -#endif /* QIO_CHANNEL_COMMAND_H__ */ +#endif /* QIO_CHANNEL_COMMAND_H */ diff --git a/include/io/channel-file.h b/include/io/channel-file.h index 308e6d4..d2462c2 100644 --- a/include/io/channel-file.h +++ b/include/io/channel-file.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_FILE_H__ -#define QIO_CHANNEL_FILE_H__ +#ifndef QIO_CHANNEL_FILE_H +#define QIO_CHANNEL_FILE_H #include "io/channel.h" @@ -90,4 +90,4 @@ qio_channel_file_new_path(const char *path, mode_t mode, Error **errp); -#endif /* QIO_CHANNEL_FILE_H__ */ +#endif /* QIO_CHANNEL_FILE_H */ diff --git a/include/io/channel-socket.h b/include/io/channel-socket.h index 70d06b4..711f8bf 100644 --- a/include/io/channel-socket.h +++ b/include/io/channel-socket.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_SOCKET_H__ -#define QIO_CHANNEL_SOCKET_H__ +#ifndef QIO_CHANNEL_SOCKET_H +#define QIO_CHANNEL_SOCKET_H #include "io/channel.h" #include "io/task.h" @@ -248,4 +248,4 @@ qio_channel_socket_accept(QIOChannelSocket *ioc, Error **errp); -#endif /* QIO_CHANNEL_SOCKET_H__ */ +#endif /* QIO_CHANNEL_SOCKET_H */ diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h index 322eccb..d157eb1 100644 --- a/include/io/channel-tls.h +++ b/include/io/channel-tls.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_TLS_H__ -#define QIO_CHANNEL_TLS_H__ +#ifndef QIO_CHANNEL_TLS_H +#define QIO_CHANNEL_TLS_H #include "io/channel.h" #include "io/task.h" @@ -139,4 +139,4 @@ void qio_channel_tls_handshake(QIOChannelTLS *ioc, QCryptoTLSSession * qio_channel_tls_get_session(QIOChannelTLS *ioc); -#endif /* QIO_CHANNEL_TLS_H__ */ +#endif /* QIO_CHANNEL_TLS_H */ diff --git a/include/io/channel-util.h b/include/io/channel-util.h index c93af828..c0b79cf 100644 --- a/include/io/channel-util.h +++ b/include/io/channel-util.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_UTIL_H__ -#define QIO_CHANNEL_UTIL_H__ +#ifndef QIO_CHANNEL_UTIL_H +#define QIO_CHANNEL_UTIL_H #include "io/channel.h" @@ -49,4 +49,4 @@ QIOChannel *qio_channel_new_fd(int fd, Error **errp); -#endif /* QIO_CHANNEL_UTIL_H__ */ +#endif /* QIO_CHANNEL_UTIL_H */ diff --git a/include/io/channel-watch.h b/include/io/channel-watch.h index 76d7642..63bc4ae 100644 --- a/include/io/channel-watch.h +++ b/include/io/channel-watch.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_WATCH_H__ -#define QIO_CHANNEL_WATCH_H__ +#ifndef QIO_CHANNEL_WATCH_H +#define QIO_CHANNEL_WATCH_H #include "io/channel.h" @@ -87,4 +87,4 @@ GSource *qio_channel_create_fd_pair_watch(QIOChannel *ioc, int fdwrite, GIOCondition condition); -#endif /* QIO_CHANNEL_WATCH_H__ */ +#endif /* QIO_CHANNEL_WATCH_H */ diff --git a/include/io/channel-websock.h b/include/io/channel-websock.h index 0dc21cc..3c9ff84 100644 --- a/include/io/channel-websock.h +++ b/include/io/channel-websock.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_WEBSOCK_H__ -#define QIO_CHANNEL_WEBSOCK_H__ +#ifndef QIO_CHANNEL_WEBSOCK_H +#define QIO_CHANNEL_WEBSOCK_H #include "io/channel.h" #include "qemu/buffer.h" @@ -105,4 +105,4 @@ void qio_channel_websock_handshake(QIOChannelWebsock *ioc, gpointer opaque, GDestroyNotify destroy); -#endif /* QIO_CHANNEL_WEBSOCK_H__ */ +#endif /* QIO_CHANNEL_WEBSOCK_H */ diff --git a/include/io/channel.h b/include/io/channel.h index e52f059..752e89f 100644 --- a/include/io/channel.h +++ b/include/io/channel.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_CHANNEL_H__ -#define QIO_CHANNEL_H__ +#ifndef QIO_CHANNEL_H +#define QIO_CHANNEL_H #include "qemu-common.h" #include "qom/object.h" @@ -502,4 +502,4 @@ void qio_channel_yield(QIOChannel *ioc, void qio_channel_wait(QIOChannel *ioc, GIOCondition condition); -#endif /* QIO_CHANNEL_H__ */ +#endif /* QIO_CHANNEL_H */ diff --git a/include/io/task.h b/include/io/task.h index df9499a..42028cb 100644 --- a/include/io/task.h +++ b/include/io/task.h @@ -18,8 +18,8 @@ * */ -#ifndef QIO_TASK_H__ -#define QIO_TASK_H__ +#ifndef QIO_TASK_H +#define QIO_TASK_H #include "qemu-common.h" #include "qom/object.h" @@ -252,4 +252,4 @@ void qio_task_abort(QIOTask *task, */ Object *qio_task_get_source(QIOTask *task); -#endif /* QIO_TASK_H__ */ +#endif /* QIO_TASK_H */ diff --git a/include/libdecnumber/decContext.h b/include/libdecnumber/decContext.h index 01365e2..cea6e42 100644 --- a/include/libdecnumber/decContext.h +++ b/include/libdecnumber/decContext.h @@ -50,8 +50,9 @@ /* */ /* ------------------------------------------------------------------ */ -#if !defined(DECCONTEXT) - #define DECCONTEXT +#ifndef DECCONTEXT_H +#define DECCONTEXT_H + #define DECCNAME "decContext" /* Short name */ #define DECCFULLNAME "Decimal Context Descriptor" /* Verbose name */ #define DECCAUTHOR "Mike Cowlishaw" /* Who to blame */ diff --git a/include/libdecnumber/decNumber.h b/include/libdecnumber/decNumber.h index 9fa4e6a..aa115fe 100644 --- a/include/libdecnumber/decNumber.h +++ b/include/libdecnumber/decNumber.h @@ -32,15 +32,14 @@ /* Decimal Number arithmetic module header */ /* ------------------------------------------------------------------ */ -#if !defined(DECNUMBER) - #define DECNUMBER +#ifndef DECNUMBER_H +#define DECNUMBER_H + #define DECNAME "decNumber" /* Short name */ #define DECFULLNAME "Decimal Number Module" /* Verbose name */ #define DECAUTHOR "Mike Cowlishaw" /* Who to blame */ - #if !defined(DECCONTEXT) - #include "libdecnumber/decContext.h" - #endif + #include "libdecnumber/decContext.h" /* Bit settings for decNumber.bits */ #define DECNEG 0x80 /* Sign; 1=negative, 0=positive or zero */ diff --git a/include/libdecnumber/decNumberLocal.h b/include/libdecnumber/decNumberLocal.h index 94fb512..12cf1d8 100644 --- a/include/libdecnumber/decNumberLocal.h +++ b/include/libdecnumber/decNumberLocal.h @@ -37,8 +37,9 @@ /* decNumber.h or one of decDouble (etc.) must be included first. */ /* ------------------------------------------------------------------ */ -#if !defined(DECNUMBERLOC) - #define DECNUMBERLOC +#ifndef DECNUMBERLOCAL_H +#define DECNUMBERLOCAL_H + #define DECVERSION "decNumber 3.53" /* Package Version [16 max.] */ #define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */ @@ -658,6 +659,4 @@ /* [end of format-dependent macros and constants] */ #endif -#else - #error decNumberLocal included more than once #endif diff --git a/include/libdecnumber/dpd/decimal128.h b/include/libdecnumber/dpd/decimal128.h index 7d9ee24..aff261e 100644 --- a/include/libdecnumber/dpd/decimal128.h +++ b/include/libdecnumber/dpd/decimal128.h @@ -32,8 +32,9 @@ /* Decimal 128-bit format module header */ /* ------------------------------------------------------------------ */ -#if !defined(DECIMAL128) - #define DECIMAL128 +#ifndef DECIMAL128_H +#define DECIMAL128_H + #define DEC128NAME "decimal128" /* Short name */ #define DEC128FULLNAME "Decimal 128-bit Number" /* Verbose name */ #define DEC128AUTHOR "Mike Cowlishaw" /* Who to blame */ @@ -59,9 +60,7 @@ #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL128_Pmax /* size if not already defined*/ #endif - #ifndef DECNUMBER - #include "libdecnumber/decNumber.h" - #endif + #include "libdecnumber/decNumber.h" /* Decimal 128-bit type, accessible by bytes */ typedef struct { diff --git a/include/libdecnumber/dpd/decimal32.h b/include/libdecnumber/dpd/decimal32.h index de313e0..6cb9e43 100644 --- a/include/libdecnumber/dpd/decimal32.h +++ b/include/libdecnumber/dpd/decimal32.h @@ -32,8 +32,9 @@ /* Decimal 32-bit format module header */ /* ------------------------------------------------------------------ */ -#if !defined(DECIMAL32) - #define DECIMAL32 +#ifndef DECIMAL32_H +#define DECIMAL32_H + #define DEC32NAME "decimal32" /* Short name */ #define DEC32FULLNAME "Decimal 32-bit Number" /* Verbose name */ #define DEC32AUTHOR "Mike Cowlishaw" /* Who to blame */ @@ -59,9 +60,7 @@ #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL32_Pmax /* size if not already defined*/ #endif - #ifndef DECNUMBER - #include "libdecnumber/decNumber.h" - #endif + #include "libdecnumber/decNumber.h" /* Decimal 32-bit type, accessible by bytes */ typedef struct { diff --git a/include/libdecnumber/dpd/decimal64.h b/include/libdecnumber/dpd/decimal64.h index 2f6c049..f29e570 100644 --- a/include/libdecnumber/dpd/decimal64.h +++ b/include/libdecnumber/dpd/decimal64.h @@ -32,8 +32,9 @@ /* Decimal 64-bit format module header */ /* ------------------------------------------------------------------ */ -#if !defined(DECIMAL64) - #define DECIMAL64 +#ifndef DECIMAL64_H +#define DECIMAL64_H + #define DEC64NAME "decimal64" /* Short name */ #define DEC64FULLNAME "Decimal 64-bit Number" /* Verbose name */ #define DEC64AUTHOR "Mike Cowlishaw" /* Who to blame */ @@ -61,9 +62,7 @@ #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL64_Pmax /* size if not already defined*/ #endif - #ifndef DECNUMBER - #include "libdecnumber/decNumber.h" - #endif + #include "libdecnumber/decNumber.h" /* Decimal 64-bit type, accessible by bytes */ typedef struct { diff --git a/include/migration/block.h b/include/migration/block.h index ffa8ac0..41a1ac8 100644 --- a/include/migration/block.h +++ b/include/migration/block.h @@ -11,8 +11,8 @@ * */ -#ifndef BLOCK_MIGRATION_H -#define BLOCK_MIGRATION_H +#ifndef MIGRATION_BLOCK_H +#define MIGRATION_BLOCK_H void blk_mig_init(void); int blk_mig_active(void); @@ -20,4 +20,4 @@ uint64_t blk_mig_bytes_transferred(void); uint64_t blk_mig_bytes_remaining(void); uint64_t blk_mig_bytes_total(void); -#endif /* BLOCK_MIGRATION_H */ +#endif /* MIGRATION_BLOCK_H */ diff --git a/include/migration/qemu-file.h b/include/migration/qemu-file.h index 2409a98..abedd46 100644 --- a/include/migration/qemu-file.h +++ b/include/migration/qemu-file.h @@ -21,8 +21,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef QEMU_FILE_H -#define QEMU_FILE_H 1 +#define QEMU_FILE_H + #include "qemu-common.h" #include "exec/cpu-common.h" #include "io/channel.h" diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 15ea767..1638ee5 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -23,11 +23,12 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef QEMU_VMSTATE_H -#define QEMU_VMSTATE_H 1 +#define QEMU_VMSTATE_H #ifndef CONFIG_USER_ONLY -#include <migration/qemu-file.h> +#include "migration/qemu-file.h" #endif #include "migration/qjson.h" diff --git a/include/monitor/hmp-target.h b/include/monitor/hmp-target.h index bc2c9c0..454e8ed 100644 --- a/include/monitor/hmp-target.h +++ b/include/monitor/hmp-target.h @@ -21,8 +21,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ -#ifndef MONITOR_COMMON_H -#define MONITOR_COMMON_H + +#ifndef MONITOR_HMP_TARGET_H +#define MONITOR_HMP_TARGET_H #define MD_TLONG 0 #define MD_I32 1 @@ -46,4 +47,4 @@ void hmp_mce(Monitor *mon, const QDict *qdict); void hmp_info_local_apic(Monitor *mon, const QDict *qdict); void hmp_info_io_apic(Monitor *mon, const QDict *qdict); -#endif /* MONITOR_COMMON */ +#endif /* MONITOR_HMP_TARGET_H */ diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h index aa0f373..c5c9ea2 100644 --- a/include/monitor/monitor.h +++ b/include/monitor/monitor.h @@ -51,4 +51,4 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd); void monitor_fdset_dup_fd_remove(int dup_fd); int monitor_fdset_dup_fd_find(int dup_fd); -#endif /* !MONITOR_H */ +#endif /* MONITOR_H */ diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h index c4b8a05..8e504bc 100644 --- a/include/monitor/qdev.h +++ b/include/monitor/qdev.h @@ -1,5 +1,5 @@ -#ifndef QEMU_QDEV_MONITOR_H -#define QEMU_QDEV_MONITOR_H +#ifndef MONITOR_QDEV_H +#define MONITOR_QDEV_H #include "hw/qdev-core.h" diff --git a/include/net/vhost-user.h b/include/net/vhost-user.h index efae35d..5bcd8a6 100644 --- a/include/net/vhost-user.h +++ b/include/net/vhost-user.h @@ -8,11 +8,11 @@ * */ -#ifndef VHOST_USER_H_ -#define VHOST_USER_H_ +#ifndef VHOST_USER_H +#define VHOST_USER_H struct vhost_net; struct vhost_net *vhost_user_get_vhost_net(NetClientState *nc); uint64_t vhost_user_get_acked_features(NetClientState *nc); -#endif /* VHOST_USER_H_ */ +#endif /* VHOST_USER_H */ diff --git a/include/qapi/qmp/dispatch.h b/include/qapi/qmp/dispatch.h index 5609946..48c11b6 100644 --- a/include/qapi/qmp/dispatch.h +++ b/include/qapi/qmp/dispatch.h @@ -11,8 +11,8 @@ * */ -#ifndef QMP_CORE_H -#define QMP_CORE_H +#ifndef QAPI_QMP_DISPATCH_H +#define QAPI_QMP_DISPATCH_H #include "qapi/qmp/qobject.h" #include "qapi/qmp/qdict.h" @@ -48,4 +48,3 @@ typedef void (*qmp_cmd_callback_fn)(QmpCommand *cmd, void *opaque); void qmp_for_each_command(qmp_cmd_callback_fn fn, void *opaque); #endif - diff --git a/include/qapi/qmp/qerror.h b/include/qapi/qmp/qerror.h index d08652a..6586c9f 100644 --- a/include/qapi/qmp/qerror.h +++ b/include/qapi/qmp/qerror.h @@ -19,9 +19,6 @@ #define QERR_BASE_NOT_FOUND \ "Base '%s' not found" -#define QERR_BLOCK_JOB_NOT_READY \ - "The active block job for device '%s' cannot be completed" - #define QERR_BUS_NO_HOTPLUG \ "Bus '%s' does not support hotplugging" diff --git a/include/qapi/qmp/types.h b/include/qapi/qmp/types.h index f21ecf4..27cfbd8 100644 --- a/include/qapi/qmp/types.h +++ b/include/qapi/qmp/types.h @@ -10,8 +10,8 @@ * See the COPYING.LIB file in the top-level directory. */ -#ifndef QEMU_OBJECTS_H -#define QEMU_OBJECTS_H +#ifndef QAPI_QMP_TYPES_H +#define QAPI_QMP_TYPES_H #include "qapi/qmp/qobject.h" #include "qapi/qmp/qint.h" @@ -21,4 +21,4 @@ #include "qapi/qmp/qdict.h" #include "qapi/qmp/qlist.h" -#endif /* QEMU_OBJECTS_H */ +#endif /* QAPI_QMP_TYPES_H */ diff --git a/include/qapi/visitor.h b/include/qapi/visitor.h index fb8f4eb..6c77a91 100644 --- a/include/qapi/visitor.h +++ b/include/qapi/visitor.h @@ -11,8 +11,9 @@ * See the COPYING.LIB file in the top-level directory. * */ -#ifndef QAPI_VISITOR_CORE_H -#define QAPI_VISITOR_CORE_H + +#ifndef QAPI_VISITOR_H +#define QAPI_VISITOR_H #include "qapi/qmp/qobject.h" diff --git a/include/qemu/acl.h b/include/qemu/acl.h index 116487e..7c44119 100644 --- a/include/qemu/acl.h +++ b/include/qemu/acl.h @@ -22,8 +22,8 @@ * THE SOFTWARE. */ -#ifndef __QEMU_ACL_H__ -#define __QEMU_ACL_H__ +#ifndef QEMU_ACL_H +#define QEMU_ACL_H #include "qemu/queue.h" @@ -63,12 +63,4 @@ int qemu_acl_insert(qemu_acl *acl, int qemu_acl_remove(qemu_acl *acl, const char *match); -#endif /* __QEMU_ACL_H__ */ - -/* - * Local variables: - * c-indent-level: 4 - * c-basic-offset: 4 - * tab-width: 8 - * End: - */ +#endif /* QEMU_ACL_H */ diff --git a/include/qemu/atomic.h b/include/qemu/atomic.h index 7a59096..7e13fca 100644 --- a/include/qemu/atomic.h +++ b/include/qemu/atomic.h @@ -12,10 +12,8 @@ * atomic primitive is meant to provide. */ -#ifndef __QEMU_ATOMIC_H -#define __QEMU_ATOMIC_H 1 - - +#ifndef QEMU_ATOMIC_H +#define QEMU_ATOMIC_H /* Compiler barrier */ #define barrier() ({ asm volatile("" ::: "memory"); (void)0; }) @@ -366,4 +364,4 @@ #define atomic_or(ptr, n) ((void) __sync_fetch_and_or(ptr, n)) #endif /* __ATOMIC_RELAXED */ -#endif /* __QEMU_ATOMIC_H */ +#endif /* QEMU_ATOMIC_H */ diff --git a/include/qemu/base64.h b/include/qemu/base64.h index 793708d..815d852 100644 --- a/include/qemu/base64.h +++ b/include/qemu/base64.h @@ -18,8 +18,8 @@ * */ -#ifndef QEMU_BASE64_H__ -#define QEMU_BASE64_H__ +#ifndef QEMU_BASE64_H +#define QEMU_BASE64_H #include "qemu-common.h" @@ -55,4 +55,4 @@ uint8_t *qbase64_decode(const char *input, Error **errp); -#endif /* QEMU_BUFFER_H__ */ +#endif /* QEMU_BASE64_H */ diff --git a/include/qemu/bcd.h b/include/qemu/bcd.h index b4c9b64..dfebacf 100644 --- a/include/qemu/bcd.h +++ b/include/qemu/bcd.h @@ -1,5 +1,5 @@ #ifndef QEMU_BCD_H -#define QEMU_BCD_H 1 +#define QEMU_BCD_H /* Convert a byte between binary and BCD. */ static inline uint8_t to_bcd(uint8_t val) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index ce3c42e..09c78fd 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -80,6 +80,64 @@ static inline void bswap64s(uint64_t *s) #define be_bswaps(p, size) do { *p = glue(bswap, size)(*p); } while(0) #endif +/** + * Endianness conversion functions between host cpu and specified endianness. + * (We list the complete set of prototypes produced by the macros below + * to assist people who search the headers to find their definitions.) + * + * uint16_t le16_to_cpu(uint16_t v); + * uint32_t le32_to_cpu(uint32_t v); + * uint64_t le64_to_cpu(uint64_t v); + * uint16_t be16_to_cpu(uint16_t v); + * uint32_t be32_to_cpu(uint32_t v); + * uint64_t be64_to_cpu(uint64_t v); + * + * Convert the value @v from the specified format to the native + * endianness of the host CPU by byteswapping if necessary, and + * return the converted value. + * + * uint16_t cpu_to_le16(uint16_t v); + * uint32_t cpu_to_le32(uint32_t v); + * uint64_t cpu_to_le64(uint64_t v); + * uint16_t cpu_to_be16(uint16_t v); + * uint32_t cpu_to_be32(uint32_t v); + * uint64_t cpu_to_be64(uint64_t v); + * + * Convert the value @v from the native endianness of the host CPU to + * the specified format by byteswapping if necessary, and return + * the converted value. + * + * void le16_to_cpus(uint16_t *v); + * void le32_to_cpus(uint32_t *v); + * void le64_to_cpus(uint64_t *v); + * void be16_to_cpus(uint16_t *v); + * void be32_to_cpus(uint32_t *v); + * void be64_to_cpus(uint64_t *v); + * + * Do an in-place conversion of the value pointed to by @v from the + * specified format to the native endianness of the host CPU. + * + * void cpu_to_le16s(uint16_t *v); + * void cpu_to_le32s(uint32_t *v); + * void cpu_to_le64s(uint64_t *v); + * void cpu_to_be16s(uint16_t *v); + * void cpu_to_be32s(uint32_t *v); + * void cpu_to_be64s(uint64_t *v); + * + * Do an in-place conversion of the value pointed to by @v from the + * native endianness of the host CPU to the specified format. + * + * Both X_to_cpu() and cpu_to_X() perform the same operation; you + * should use whichever one is better documenting of the function your + * code is performing. + * + * Do not use these functions for conversion of values which are in guest + * memory, since the data may not be sufficiently aligned for the host CPU's + * load and store instructions. Instead you should use the ld*_p() and + * st*_p() functions, which perform loads and stores of data of any + * required size and endianness and handle possible misalignment. + */ + #define CPU_CONVERT(endian, size, type)\ static inline type endian ## size ## _to_cpu(type v)\ {\ @@ -99,16 +157,6 @@ static inline void endian ## size ## _to_cpus(type *p)\ static inline void cpu_to_ ## endian ## size ## s(type *p)\ {\ glue(endian, _bswaps)(p, size);\ -}\ -\ -static inline type endian ## size ## _to_cpup(const type *p)\ -{\ - return glue(glue(endian, size), _to_cpu)(*p);\ -}\ -\ -static inline void cpu_to_ ## endian ## size ## w(type *p, type v)\ -{\ - *p = glue(glue(cpu_to_, endian), size)(v);\ } CPU_CONVERT(be, 16, uint16_t) @@ -126,7 +174,7 @@ static inline uint32_t qemu_bswap_len(uint32_t value, int len) } /* - * Same as cpu_to_le{16,23}, except that gcc will figure the result is + * Same as cpu_to_le{16,32}, except that gcc will figure the result is * a compile-time constant if you pass in a constant. So this can be * used to initialize static variables. */ diff --git a/include/qemu/buffer.h b/include/qemu/buffer.h index dead9b7..b2ead1f 100644 --- a/include/qemu/buffer.h +++ b/include/qemu/buffer.h @@ -18,8 +18,8 @@ * */ -#ifndef QEMU_BUFFER_H__ -#define QEMU_BUFFER_H__ +#ifndef QEMU_BUFFER_H +#define QEMU_BUFFER_H #include "qemu-common.h" @@ -158,4 +158,4 @@ void buffer_move_empty(Buffer *to, Buffer *from); */ void buffer_move(Buffer *to, Buffer *from); -#endif /* QEMU_BUFFER_H__ */ +#endif /* QEMU_BUFFER_H */ diff --git a/include/qemu/config-file.h b/include/qemu/config-file.h index 8603e86..8d4b2b6 100644 --- a/include/qemu/config-file.h +++ b/include/qemu/config-file.h @@ -1,5 +1,5 @@ -#ifndef QEMU_CONFIG_H -#define QEMU_CONFIG_H +#ifndef QEMU_CONFIG_FILE_H +#define QEMU_CONFIG_FILE_H #include "qemu/option.h" #include "qapi/qmp/qdict.h" @@ -27,4 +27,4 @@ void qemu_config_parse_qdict(QDict *options, QemuOptsList **lists, */ int qemu_read_default_config_files(bool userconfig); -#endif /* QEMU_CONFIG_H */ +#endif /* QEMU_CONFIG_FILE_H */ diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index 305fe76..ac8d4c9 100644 --- a/include/qemu/coroutine.h +++ b/include/qemu/coroutine.h @@ -61,16 +61,14 @@ typedef void coroutine_fn CoroutineEntry(void *opaque); * Create a new coroutine * * Use qemu_coroutine_enter() to actually transfer control to the coroutine. + * The opaque argument is passed as the argument to the entry point. */ -Coroutine *qemu_coroutine_create(CoroutineEntry *entry); +Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque); /** * Transfer control to a coroutine - * - * The opaque argument is passed as the argument to the entry point when - * entering the coroutine for the first time. It is subsequently ignored. */ -void qemu_coroutine_enter(Coroutine *coroutine, void *opaque); +void qemu_coroutine_enter(Coroutine *coroutine); /** * Transfer control back to a coroutine's caller @@ -102,7 +100,7 @@ bool qemu_in_coroutine(void); * are built. */ typedef struct CoQueue { - QTAILQ_HEAD(, Coroutine) entries; + QSIMPLEQ_HEAD(, Coroutine) entries; } CoQueue; /** diff --git a/include/qemu/coroutine_int.h b/include/qemu/coroutine_int.h index 42d6838..581a7f5 100644 --- a/include/qemu/coroutine_int.h +++ b/include/qemu/coroutine_int.h @@ -41,8 +41,8 @@ struct Coroutine { QSLIST_ENTRY(Coroutine) pool_next; /* Coroutines that should be woken up when we yield or terminate */ - QTAILQ_HEAD(, Coroutine) co_queue_wakeup; - QTAILQ_ENTRY(Coroutine) co_queue_next; + QSIMPLEQ_HEAD(, Coroutine) co_queue_wakeup; + QSIMPLEQ_ENTRY(Coroutine) co_queue_next; }; Coroutine *qemu_coroutine_new(void); diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index db7adad..3e4ea23 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -1,5 +1,5 @@ #ifndef QEMU_CUTILS_H -#define QEMU_CUTILS_H 1 +#define QEMU_CUTILS_H #include "qemu/fprintf-fn.h" diff --git a/include/qemu/error-report.h b/include/qemu/error-report.h index 7a2a363..499ec8b 100644 --- a/include/qemu/error-report.h +++ b/include/qemu/error-report.h @@ -10,9 +10,8 @@ * See the COPYING file in the top-level directory. */ -#ifndef QEMU_ERROR_H -#define QEMU_ERROR_H - +#ifndef QEMU_ERROR_REPORT_H +#define QEMU_ERROR_REPORT_H typedef struct Location { /* all members are private to qemu-error.c */ diff --git a/include/qemu/fifo8.h b/include/qemu/fifo8.h index 8820780..24b3644 100644 --- a/include/qemu/fifo8.h +++ b/include/qemu/fifo8.h @@ -1,5 +1,5 @@ -#ifndef FIFO_H -#define FIFO_H +#ifndef QEMU_FIFO8_H +#define QEMU_FIFO8_H #include "migration/vmstate.h" @@ -157,4 +157,4 @@ extern const VMStateDescription vmstate_fifo8; .offset = vmstate_offset_value(_state, _field, Fifo8), \ } -#endif /* FIFO_H */ +#endif /* QEMU_FIFO8_H */ diff --git a/include/qemu/fprintf-fn.h b/include/qemu/fprintf-fn.h index b6bad35..9068a96 100644 --- a/include/qemu/fprintf-fn.h +++ b/include/qemu/fprintf-fn.h @@ -6,8 +6,7 @@ */ #ifndef QEMU_FPRINTF_FN_H -#define QEMU_FPRINTF_FN_H 1 - +#define QEMU_FPRINTF_FN_H typedef int (*fprintf_function)(FILE *f, const char *fmt, ...) GCC_FMT_ATTR(2, 3); diff --git a/include/qemu/hbitmap.h b/include/qemu/hbitmap.h index e29188c..8ab721e 100644 --- a/include/qemu/hbitmap.h +++ b/include/qemu/hbitmap.h @@ -10,7 +10,7 @@ */ #ifndef HBITMAP_H -#define HBITMAP_H 1 +#define HBITMAP_H #include "bitops.h" #include "host-utils.h" diff --git a/include/qemu/help_option.h b/include/qemu/help_option.h index e39a66e..328d2a8 100644 --- a/include/qemu/help_option.h +++ b/include/qemu/help_option.h @@ -1,5 +1,5 @@ #ifndef QEMU_HELP_OPTION_H -#define QEMU_HELP_OPTION_H 1 +#define QEMU_HELP_OPTION_H /** * is_help_option: diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index 3de7d4e..46187bb 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -22,8 +22,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ + #ifndef HOST_UTILS_H -#define HOST_UTILS_H 1 +#define HOST_UTILS_H #include "qemu/bswap.h" diff --git a/include/qemu/id.h b/include/qemu/id.h index 7d90335..40c7010 100644 --- a/include/qemu/id.h +++ b/include/qemu/id.h @@ -1,5 +1,5 @@ #ifndef QEMU_ID_H -#define QEMU_ID_H 1 +#define QEMU_ID_H typedef enum IdSubSystems { ID_QDEV, diff --git a/include/qemu/main-loop.h b/include/qemu/main-loop.h index 19b5de3..470f600 100644 --- a/include/qemu/main-loop.h +++ b/include/qemu/main-loop.h @@ -23,7 +23,7 @@ */ #ifndef QEMU_MAIN_LOOP_H -#define QEMU_MAIN_LOOP_H 1 +#define QEMU_MAIN_LOOP_H #include "block/aio.h" @@ -64,11 +64,11 @@ int qemu_init_main_loop(Error **errp); * * void enter_co_bh(void *opaque) { * QEMUCoroutine *co = opaque; - * qemu_coroutine_enter(co, NULL); + * qemu_coroutine_enter(co); * } * * ... - * QEMUCoroutine *co = qemu_coroutine_create(coroutine_entry); + * QEMUCoroutine *co = qemu_coroutine_create(coroutine_entry, NULL); * QEMUBH *start_bh = qemu_bh_new(enter_co_bh, co); * qemu_bh_schedule(start_bh); * while (...) { diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h index 0899b2f..933c024 100644 --- a/include/qemu/mmap-alloc.h +++ b/include/qemu/mmap-alloc.h @@ -1,5 +1,5 @@ -#ifndef QEMU_MMAP_ALLOC -#define QEMU_MMAP_ALLOC +#ifndef QEMU_MMAP_ALLOC_H +#define QEMU_MMAP_ALLOC_H #include "qemu-common.h" diff --git a/include/qemu/option.h b/include/qemu/option.h index 8542d2d..1f9e3f9 100644 --- a/include/qemu/option.h +++ b/include/qemu/option.h @@ -23,8 +23,8 @@ * THE SOFTWARE. */ -#ifndef QEMU_OPTIONS_H -#define QEMU_OPTIONS_H +#ifndef QEMU_OPTION_H +#define QEMU_OPTION_H #include "qemu/queue.h" #include "qapi/qmp/qdict.h" diff --git a/include/qemu/option_int.h b/include/qemu/option_int.h index 6432c1a..26b1d9e 100644 --- a/include/qemu/option_int.h +++ b/include/qemu/option_int.h @@ -23,8 +23,8 @@ * THE SOFTWARE. */ -#ifndef QEMU_OPTIONS_INTERNAL_H -#define QEMU_OPTIONS_INTERNAL_H +#ifndef QEMU_OPTION_INT_H +#define QEMU_OPTION_INT_H #include "qemu/option.h" #include "qemu/error-report.h" diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h index e4c6ae6..fbb8759 100644 --- a/include/qemu/osdep.h +++ b/include/qemu/osdep.h @@ -279,6 +279,9 @@ int qemu_madvise(void *addr, size_t len, int advice); int qemu_open(const char *name, int flags, ...); int qemu_close(int fd); +#ifndef _WIN32 +int qemu_dup(int fd); +#endif #if defined(__HAIKU__) && defined(__i386__) #define FMT_pid "%ld" diff --git a/include/qemu/path.h b/include/qemu/path.h index ed5fee0..c6292a9 100644 --- a/include/qemu/path.h +++ b/include/qemu/path.h @@ -1,5 +1,5 @@ #ifndef QEMU_PATH_H -#define QEMU_PATH_H 1 +#define QEMU_PATH_H void init_paths(const char *prefix); const char *path(const char *pathname); diff --git a/include/qemu/queue.h b/include/qemu/queue.h index f781aa2..c2b6c81 100644 --- a/include/qemu/queue.h +++ b/include/qemu/queue.h @@ -37,8 +37,8 @@ * @(#)queue.h 8.5 (Berkeley) 8/20/94 */ -#ifndef QEMU_SYS_QUEUE_H_ -#define QEMU_SYS_QUEUE_H_ +#ifndef QEMU_SYS_QUEUE_H +#define QEMU_SYS_QUEUE_H /* * This file defines four types of data structures: singly-linked lists, @@ -436,4 +436,4 @@ struct { \ #define QTAILQ_PREV(elm, headname, field) \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#endif /* !QEMU_SYS_QUEUE_H_ */ +#endif /* QEMU_SYS_QUEUE_H */ diff --git a/include/qemu/ratelimit.h b/include/qemu/ratelimit.h index d413a4a..8da1232 100644 --- a/include/qemu/ratelimit.h +++ b/include/qemu/ratelimit.h @@ -12,37 +12,62 @@ */ #ifndef QEMU_RATELIMIT_H -#define QEMU_RATELIMIT_H 1 +#define QEMU_RATELIMIT_H typedef struct { - int64_t next_slice_time; + int64_t slice_start_time; + int64_t slice_end_time; uint64_t slice_quota; uint64_t slice_ns; uint64_t dispatched; } RateLimit; +/** Calculate and return delay for next request in ns + * + * Record that we sent @p n data units. If we may send more data units + * in the current time slice, return 0 (i.e. no delay). Otherwise + * return the amount of time (in ns) until the start of the next time + * slice that will permit sending the next chunk of data. + * + * Recording sent data units even after exceeding the quota is + * permitted; the time slice will be extended accordingly. + */ static inline int64_t ratelimit_calculate_delay(RateLimit *limit, uint64_t n) { int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME); + uint64_t delay_slices; - if (limit->next_slice_time < now) { - limit->next_slice_time = now + limit->slice_ns; + assert(limit->slice_quota && limit->slice_ns); + + if (limit->slice_end_time < now) { + /* Previous, possibly extended, time slice finished; reset the + * accounting. */ + limit->slice_start_time = now; + limit->slice_end_time = now + limit->slice_ns; limit->dispatched = 0; } - if (limit->dispatched == 0 || limit->dispatched + n <= limit->slice_quota) { - limit->dispatched += n; + + limit->dispatched += n; + if (limit->dispatched < limit->slice_quota) { + /* We may send further data within the current time slice, no + * need to delay the next request. */ return 0; - } else { - limit->dispatched = n; - return limit->next_slice_time - now; } + + /* Quota exceeded. Calculate the next time slice we may start + * sending data again. */ + delay_slices = (limit->dispatched + limit->slice_quota - 1) / + limit->slice_quota; + limit->slice_end_time = limit->slice_start_time + + delay_slices * limit->slice_ns; + return limit->slice_end_time - now; } static inline void ratelimit_set_speed(RateLimit *limit, uint64_t speed, uint64_t slice_ns) { limit->slice_ns = slice_ns; - limit->slice_quota = ((double)speed * slice_ns)/1000000000ULL; + limit->slice_quota = MAX(((double)speed * slice_ns) / 1000000000ULL, 1); } #endif diff --git a/include/qemu/rcu_queue.h b/include/qemu/rcu_queue.h index 3aca7a5..01be774 100644 --- a/include/qemu/rcu_queue.h +++ b/include/qemu/rcu_queue.h @@ -131,4 +131,4 @@ extern "C" { #ifdef __cplusplus } #endif -#endif /* QEMU_RCU_QUEUE.H */ +#endif /* QEMU_RCU_QUEUE_H */ diff --git a/include/qemu/readline.h b/include/qemu/readline.h index 49efe4e..c08cf74 100644 --- a/include/qemu/readline.h +++ b/include/qemu/readline.h @@ -60,4 +60,4 @@ ReadLineState *readline_init(ReadLinePrintfFunc *printf_func, void *opaque, ReadLineCompletionFunc *completion_finder); -#endif /* !READLINE_H */ +#endif /* READLINE_H */ diff --git a/include/qemu/seqlock.h b/include/qemu/seqlock.h index 4dfc055..2e2be4c 100644 --- a/include/qemu/seqlock.h +++ b/include/qemu/seqlock.h @@ -10,11 +10,12 @@ * See the COPYING file in the top-level directory. * */ + #ifndef QEMU_SEQLOCK_H -#define QEMU_SEQLOCK_H 1 +#define QEMU_SEQLOCK_H -#include <qemu/atomic.h> -#include <qemu/thread.h> +#include "qemu/atomic.h" +#include "qemu/thread.h" typedef struct QemuSeqLock QemuSeqLock; diff --git a/include/qemu/sockets.h b/include/qemu/sockets.h index 2f3763f..5fe01fb 100644 --- a/include/qemu/sockets.h +++ b/include/qemu/sockets.h @@ -1,6 +1,7 @@ /* headers to use the BSD sockets */ -#ifndef QEMU_SOCKET_H -#define QEMU_SOCKET_H + +#ifndef QEMU_SOCKETS_H +#define QEMU_SOCKETS_H #ifdef _WIN32 @@ -121,4 +122,5 @@ SocketAddress *socket_remote_address(int fd, Error **errp); * Returns: the socket address in string format, or NULL on error */ char *socket_address_to_string(struct SocketAddress *addr, Error **errp); -#endif /* QEMU_SOCKET_H */ + +#endif /* QEMU_SOCKETS_H */ diff --git a/include/qemu/thread-posix.h b/include/qemu/thread-posix.h index eb5c7a1..aa03567 100644 --- a/include/qemu/thread-posix.h +++ b/include/qemu/thread-posix.h @@ -1,6 +1,7 @@ -#ifndef __QEMU_THREAD_POSIX_H -#define __QEMU_THREAD_POSIX_H 1 -#include "pthread.h" +#ifndef QEMU_THREAD_POSIX_H +#define QEMU_THREAD_POSIX_H + +#include <pthread.h> #include <semaphore.h> struct QemuMutex { diff --git a/include/qemu/thread-win32.h b/include/qemu/thread-win32.h index 385ff5f..c7ce8dc 100644 --- a/include/qemu/thread-win32.h +++ b/include/qemu/thread-win32.h @@ -1,6 +1,7 @@ -#ifndef __QEMU_THREAD_WIN32_H -#define __QEMU_THREAD_WIN32_H 1 -#include "windows.h" +#ifndef QEMU_THREAD_WIN32_H +#define QEMU_THREAD_WIN32_H + +#include <windows.h> struct QemuMutex { CRITICAL_SECTION lock; diff --git a/include/qemu/thread.h b/include/qemu/thread.h index c5d71cf8..31237e9 100644 --- a/include/qemu/thread.h +++ b/include/qemu/thread.h @@ -1,5 +1,5 @@ -#ifndef __QEMU_THREAD_H -#define __QEMU_THREAD_H 1 +#ifndef QEMU_THREAD_H +#define QEMU_THREAD_H #include "qemu/processor.h" #include "qemu/atomic.h" diff --git a/include/qemu/unicode.h b/include/qemu/unicode.h index d873165..71c72db 100644 --- a/include/qemu/unicode.h +++ b/include/qemu/unicode.h @@ -1,5 +1,5 @@ #ifndef QEMU_UNICODE_H -#define QEMU_UNICODE_H 1 +#define QEMU_UNICODE_H int mod_utf8_codepoint(const char *s, size_t n, char **end); diff --git a/include/qom/cpu.h b/include/qom/cpu.h index cacb100..a6c6ed8 100644 --- a/include/qom/cpu.h +++ b/include/qom/cpu.h @@ -60,6 +60,12 @@ typedef uint64_t vaddr; #define CPU_CLASS(class) OBJECT_CLASS_CHECK(CPUClass, (class), TYPE_CPU) #define CPU_GET_CLASS(obj) OBJECT_GET_CLASS(CPUClass, (obj), TYPE_CPU) +typedef enum MMUAccessType { + MMU_DATA_LOAD = 0, + MMU_DATA_STORE = 1, + MMU_INST_FETCH = 2 +} MMUAccessType; + typedef struct CPUWatchpoint CPUWatchpoint; typedef void (*CPUUnassignedAccess)(CPUState *cpu, hwaddr addr, @@ -142,7 +148,8 @@ typedef struct CPUClass { void (*do_interrupt)(CPUState *cpu); CPUUnassignedAccess do_unassigned_access; void (*do_unaligned_access)(CPUState *cpu, vaddr addr, - int is_write, int is_user, uintptr_t retaddr); + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr); bool (*virtio_is_big_endian)(CPUState *cpu); int (*memory_rw_debug)(CPUState *cpu, vaddr addr, uint8_t *buf, int len, bool is_write); @@ -716,12 +723,12 @@ static inline void cpu_unassigned_access(CPUState *cpu, hwaddr addr, } static inline void cpu_unaligned_access(CPUState *cpu, vaddr addr, - int is_write, int is_user, - uintptr_t retaddr) + MMUAccessType access_type, + int mmu_idx, uintptr_t retaddr) { CPUClass *cc = CPU_GET_CLASS(cpu); - cc->do_unaligned_access(cpu, addr, is_write, is_user, retaddr); + cc->do_unaligned_access(cpu, addr, access_type, mmu_idx, retaddr); } #endif diff --git a/include/sysemu/balloon.h b/include/sysemu/balloon.h index 3f976b4..af49e19 100644 --- a/include/sysemu/balloon.h +++ b/include/sysemu/balloon.h @@ -11,8 +11,8 @@ * */ -#ifndef _QEMU_BALLOON_H -#define _QEMU_BALLOON_H +#ifndef QEMU_BALLOON_H +#define QEMU_BALLOON_H #include "qapi-types.h" diff --git a/include/sysemu/bt.h b/include/sysemu/bt.h index 2bc6d53..ddb05cd 100644 --- a/include/sysemu/bt.h +++ b/include/sysemu/bt.h @@ -1,5 +1,5 @@ -#ifndef BT_HOST_H -#define BT_HOST_H +#ifndef SYSEMU_BT_H +#define SYSEMU_BT_H /* BT HCI info */ diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h index 705650a..e22e5be 100644 --- a/include/sysemu/device_tree.h +++ b/include/sysemu/device_tree.h @@ -11,8 +11,8 @@ * */ -#ifndef __DEVICE_TREE_H__ -#define __DEVICE_TREE_H__ +#ifndef DEVICE_TREE_H +#define DEVICE_TREE_H void *create_device_tree(int *sizep); void *load_device_tree(const char *filename_path, int *sizep); @@ -168,4 +168,4 @@ int qemu_fdt_setprop_sized_cells_from_array(void *fdt, #define FDT_PCI_RANGE_IOPORT 0x01000000 #define FDT_PCI_RANGE_CONFIG 0x00000000 -#endif /* __DEVICE_TREE_H__ */ +#endif /* DEVICE_TREE_H */ diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h index c903404..678232a 100644 --- a/include/sysemu/hostmem.h +++ b/include/sysemu/hostmem.h @@ -9,8 +9,9 @@ * This work is licensed under the terms of the GNU GPL, version 2 or later. * See the COPYING file in the top-level directory. */ -#ifndef QEMU_RAM_H -#define QEMU_RAM_H + +#ifndef SYSEMU_HOSTMEM_H +#define SYSEMU_HOSTMEM_H #include "sysemu/sysemu.h" /* for MAX_NODES */ #include "qom/object.h" diff --git a/include/sysemu/tpm_backend.h b/include/sysemu/tpm_backend.h index e3ec800..b58f52d 100644 --- a/include/sysemu/tpm_backend.h +++ b/include/sysemu/tpm_backend.h @@ -10,8 +10,8 @@ * See the COPYING file in the top-level directory. */ -#ifndef _QEMU_TPM_H -#define _QEMU_TPM_H +#ifndef TPM_BACKEND_H +#define TPM_BACKEND_H #include "qom/object.h" #include "qemu-common.h" diff --git a/include/sysemu/tpm_backend_int.h b/include/sysemu/tpm_backend_int.h index cc0dcb3..00639dd 100644 --- a/include/sysemu/tpm_backend_int.h +++ b/include/sysemu/tpm_backend_int.h @@ -19,9 +19,8 @@ * License along with this library; if not, see <http://www.gnu.org/licenses/> */ -#ifndef TPM_TPM_BACKEND_H -#define TPM_TPM_BACKEND_H - +#ifndef TPM_BACKEND_INT_H +#define TPM_BACKEND_INT_H typedef struct TPMBackendThread { GThreadPool *pool; @@ -39,4 +38,4 @@ typedef enum TPMBackendCmd { TPM_BACKEND_CMD_TPM_RESET, } TPMBackendCmd; -#endif /* TPM_TPM_BACKEND_H */ +#endif /* TPM_BACKEND_INT_H */ diff --git a/include/sysemu/xen-mapcache.h b/include/sysemu/xen-mapcache.h index c849489..b8c93b9 100644 --- a/include/sysemu/xen-mapcache.h +++ b/include/sysemu/xen-mapcache.h @@ -9,7 +9,6 @@ #ifndef XEN_MAPCACHE_H #define XEN_MAPCACHE_H - typedef hwaddr (*phys_offset_to_gaddr_t)(hwaddr start_addr, ram_addr_t size, void *opaque); @@ -52,4 +51,4 @@ static inline void xen_invalidate_map_cache(void) #endif -#endif /* !XEN_MAPCACHE_H */ +#endif /* XEN_MAPCACHE_H */ diff --git a/include/trace-tcg.h b/include/trace-tcg.h index 6f6bdbb..edab4b1 100644 --- a/include/trace-tcg.h +++ b/include/trace-tcg.h @@ -4,4 +4,4 @@ #include "trace/generated-tcg-tracers.h" #include "trace/generated-events.h" -#endif /* TRACE_TCG_H */ +#endif /* TRACE_TCG_H */ diff --git a/include/trace.h b/include/trace.h index 44a1f1f..9a01e44 100644 --- a/include/trace.h +++ b/include/trace.h @@ -4,4 +4,4 @@ #include "trace/generated-tracers.h" #include "trace/generated-events.h" -#endif /* TRACE_H */ +#endif /* TRACE_H */ |