| 1 |
|
| 2 |
|
| 3 |
#ifndef _SMMSTORE_H_ |
| 4 |
#define _SMMSTORE_H_ |
| 5 |
|
| 6 |
#include <stddef.h> |
| 7 |
#include <stdint.h> |
| 8 |
|
| 9 |
#define SMMSTORE_RET_SUCCESS 0 |
| 10 |
#define SMMSTORE_RET_FAILURE 1 |
| 11 |
#define SMMSTORE_RET_UNSUPPORTED 2 |
| 12 |
|
| 13 |
|
| 14 |
#define SMMSTORE_CMD_CLEAR 1 |
| 15 |
#define SMMSTORE_CMD_READ 2 |
| 16 |
#define SMMSTORE_CMD_APPEND 3 |
| 17 |
|
| 18 |
|
| 19 |
#define SMMSTORE_CMD_INIT_DEPRECATED 4 |
| 20 |
#define SMMSTORE_CMD_RAW_READ 5 |
| 21 |
#define SMMSTORE_CMD_RAW_WRITE 6 |
| 22 |
#define SMMSTORE_CMD_RAW_CLEAR 7 |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
#define SMMSTORE_CMD_USE_FULL_FLASH 0x80 |
| 33 |
|
| 34 |
|
| 35 |
struct smmstore_params_read { |
| 36 |
void *buf; |
| 37 |
ssize_t bufsize; |
| 38 |
}; |
| 39 |
|
| 40 |
struct smmstore_params_append { |
| 41 |
void *key; |
| 42 |
size_t keysize; |
| 43 |
void *val; |
| 44 |
size_t valsize; |
| 45 |
}; |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
#define SMM_BLOCK_SIZE (64 * KiB) |
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
struct smmstore_params_init { |
| 60 |
uint32_t com_buffer; |
| 61 |
uint32_t com_buffer_size; |
| 62 |
} __packed; |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
struct smmstore_params_info { |
| 70 |
uint32_t num_blocks; |
| 71 |
uint32_t block_size; |
| 72 |
uint64_t mmap_addr; |
| 73 |
} __packed; |
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 |
struct smmstore_params_raw_write { |
| 84 |
uint32_t bufsize; |
| 85 |
uint32_t bufoffset; |
| 86 |
uint32_t block_id; |
| 87 |
} __packed; |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
struct smmstore_params_raw_read { |
| 97 |
uint32_t bufsize; |
| 98 |
uint32_t bufoffset; |
| 99 |
uint32_t block_id; |
| 100 |
} __packed; |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|
| 107 |
struct smmstore_params_raw_clear { |
| 108 |
uint32_t block_id; |
| 109 |
} __packed; |
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
uint32_t smmstore_exec(uint8_t command, void *param); |
| 114 |
|
| 115 |
|
| 116 |
int smmstore_read_region(void *buf, ssize_t *bufsize); |
| 117 |
int smmstore_append_data(void *key, uint32_t key_sz, void *value, uint32_t value_sz); |
| 118 |
int smmstore_clear_region(void); |
| 119 |
|
| 120 |
|
| 121 |
int smmstore_init(void *buf, size_t len); |
| 122 |
int smmstore_rawread_region(uint32_t block_id, uint32_t offset, uint32_t bufsize); |
| 123 |
int smmstore_rawwrite_region(uint32_t block_id, uint32_t offset, uint32_t bufsize); |
| 124 |
int smmstore_rawclear_region(uint32_t block_id); |
| 125 |
#if ENV_RAMSTAGE |
| 126 |
int smmstore_get_info(struct smmstore_params_info *info); |
| 127 |
#endif |
| 128 |
struct region_device; |
| 129 |
int smmstore_lookup_region(struct region_device *rstore); |
| 130 |
|
| 131 |
int smmstore_preprocess_cmd(uint8_t *cmd, void *param); |
| 132 |
|
| 133 |
|
| 134 |
struct lb_header; |
| 135 |
void lb_smmstorev2(struct lb_header *header); |
| 136 |
|
| 137 |
#endif |