mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-01 23:03:54 -06:00
fw_cfg: doc updates, various optimizations.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJWcnl0AAoJEEy22O7T6HE4vhgP/AxlVRTQ1vg1AhHPHuTmXLmq tS5m2FF73yzfy2eBDd2Vm3z1vdwmhbcZbV745dLLzVMaaFGmHSCbUQFnGPCCNdKt yXZkVh1Aqj2rR//Mmn293JWwVJq04LtGIXQxPMXO7m88fcdQ8PHiwyAVPUsV+6DY lLWxhtTTYeHb9xngIKnW7nSbL2OZUD49s0vwYb9w3Ih97cPFOBjBYiv3WowI9y48 /fDb1POzV0/bVyhKvlkWfkDpZqF1ilob3v3zq2VniTkm5+wGmVIhlFwI6nGJNtne +aYrZgQSzsFjByrqWxfCIyp91e7+SEctDqtZZw1DA1gn01ksFvrX9Kz5UJTcXQw3 eDhyxVnssjrakDR3KAEoIMroQPsrBT79pr7cRfyt0wqEfZ7p1kxH/iuyS+ZTCoST xVdM2HxzV7Qabo2iPQBeCu47Vbu8ON9prypM9BHegGFcS11zcLEIOTHTlrC0zO1U TqYpls1Nm+B0SfVgN7NkBNm+vj5321Qf/I+O8Gvtxks6AkspJMcbld8SX0xUiVQE VNos1DReR4CLh6Yc9UgmZAtdfzyCci8cpCrB2N5B/+AzLQetmrRnPXDBNCx2fTOB gkQpHsrlxDOZugF6ljt9y5vD9U+HhlTuZRmNCLoz92YMj3j+I1kcClA/JAjRz1UD kSDhSKsPTTf8xkemdZCp =7yKy -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-fw-cfg-20151217-1' into staging fw_cfg: doc updates, various optimizations. # gpg: Signature made Thu 17 Dec 2015 08:59:32 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-fw-cfg-20151217-1: fw_cfg: replace ioport data read with generic method fw_cfg: add generic non-DMA read method fw_cfg: avoid calculating invalid current entry pointer fw_cfg: remove offset argument from callback prototype fw_cfg: amend callback behavior spec to once per select fw_cfg: move internal function call docs to header file Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
98557acf92
6 changed files with 166 additions and 128 deletions
|
@ -192,90 +192,7 @@ To check the result, read the "control" field:
|
|||
today due to implementation not being async,
|
||||
but may in the future).
|
||||
|
||||
= Host-side API =
|
||||
|
||||
The following functions are available to the QEMU programmer for adding
|
||||
data to a fw_cfg device during guest initialization (see fw_cfg.h for
|
||||
each function's complete prototype):
|
||||
|
||||
== fw_cfg_add_bytes() ==
|
||||
|
||||
Given a selector key value, starting pointer, and size, create an item
|
||||
as a raw "blob" of the given size, available by selecting the given key.
|
||||
The data referenced by the starting pointer is only linked, NOT copied,
|
||||
into the data structure of the fw_cfg device.
|
||||
|
||||
== fw_cfg_add_string() ==
|
||||
|
||||
Instead of a starting pointer and size, this function accepts a pointer
|
||||
to a NUL-terminated ascii string, and inserts a newly allocated copy of
|
||||
the string (including the NUL terminator) into the fw_cfg device data
|
||||
structure.
|
||||
|
||||
== fw_cfg_add_iXX() ==
|
||||
|
||||
Insert an XX-bit item, where XX may be 16, 32, or 64. These functions
|
||||
will convert a 16-, 32-, or 64-bit integer to little-endian, then add
|
||||
a dynamically allocated copy of the appropriately sized item to fw_cfg
|
||||
under the given selector key value.
|
||||
|
||||
== fw_cfg_modify_iXX() ==
|
||||
|
||||
Modify the value of an XX-bit item (where XX may be 16, 32, or 64).
|
||||
Similarly to the corresponding fw_cfg_add_iXX() function set, convert
|
||||
a 16-, 32-, or 64-bit integer to little endian, create a dynamically
|
||||
allocated copy of the required size, and replace the existing item at
|
||||
the given selector key value with the newly allocated one. The previous
|
||||
item, assumed to have been allocated during an earlier call to
|
||||
fw_cfg_add_iXX() or fw_cfg_modify_iXX() (of the same width XX), is freed
|
||||
before the function returns.
|
||||
|
||||
== fw_cfg_add_file() ==
|
||||
|
||||
Given a filename (i.e., fw_cfg item name), starting pointer, and size,
|
||||
create an item as a raw "blob" of the given size. Unlike fw_cfg_add_bytes()
|
||||
above, the next available selector key (above 0x0020, FW_CFG_FILE_FIRST)
|
||||
will be used, and a new entry will be added to the file directory structure
|
||||
(at key 0x0019), containing the item name, blob size, and automatically
|
||||
assigned selector key value. The data referenced by the starting pointer
|
||||
is only linked, NOT copied, into the fw_cfg data structure.
|
||||
|
||||
== fw_cfg_add_file_callback() ==
|
||||
|
||||
Like fw_cfg_add_file(), but additionally sets pointers to a callback
|
||||
function (and opaque argument), which will be executed host-side by
|
||||
QEMU each time a byte is read by the guest from this particular item.
|
||||
|
||||
NOTE: The callback function is given the opaque argument set by
|
||||
fw_cfg_add_file_callback(), but also the current data offset,
|
||||
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).
|
||||
|
||||
== fw_cfg_modify_file() ==
|
||||
|
||||
Given a filename (i.e., fw_cfg item name), starting pointer, and size,
|
||||
completely replace the configuration item referenced by the given item
|
||||
name with the new given blob. If an existing blob is found, its
|
||||
callback information is removed, and a pointer to the old data is
|
||||
returned to allow the caller to free it, helping avoid memory leaks.
|
||||
If a configuration item does not already exist under the given item
|
||||
name, a new item will be created as with fw_cfg_add_file(), and NULL
|
||||
is returned to the caller. In any case, the data referenced by the
|
||||
starting pointer is only linked, NOT copied, into the fw_cfg data
|
||||
structure.
|
||||
|
||||
== fw_cfg_add_callback() ==
|
||||
|
||||
Like fw_cfg_add_bytes(), but additionally sets pointers to a callback
|
||||
function (and opaque argument), which will be executed host-side by
|
||||
QEMU each time a guest-side write operation to this particular item
|
||||
completes fully overwriting the item's data.
|
||||
|
||||
NOTE: This function is deprecated, and will be completely removed
|
||||
starting with QEMU v2.4.
|
||||
|
||||
== Externally Provided Items ==
|
||||
= Externally Provided Items =
|
||||
|
||||
As of v2.4, "file" fw_cfg items (i.e., items with selector keys above
|
||||
FW_CFG_FILE_FIRST, and with a corresponding entry in the fw_cfg file
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue