Patrick Georgi | 9360fea | 2018-03-14 21:11:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2018 The Chromium OS Authors. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef _SMMSTORE_H_ |
| 17 | #define _SMMSTORE_H_ |
| 18 | |
| 19 | #include <stddef.h> |
| 20 | #include <stdint.h> |
| 21 | |
Patrick Georgi | 9360fea | 2018-03-14 21:11:21 +0100 | [diff] [blame] | 22 | #define SMMSTORE_RET_SUCCESS 0 |
| 23 | #define SMMSTORE_RET_FAILURE 1 |
| 24 | #define SMMSTORE_RET_UNSUPPORTED 2 |
| 25 | |
| 26 | #define SMMSTORE_CMD_CLEAR 1 |
| 27 | #define SMMSTORE_CMD_READ 2 |
| 28 | #define SMMSTORE_CMD_APPEND 3 |
| 29 | |
| 30 | struct smmstore_params_read { |
| 31 | void *buf; |
| 32 | ssize_t bufsize; |
| 33 | }; |
| 34 | |
| 35 | struct smmstore_params_append { |
| 36 | void *key; |
| 37 | size_t keysize; |
| 38 | void *val; |
| 39 | size_t valsize; |
| 40 | }; |
| 41 | |
| 42 | /* SMM responder */ |
| 43 | uint32_t smmstore_exec(uint8_t command, void *param); |
| 44 | |
| 45 | /* implementation */ |
| 46 | int smmstore_read_region(void *buf, ssize_t *bufsize); |
| 47 | int smmstore_append_data(void *key, uint32_t key_sz, |
| 48 | void *value, uint32_t value_sz); |
| 49 | int smmstore_clear_region(void); |
| 50 | #endif |