X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=qemu%2Froms%2Fipxe%2Fsrc%2Finclude%2Fipxe%2Fnvs.h;fp=qemu%2Froms%2Fipxe%2Fsrc%2Finclude%2Fipxe%2Fnvs.h;h=4733123cf590fa855ee26d64c29ac1931b0489a3;hb=e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb;hp=0000000000000000000000000000000000000000;hpb=9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00;p=kvmfornfv.git diff --git a/qemu/roms/ipxe/src/include/ipxe/nvs.h b/qemu/roms/ipxe/src/include/ipxe/nvs.h new file mode 100644 index 000000000..4733123cf --- /dev/null +++ b/qemu/roms/ipxe/src/include/ipxe/nvs.h @@ -0,0 +1,68 @@ +#ifndef _IPXE_NVS_H +#define _IPXE_NVS_H + +/** @file + * + * Non-volatile storage + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#include + +/** A non-volatile storage device */ +struct nvs_device { + /** Word length + * + * This is expressed as the base-2 logarithm of the word + * length in bytes. A value of 0 therefore translates as + * 8-bit words, and a value of 1 translates as 16-bit words. + */ + unsigned int word_len_log2; + /** Device size (in words) */ + unsigned int size; + /** Data block size (in words) + * + * This is the block size used by the device. It must be a + * power of two. Data reads and writes must not cross a block + * boundary. + * + * Many devices allow reads to cross a block boundary, and + * restrict only writes. For the sake of simplicity, we + * assume that the same restriction applies to both reads and + * writes. + */ + unsigned int block_size; + /** Read data from device + * + * @v nvs NVS device + * @v address Address from which to read + * @v data Data buffer + * @v len Length of data buffer + * @ret rc Return status code + * + * Reads may not cross a block boundary. + */ + int ( * read ) ( struct nvs_device *nvs, unsigned int address, + void *data, size_t len ); + /** Write data to device + * + * @v nvs NVS device + * @v address Address to which to write + * @v data Data buffer + * @v len Length of data buffer + * @ret rc Return status code + * + * Writes may not cross a block boundary. + */ + int ( * write ) ( struct nvs_device *nvs, unsigned int address, + const void *data, size_t len ); +}; + +extern int nvs_read ( struct nvs_device *nvs, unsigned int address, + void *data, size_t len ); +extern int nvs_write ( struct nvs_device *nvs, unsigned int address, + const void *data, size_t len ); + +#endif /* _IPXE_NVS_H */