linux/include/linux/pldmfw.h

/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (C) 2018-2019, Intel Corporation. */

#ifndef _PLDMFW_H_
#define _PLDMFW_H_

#include <linux/list.h>
#include <linux/firmware.h>

#define PLDM_DEVICE_UPDATE_CONTINUE_AFTER_FAIL

#define PLDM_STRING_TYPE_UNKNOWN
#define PLDM_STRING_TYPE_ASCII
#define PLDM_STRING_TYPE_UTF8
#define PLDM_STRING_TYPE_UTF16
#define PLDM_STRING_TYPE_UTF16LE
#define PLDM_STRING_TYPE_UTF16BE

struct pldmfw_record {};

/* Standard descriptor TLV identifiers */
#define PLDM_DESC_ID_PCI_VENDOR_ID
#define PLDM_DESC_ID_IANA_ENTERPRISE_ID
#define PLDM_DESC_ID_UUID
#define PLDM_DESC_ID_PNP_VENDOR_ID
#define PLDM_DESC_ID_ACPI_VENDOR_ID
#define PLDM_DESC_ID_PCI_DEVICE_ID
#define PLDM_DESC_ID_PCI_SUBVENDOR_ID
#define PLDM_DESC_ID_PCI_SUBDEV_ID
#define PLDM_DESC_ID_PCI_REVISION_ID
#define PLDM_DESC_ID_PNP_PRODUCT_ID
#define PLDM_DESC_ID_ACPI_PRODUCT_ID
#define PLDM_DESC_ID_VENDOR_DEFINED

struct pldmfw_desc_tlv {};

#define PLDM_CLASSIFICATION_UNKNOWN
#define PLDM_CLASSIFICATION_OTHER
#define PLDM_CLASSIFICATION_DRIVER
#define PLDM_CLASSIFICATION_CONFIG_SW
#define PLDM_CLASSIFICATION_APP_SW
#define PLDM_CLASSIFICATION_INSTRUMENTATION
#define PLDM_CLASSIFICATION_BIOS
#define PLDM_CLASSIFICATION_DIAGNOSTIC_SW
#define PLDM_CLASSIFICATION_OS
#define PLDM_CLASSIFICATION_MIDDLEWARE
#define PLDM_CLASSIFICATION_FIRMWARE
#define PLDM_CLASSIFICATION_CODE
#define PLDM_CLASSIFICATION_SERVICE_PACK
#define PLDM_CLASSIFICATION_SOFTWARE_BUNDLE

#define PLDM_ACTIVATION_METHOD_AUTO
#define PLDM_ACTIVATION_METHOD_SELF_CONTAINED
#define PLDM_ACTIVATION_METHOD_MEDIUM_SPECIFIC
#define PLDM_ACTIVATION_METHOD_REBOOT
#define PLDM_ACTIVATION_METHOD_DC_CYCLE
#define PLDM_ACTIVATION_METHOD_AC_CYCLE

#define PLDMFW_COMPONENT_OPTION_FORCE_UPDATE
#define PLDMFW_COMPONENT_OPTION_USE_COMPARISON_STAMP

struct pldmfw_component {};

/* Transfer flag used for sending components to the firmware */
#define PLDM_TRANSFER_FLAG_START
#define PLDM_TRANSFER_FLAG_MIDDLE
#define PLDM_TRANSFER_FLAG_END

struct pldmfw_ops;

/* Main entry point to the PLDM firmware update engine. Device drivers
 * should embed this in a private structure and use container_of to obtain
 * a pointer to their own data, used to implement the device specific
 * operations.
 */
struct pldmfw {};

bool pldmfw_op_pci_match_record(struct pldmfw *context, struct pldmfw_record *record);

/* Operations invoked by the generic PLDM firmware update engine. Used to
 * implement device specific logic.
 *
 * @match_record: check if the device matches the given record. For
 * convenience, a standard implementation is provided for PCI devices.
 *
 * @send_package_data: send the package data associated with the matching
 * record to firmware.
 *
 * @send_component_table: send the component data associated with a given
 * component to firmware. Called once for each applicable component.
 *
 * @flash_component: Flash the data for a given component to the device.
 * Called once for each applicable component, after all component tables have
 * been sent.
 *
 * @finalize_update: (optional) Finish the update. Called after all components
 * have been flashed.
 */
struct pldmfw_ops {};

int pldmfw_flash_image(struct pldmfw *context, const struct firmware *fw);

#endif