fw_cfg: move internal function call docs to header file

Move documentation for fw_cfg functions internal to qemufrom
docs/specs/fw_cfg.txt to the fw_cfg.h header file, next to
their prototype declarations, formatted as doc-comments.

NOTE: Documentation for fw_cfg_add_callback() is completely
dropped by this patch, as that function has been eliminated
by commit 023e3148.

Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc Marí <markmb@redhat.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-id: 1446733972-1602-2-git-send-email-somlo@cmu.edu
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gabriel L. Somlo 2015-11-05 09:32:47 -05:00 committed by Gerd Hoffmann
parent f05b42d3fd
commit 9c4a5c55f5
2 changed files with 130 additions and 84 deletions

View file

@ -73,19 +73,148 @@ typedef struct FWCfgDmaAccess {
typedef void (*FWCfgCallback)(void *opaque, uint8_t *data);
typedef void (*FWCfgReadCallback)(void *opaque, uint32_t offset);
/**
* fw_cfg_add_bytes:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @data: pointer to start of item data
* @len: size of item data
*
* Add a new fw_cfg item, available by selecting the given key, as a raw
* "blob" of the given size. The data referenced by the starting pointer
* is only linked, NOT copied, into the data structure of the fw_cfg device.
*/
void fw_cfg_add_bytes(FWCfgState *s, uint16_t key, void *data, size_t len);
/**
* fw_cfg_add_string:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @value: NUL-terminated ascii string
*
* Add a new fw_cfg item, available by selecting the given key. The item
* data will consist of a dynamically allocated copy of the provided string,
* including its NUL terminator.
*/
void fw_cfg_add_string(FWCfgState *s, uint16_t key, const char *value);
/**
* fw_cfg_add_i16:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @value: 16-bit integer
*
* Add a new fw_cfg item, available by selecting the given key. The item
* data will consist of a dynamically allocated copy of the given 16-bit
* value, converted to little-endian representation.
*/
void fw_cfg_add_i16(FWCfgState *s, uint16_t key, uint16_t value);
/**
* fw_cfg_modify_i16:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @value: 16-bit integer
*
* Replace the fw_cfg item available by selecting the given key. The new
* data will consist of a dynamically allocated copy of the given 16-bit
* value, converted to little-endian representation. The data being replaced,
* assumed to have been dynamically allocated during an earlier call to
* either fw_cfg_add_i16() or fw_cfg_modify_i16(), is freed before returning.
*/
void fw_cfg_modify_i16(FWCfgState *s, uint16_t key, uint16_t value);
/**
* fw_cfg_add_i32:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @value: 32-bit integer
*
* Add a new fw_cfg item, available by selecting the given key. The item
* data will consist of a dynamically allocated copy of the given 32-bit
* value, converted to little-endian representation.
*/
void fw_cfg_add_i32(FWCfgState *s, uint16_t key, uint32_t value);
/**
* fw_cfg_add_i64:
* @s: fw_cfg device being modified
* @key: selector key value for new fw_cfg item
* @value: 64-bit integer
*
* Add a new fw_cfg item, available by selecting the given key. The item
* data will consist of a dynamically allocated copy of the given 64-bit
* value, converted to little-endian representation.
*/
void fw_cfg_add_i64(FWCfgState *s, uint16_t key, uint64_t value);
/**
* fw_cfg_add_file:
* @s: fw_cfg device being modified
* @filename: name of new fw_cfg file item
* @data: pointer to start of item data
* @len: size of item data
*
* Add a new NAMED fw_cfg item as a raw "blob" of the given size. The data
* referenced by the starting pointer is only linked, NOT copied, into the
* data structure of the fw_cfg device.
* The next available (unused) selector key starting at FW_CFG_FILE_FIRST
* will be used; also, a new entry will be added to the file directory
* structure residing at key value FW_CFG_FILE_DIR, containing the item name,
* data size, and assigned selector key value.
*/
void fw_cfg_add_file(FWCfgState *s, const char *filename, void *data,
size_t len);
/**
* fw_cfg_add_file_callback:
* @s: fw_cfg device being modified
* @filename: name of new fw_cfg file item
* @callback: callback function
* @callback_opaque: argument to be passed into callback function
* @data: pointer to start of item data
* @len: size of item data
*
* Add a new NAMED fw_cfg item as a raw "blob" of the given size. The data
* referenced by the starting pointer is only linked, NOT copied, into the
* data structure of the fw_cfg device.
* The next available (unused) selector key starting at FW_CFG_FILE_FIRST
* will be used; also, a new entry will be added to the file directory
* structure residing at key value FW_CFG_FILE_DIR, containing the item name,
* data size, and assigned selector key value.
* Additionally, set a callback function (and argument) to be called each
* time a byte is read by the guest from this particular item, or, in the
* case of DMA, each time a read or skip request overlaps with the valid
* offset range of the item.
* NOTE: In addition to the opaque argument set here, the callback function
* takes the current data offset as an additional argument, allowing it the
* option of only acting upon specific offset values (e.g., 0, before the
* first data byte of the selected item is returned to the guest).
*/
void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
FWCfgReadCallback callback, void *callback_opaque,
void *data, size_t len);
/**
* fw_cfg_modify_file:
* @s: fw_cfg device being modified
* @filename: name of new fw_cfg file item
* @data: pointer to start of item data
* @len: size of item data
*
* Replace a NAMED fw_cfg item. If an existing item is found, its callback
* information will be cleared, and a pointer to its data will be returned
* to the caller, so that it may be freed if necessary. If an existing item
* is not found, this call defaults to fw_cfg_add_file(), and NULL is
* returned to the caller.
* In either case, the new item data is only linked, NOT copied, into the
* data structure of the fw_cfg device.
*
* Returns: pointer to old item's data, or NULL if old item does not exist.
*/
void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
size_t len);
FWCfgState *fw_cfg_init_io_dma(uint32_t iobase, uint32_t dma_iobase,
AddressSpace *dma_as);
FWCfgState *fw_cfg_init_io(uint32_t iobase);