linux/drivers/platform/x86/intel/ifs/load.c

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright(c) 2022 Intel Corporation. */

#include <linux/firmware.h>
#include <linux/sizes.h>
#include <asm/cpu.h>
#include <asm/microcode.h>

#include "ifs.h"

#define IFS_CHUNK_ALIGNMENT
meta_data;

#define IFS_HEADER_SIZE
#define META_TYPE_IFS
#define INVALIDATE_STRIDE
#define IFS_GEN_STRIDE_AWARE
#define AUTH_INTERRUPTED_ERROR
#define IFS_AUTH_RETRY_CT

static  struct microcode_header_intel *ifs_header_ptr;	/* pointer to the ifs image header */
static u64 ifs_hash_ptr;			/* Address of ifs metadata (hash) */
static u64 ifs_test_image_ptr;			/* 256B aligned address of test pattern */
static DECLARE_COMPLETION(ifs_done);

static const char * const scan_hash_status[] =;

static const char * const scan_authentication_status[] =;

#define MC_HEADER_META_TYPE_END

struct metadata_header {};

static struct metadata_header *find_meta_data(void *ucode, unsigned int meta_type)
{}

static void hashcopy_err_message(struct device *dev, u32 err_code)
{}

static void auth_err_message(struct device *dev, u32 err_code)
{}

/*
 * To copy scan hashes and authenticate test chunks, the initiating cpu must point
 * to the EDX:EAX to the test image in linear address.
 * Run wrmsr(MSR_COPY_SCAN_HASHES) for scan hash copy and run wrmsr(MSR_AUTHENTICATE_AND_COPY_CHUNK)
 * for scan hash copy and test chunk authentication.
 */
static void copy_hashes_authenticate_chunks(struct work_struct *work)
{}

static int get_num_chunks(int gen, union ifs_scan_hashes_status_gen2 status)
{}

static bool need_copy_scan_hashes(struct ifs_data *ifsd)
{}

static int copy_hashes_authenticate_chunks_gen2(struct device *dev)
{}

static int validate_ifs_metadata(struct device *dev)
{}

/*
 * IFS requires scan chunks authenticated per each socket in the platform.
 * Once the test chunk is authenticated, it is automatically copied to secured memory
 * and proceed the authentication for the next chunk.
 */
static int scan_chunks_sanity_check(struct device *dev)
{}

static int image_sanity_check(struct device *dev, const struct microcode_header_intel *data)
{}

/*
 * Load ifs image. Before loading ifs module, the ifs image must be located
 * in /lib/firmware/intel/ifs_x/ and named as family-model-stepping-02x.{testname}.
 */
int ifs_load_firmware(struct device *dev)
{}