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

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

#include <linux/cpu.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/semaphore.h>
#include <linux/slab.h>

#include "ifs.h"

/*
 * Protects against simultaneous tests on multiple cores, or
 * reloading can file while a test is in progress
 */
static DEFINE_SEMAPHORE(ifs_sem, 1);

/*
 * The sysfs interface to check additional details of last test
 * cat /sys/devices/system/platform/ifs/details
 */
static ssize_t details_show(struct device *dev,
			    struct device_attribute *attr,
			    char *buf)
{}

static DEVICE_ATTR_RO(details);

static const char * const status_msg[] =;

/*
 * The sysfs interface to check the test status:
 * To check the status of last test
 * cat /sys/devices/platform/ifs/status
 */
static ssize_t status_show(struct device *dev,
			   struct device_attribute *attr,
			   char *buf)
{}

static DEVICE_ATTR_RO(status);

/*
 * The sysfs interface for single core testing
 * To start test, for example, cpu5
 * echo 5 > /sys/devices/platform/ifs/run_test
 * To check the result:
 * cat /sys/devices/platform/ifs/result
 * The sibling core gets tested at the same time.
 */
static ssize_t run_test_store(struct device *dev,
			      struct device_attribute *attr,
			      const char *buf, size_t count)
{}

static DEVICE_ATTR_WO(run_test);

static ssize_t current_batch_store(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{}

static ssize_t current_batch_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RW(current_batch);

/*
 * Display currently loaded IFS image version.
 */
static ssize_t image_version_show(struct device *dev,
				  struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(image_version);

/* global scan sysfs attributes */
struct attribute *plat_ifs_attrs[] =;

/* global array sysfs attributes */
struct attribute *plat_ifs_array_attrs[] =;