linux/arch/x86/kernel/cpuid.c

// SPDX-License-Identifier: GPL-2.0-or-later
/* ----------------------------------------------------------------------- *
 *
 *   Copyright 2000-2008 H. Peter Anvin - All Rights Reserved
 *
 * ----------------------------------------------------------------------- */

/*
 * x86 CPUID access device
 *
 * This device is accessed by lseek() to the appropriate CPUID level
 * and then read in chunks of 16 bytes.  A larger size means multiple
 * reads of consecutive levels.
 *
 * The lower 32 bits of the file position is used as the incoming %eax,
 * and the upper 32 bits of the file position as the incoming %ecx,
 * the latter intended for "counting" eax levels like eax=4.
 *
 * This driver uses /dev/cpu/%d/cpuid where %d is the minor number, and on
 * an SMP box will direct the access to CPU %d.
 */

#include <linux/module.h>

#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fcntl.h>
#include <linux/init.h>
#include <linux/poll.h>
#include <linux/smp.h>
#include <linux/major.h>
#include <linux/fs.h>
#include <linux/device.h>
#include <linux/cpu.h>
#include <linux/notifier.h>
#include <linux/uaccess.h>
#include <linux/gfp.h>
#include <linux/completion.h>

#include <asm/processor.h>
#include <asm/msr.h>

static enum cpuhp_state cpuhp_cpuid_state;

struct cpuid_regs_done {};

static void cpuid_smp_cpuid(void *cmd_block)
{}

static ssize_t cpuid_read(struct file *file, char __user *buf,
			  size_t count, loff_t *ppos)
{}

static int cpuid_open(struct inode *inode, struct file *file)
{}

/*
 * File operations we support
 */
static const struct file_operations cpuid_fops =;

static char *cpuid_devnode(const struct device *dev, umode_t *mode)
{}

static const struct class cpuid_class =;

static int cpuid_device_create(unsigned int cpu)
{}

static int cpuid_device_destroy(unsigned int cpu)
{}

static int __init cpuid_init(void)
{}
module_init();

static void __exit cpuid_exit(void)
{}
module_exit(cpuid_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();