1 /* SPDX-License-Identifier: BSD-3-Clause */ 2 3 /* Ported from mosys project (http://code.google.com/p/mosys/). */ 4 5 #ifndef __LIB_VPD_TABLES_H__ 6 #define __LIB_VPD_TABLES_H__ 7 8 #include <stdint.h> 9 10 #define VPD_ENTRY_MAGIC "_SM_" 11 #define VPD_INFO_MAGIC \ 12 "\xfe" /* type: VPD header */ \ 13 "\x09" /* key length, 9 = 1 + 8 */ \ 14 "\x01" /* info version, 1 */ \ 15 "gVpdInfo" /* signature, 8 bytes */ \ 16 "\x04" /* value length */ 17 18 /* Google specific VPD info */ 19 struct google_vpd_info { 20 union { 21 struct { 22 uint8_t type; 23 uint8_t key_len; 24 uint8_t info_ver; 25 uint8_t signature[8]; 26 uint8_t value_len; 27 } tlv; 28 uint8_t magic[12]; 29 } header; 30 uint32_t size; 31 } __packed; 32 33 /* Entry */ 34 struct vpd_entry { 35 uint8_t anchor_string[4]; 36 uint8_t entry_cksum; 37 uint8_t entry_length; 38 uint8_t major_ver; 39 uint8_t minor_ver; 40 uint16_t max_size; 41 uint8_t entry_rev; 42 uint8_t format_area[5]; 43 uint8_t inter_anchor_string[5]; 44 uint8_t inter_anchor_cksum; 45 uint16_t table_length; 46 uint32_t table_address; 47 uint16_t table_entry_count; 48 uint8_t bcd_revision; 49 } __packed; 50 51 /* Header */ 52 struct vpd_header { 53 uint8_t type; 54 uint8_t length; 55 uint16_t handle; 56 } __packed; 57 58 /* Type 0 - firmware information */ 59 struct vpd_table_firmware { 60 uint8_t vendor; 61 uint8_t version; 62 uint16_t start_address; 63 uint8_t release_date; 64 uint8_t rom_size_64k_blocks; 65 uint32_t characteristics; 66 uint8_t extension[2]; /* v2.4+ */ 67 uint8_t major_ver; /* v2.4+ */ 68 uint8_t minor_ver; /* v2.4+ */ 69 uint8_t ec_major_ver; /* v2.4+ */ 70 uint8_t ec_minor_ver; /* v2.4+ */ 71 } __packed; 72 73 /* Type 1 - system information */ 74 struct vpd_table_system { 75 uint8_t manufacturer; 76 uint8_t name; 77 uint8_t version; 78 uint8_t serial_number; 79 uint8_t uuid[16]; 80 uint8_t wakeup_type; 81 uint8_t sku_number; /* v2.4+ */ 82 uint8_t family; /* v2.4+ */ 83 } __packed; 84 85 /* Type 127 - end of table */ 86 struct vpd_table_eot { 87 struct vpd_header header; 88 } __packed; 89 90 /* Type 241 - binary blob pointer */ 91 struct vpd_table_binary_blob_pointer { 92 uint8_t struct_major_version; 93 uint8_t struct_minor_version; 94 uint8_t vendor; 95 uint8_t description; 96 uint8_t major_version; 97 uint8_t minor_version; 98 uint8_t variant; 99 uint8_t reserved[5]; 100 uint8_t uuid[16]; 101 uint32_t offset; 102 uint32_t size; 103 } __packed; 104 105 /* The length and number of strings defined here is not a limitation of VPD. 106 * These numbers were deemed good enough during development. */ 107 #define VPD_MAX_STRINGS 10 108 #define VPD_MAX_STRING_LENGTH 64 109 110 #endif /* __LIB_VPD_TABLES_H__ */ 111