10
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
14
/** A non-volatile storage device */
18
* This is expressed as the base-2 logarithm of the word
19
* length in bytes. A value of 0 therefore translates as
20
* 8-bit words, and a value of 1 translates as 16-bit words.
22
unsigned int word_len_log2;
23
/** Device size (in words) */
25
/** Data block size (in words)
27
* This is the block size used by the device. It must be a
28
* power of two. Data reads and writes must not cross a block
31
* Many devices allow reads to cross a block boundary, and
32
* restrict only writes. For the sake of simplicity, we
33
* assume that the same restriction applies to both reads and
36
unsigned int block_size;
37
/** Read data from device
40
* @v address Address from which to read
42
* @v len Length of data buffer
43
* @ret rc Return status code
45
* Reads may not cross a block boundary.
47
int ( * read ) ( struct nvs_device *nvs, unsigned int address,
48
void *data, size_t len );
49
/** Write data to device
52
* @v address Address to which to write
54
* @v len Length of data buffer
55
* @ret rc Return status code
57
* Writes may not cross a block boundary.
59
int ( * write ) ( struct nvs_device *nvs, unsigned int address,
60
const void *data, size_t len );
63
extern int nvs_read ( struct nvs_device *nvs, unsigned int address,
64
void *data, size_t len );
65
extern int nvs_write ( struct nvs_device *nvs, unsigned int address,
66
const void *data, size_t len );
68
#endif /* _IPXE_NVS_H */