linux/drivers/firmware/edd.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * linux/drivers/firmware/edd.c
 *  Copyright (C) 2002, 2003, 2004 Dell Inc.
 *  by Matt Domsch <[email protected]>
 *  disk signature by Matt Domsch, Andrew Wilks, and Sandeep K. Shandilya
 *  legacy CHS by Patrick J. LoPresti <[email protected]>
 *
 * BIOS Enhanced Disk Drive Services (EDD)
 * conformant to T13 Committee www.t13.org
 *   projects 1572D, 1484D, 1386D, 1226DT
 *
 * This code takes information provided by BIOS EDD calls
 * fn41 - Check Extensions Present and
 * fn48 - Get Device Parameters with EDD extensions
 * made in setup.S, copied to safe structures in setup.c,
 * and presents it in sysfs.
 *
 * Please see http://linux.dell.com/edd/results.html for
 * the list of BIOSs which have been reported to implement EDD.
 */

#include <linux/module.h>
#include <linux/string.h>
#include <linux/types.h>
#include <linux/init.h>
#include <linux/stat.h>
#include <linux/err.h>
#include <linux/ctype.h>
#include <linux/slab.h>
#include <linux/limits.h>
#include <linux/device.h>
#include <linux/pci.h>
#include <linux/blkdev.h>
#include <linux/edd.h>

#define EDD_VERSION
#define EDD_DATE

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

#define left

struct edd_device {};

struct edd_attribute {};

/* forward declarations */
static int edd_dev_is_type(struct edd_device *edev, const char *type);
static struct pci_dev *edd_get_pci_dev(struct edd_device *edev);

static struct edd_device *edd_devices[EDD_MBR_SIG_MAX];

#define EDD_DEVICE_ATTR(_name,_mode,_show,_test)

static int
edd_has_mbr_signature(struct edd_device *edev)
{}

static int
edd_has_edd_info(struct edd_device *edev)
{}

static inline struct edd_info *
edd_dev_get_info(struct edd_device *edev)
{}

static inline void
edd_dev_set_info(struct edd_device *edev, int i)
{}

#define to_edd_attr(_attr)
#define to_edd_device(obj)

static ssize_t
edd_attr_show(struct kobject * kobj, struct attribute *attr, char *buf)
{}

static const struct sysfs_ops edd_attr_ops =;

static ssize_t
edd_show_host_bus(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_interface(struct edd_device *edev, char *buf)
{}

/**
 * edd_show_raw_data() - copies raw data to buffer for userspace to parse
 * @edev: target edd_device
 * @buf: output buffer
 *
 * Returns: number of bytes written, or -EINVAL on failure
 */
static ssize_t
edd_show_raw_data(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_version(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_mbr_signature(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_extensions(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_info_flags(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_legacy_max_head(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_default_cylinders(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_default_heads(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_default_sectors_per_track(struct edd_device *edev, char *buf)
{}

static ssize_t
edd_show_sectors(struct edd_device *edev, char *buf)
{}


/*
 * Some device instances may not have all the above attributes,
 * or the attribute values may be meaningless (i.e. if
 * the device is < EDD 3.0, it won't have host_bus and interface
 * information), so don't bother making files for them.  Likewise
 * if the default_{cylinders,heads,sectors_per_track} values
 * are zero, the BIOS doesn't provide sane values, don't bother
 * creating files for them either.
 */

static int
edd_has_legacy_max_cylinder(struct edd_device *edev)
{}

static int
edd_has_legacy_max_head(struct edd_device *edev)
{}

static int
edd_has_legacy_sectors_per_track(struct edd_device *edev)
{}

static int
edd_has_default_cylinders(struct edd_device *edev)
{}

static int
edd_has_default_heads(struct edd_device *edev)
{}

static int
edd_has_default_sectors_per_track(struct edd_device *edev)
{}

static int
edd_has_edd30(struct edd_device *edev)
{}


static EDD_DEVICE_ATTR(raw_data, 0444, edd_show_raw_data, edd_has_edd_info);
static EDD_DEVICE_ATTR(version, 0444, edd_show_version, edd_has_edd_info);
static EDD_DEVICE_ATTR(extensions, 0444, edd_show_extensions, edd_has_edd_info);
static EDD_DEVICE_ATTR(info_flags, 0444, edd_show_info_flags, edd_has_edd_info);
static EDD_DEVICE_ATTR(sectors, 0444, edd_show_sectors, edd_has_edd_info);
static EDD_DEVICE_ATTR(legacy_max_cylinder, 0444,
                       edd_show_legacy_max_cylinder,
		       edd_has_legacy_max_cylinder);
static EDD_DEVICE_ATTR(legacy_max_head, 0444, edd_show_legacy_max_head,
		       edd_has_legacy_max_head);
static EDD_DEVICE_ATTR(legacy_sectors_per_track, 0444,
                       edd_show_legacy_sectors_per_track,
		       edd_has_legacy_sectors_per_track);
static EDD_DEVICE_ATTR(default_cylinders, 0444, edd_show_default_cylinders,
		       edd_has_default_cylinders);
static EDD_DEVICE_ATTR(default_heads, 0444, edd_show_default_heads,
		       edd_has_default_heads);
static EDD_DEVICE_ATTR(default_sectors_per_track, 0444,
		       edd_show_default_sectors_per_track,
		       edd_has_default_sectors_per_track);
static EDD_DEVICE_ATTR(interface, 0444, edd_show_interface, edd_has_edd30);
static EDD_DEVICE_ATTR(host_bus, 0444, edd_show_host_bus, edd_has_edd30);
static EDD_DEVICE_ATTR(mbr_signature, 0444, edd_show_mbr_signature, edd_has_mbr_signature);

/* These attributes are conditional and only added for some devices. */
static struct edd_attribute * edd_attrs[] =;

/**
 *	edd_release - free edd structure
 *	@kobj:	kobject of edd structure
 *
 *	This is called when the refcount of the edd structure
 *	reaches 0. This should happen right after we unregister,
 *	but just in case, we use the release callback anyway.
 */

static void edd_release(struct kobject * kobj)
{}

static const struct kobj_type edd_ktype =;

static struct kset *edd_kset;


/**
 * edd_dev_is_type() - is this EDD device a 'type' device?
 * @edev: target edd_device
 * @type: a host bus or interface identifier string per the EDD spec
 *
 * Returns 1 (TRUE) if it is a 'type' device, 0 otherwise.
 */
static int
edd_dev_is_type(struct edd_device *edev, const char *type)
{}

/**
 * edd_get_pci_dev() - finds pci_dev that matches edev
 * @edev: edd_device
 *
 * Returns pci_dev if found, or NULL
 */
static struct pci_dev *
edd_get_pci_dev(struct edd_device *edev)
{}

static int
edd_create_symlink_to_pcidev(struct edd_device *edev)
{}

static inline void
edd_device_unregister(struct edd_device *edev)
{}

static void edd_populate_dir(struct edd_device * edev)
{}

static int
edd_device_register(struct edd_device *edev, int i)
{}

static inline int edd_num_devices(void)
{}

/**
 * edd_init() - creates sysfs tree of EDD data
 */
static int __init
edd_init(void)
{}

static void __exit
edd_exit(void)
{}

late_initcall(edd_init);
module_exit(edd_exit);