1 /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* Copyright (C) 2018-2019, Intel Corporation. 3 4 #ifndef _PLDMFW_H_ 5 #define _PLDMFW_H_ 6 7 #include <linux/list.h> 8 #include <linux/firmware.h> 9 10 #define PLDM_DEVICE_UPDATE_CONTINUE_AFTER_FAIL 11 12 #define PLDM_STRING_TYPE_UNKNOWN 0 13 #define PLDM_STRING_TYPE_ASCII 1 14 #define PLDM_STRING_TYPE_UTF8 2 15 #define PLDM_STRING_TYPE_UTF16 3 16 #define PLDM_STRING_TYPE_UTF16LE 4 17 #define PLDM_STRING_TYPE_UTF16BE 5 18 19 struct pldmfw_record { 20 struct list_head entry; 21 22 /* List of descriptor TLVs */ 23 struct list_head descs; 24 25 /* Component Set version string*/ 26 const u8 *version_string; 27 u8 version_type; 28 u8 version_len; 29 30 /* Package Data length */ 31 u16 package_data_len; 32 33 /* Bitfield of Device Update Flags */ 34 u32 device_update_flags; 35 36 /* Package Data block */ 37 const u8 *package_data; 38 39 /* Bitmap of components applicable to 40 unsigned long *component_bitmap; 41 u16 component_bitmap_len; 42 }; 43 44 /* Standard descriptor TLV identifiers */ 45 #define PLDM_DESC_ID_PCI_VENDOR_ID 0x0000 46 #define PLDM_DESC_ID_IANA_ENTERPRISE_ID 0x0001 47 #define PLDM_DESC_ID_UUID 0x0002 48 #define PLDM_DESC_ID_PNP_VENDOR_ID 0x0003 49 #define PLDM_DESC_ID_ACPI_VENDOR_ID 0x0004 50 #define PLDM_DESC_ID_PCI_DEVICE_ID 0x0100 51 #define PLDM_DESC_ID_PCI_SUBVENDOR_ID 0x0101 52 #define PLDM_DESC_ID_PCI_SUBDEV_ID 0x0102 53 #define PLDM_DESC_ID_PCI_REVISION_ID 0x0103 54 #define PLDM_DESC_ID_PNP_PRODUCT_ID 0x0104 55 #define PLDM_DESC_ID_ACPI_PRODUCT_ID 0x0105 56 #define PLDM_DESC_ID_VENDOR_DEFINED 0xFFFF 57 58 struct pldmfw_desc_tlv { 59 struct list_head entry; 60 61 const u8 *data; 62 u16 type; 63 u16 size; 64 }; 65 66 #define PLDM_CLASSIFICATION_UNKNOWN 67 #define PLDM_CLASSIFICATION_OTHER 68 #define PLDM_CLASSIFICATION_DRIVER 69 #define PLDM_CLASSIFICATION_CONFIG_SW 70 #define PLDM_CLASSIFICATION_APP_SW 71 #define PLDM_CLASSIFICATION_INSTRUMENTATION 72 #define PLDM_CLASSIFICATION_BIOS 73 #define PLDM_CLASSIFICATION_DIAGNOSTIC_SW 74 #define PLDM_CLASSIFICATION_OS 75 #define PLDM_CLASSIFICATION_MIDDLEWARE 76 #define PLDM_CLASSIFICATION_FIRMWARE 77 #define PLDM_CLASSIFICATION_CODE 78 #define PLDM_CLASSIFICATION_SERVICE_PACK 79 #define PLDM_CLASSIFICATION_SOFTWARE_BUNDLE 80 81 #define PLDM_ACTIVATION_METHOD_AUTO 82 #define PLDM_ACTIVATION_METHOD_SELF_CONTAINED 83 #define PLDM_ACTIVATION_METHOD_MEDIUM_SPECIFIC 84 #define PLDM_ACTIVATION_METHOD_REBOOT 85 #define PLDM_ACTIVATION_METHOD_DC_CYCLE 86 #define PLDM_ACTIVATION_METHOD_AC_CYCLE 87 88 #define PLDMFW_COMPONENT_OPTION_FORCE_UPDATE 89 #define PLDMFW_COMPONENT_OPTION_USE_COMPARISON 90 91 struct pldmfw_component { 92 struct list_head entry; 93 94 /* component identifier */ 95 u16 classification; 96 u16 identifier; 97 98 u16 options; 99 u16 activation_method; 100 101 u32 comparison_stamp; 102 103 u32 component_size; 104 const u8 *component_data; 105 106 /* Component version string */ 107 const u8 *version_string; 108 u8 version_type; 109 u8 version_len; 110 111 /* component index */ 112 u8 index; 113 114 }; 115 116 /* Transfer flag used for sending components t 117 #define PLDM_TRANSFER_FLAG_START 118 #define PLDM_TRANSFER_FLAG_MIDDLE 119 #define PLDM_TRANSFER_FLAG_END 120 121 struct pldmfw_ops; 122 123 /* Main entry point to the PLDM firmware updat 124 * should embed this in a private structure an 125 * a pointer to their own data, used to implem 126 * operations. 127 */ 128 struct pldmfw { 129 const struct pldmfw_ops *ops; 130 struct device *dev; 131 }; 132 133 bool pldmfw_op_pci_match_record(struct pldmfw 134 135 /* Operations invoked by the generic PLDM firm 136 * implement device specific logic. 137 * 138 * @match_record: check if the device matches 139 * convenience, a standard implementation is p 140 * 141 * @send_package_data: send the package data a 142 * record to firmware. 143 * 144 * @send_component_table: send the component d 145 * component to firmware. Called once for each 146 * 147 * @flash_component: Flash the data for a give 148 * Called once for each applicable component, 149 * been sent. 150 * 151 * @finalize_update: (optional) Finish the upd 152 * have been flashed. 153 */ 154 struct pldmfw_ops { 155 bool (*match_record)(struct pldmfw *co 156 int (*send_package_data)(struct pldmfw 157 int (*send_component_table)(struct pld 158 u8 transfe 159 int (*flash_component)(struct pldmfw * 160 int (*finalize_update)(struct pldmfw * 161 }; 162 163 int pldmfw_flash_image(struct pldmfw *context, 164 165 #endif 166
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.