linux/drivers/platform/x86/dell/dell_rbu.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * dell_rbu.c
 * Bios Update driver for Dell systems
 * Author: Dell Inc
 *         Abhay Salunke <[email protected]>
 *
 * Copyright (C) 2005 Dell Inc.
 *
 * Remote BIOS Update (rbu) driver is used for updating DELL BIOS by
 * creating entries in the /sys file systems on Linux 2.6 and higher
 * kernels. The driver supports two mechanism to update the BIOS namely
 * contiguous and packetized. Both these methods still require having some
 * application to set the CMOS bit indicating the BIOS to update itself
 * after a reboot.
 *
 * Contiguous method:
 * This driver writes the incoming data in a monolithic image by allocating
 * contiguous physical pages large enough to accommodate the incoming BIOS
 * image size.
 *
 * Packetized method:
 * The driver writes the incoming packet image by allocating a new packet
 * on every time the packet data is written. This driver requires an
 * application to break the BIOS image in to fixed sized packet chunks.
 *
 * See Documentation/admin-guide/dell_rbu.rst for more info.
 */

#define pr_fmt(fmt)

#include <linux/init.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/blkdev.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
#include <linux/moduleparam.h>
#include <linux/firmware.h>
#include <linux/dma-mapping.h>
#include <asm/set_memory.h>

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

#define BIOS_SCAN_LIMIT
#define MAX_IMAGE_LENGTH
static struct _rbu_data {} rbu_data;

static char image_type[MAX_IMAGE_LENGTH + 1] =;
module_param_string();
MODULE_PARM_DESC();

static unsigned long allocation_floor =;
module_param(allocation_floor, ulong, 0644);
MODULE_PARM_DESC();

struct packet_data {};

static struct packet_data packet_data_head;

static struct platform_device *rbu_device;
static int context;

static void init_packet_head(void)
{}

static int create_packet(void *data, size_t length)
{}

static int packetize_data(const u8 *data, size_t length)
{}

static int do_packet_read(char *data, struct packet_data *newpacket,
	int length, int bytes_read, int *list_read_count)
{}

static int packet_read_list(char *data, size_t * pread_length)
{}

static void packet_empty_list(void)
{}

/*
 * img_update_free: Frees the buffer allocated for storing BIOS image
 * Always called with lock held and returned with lock held
 */
static void img_update_free(void)
{}

/*
 * img_update_realloc: This function allocates the contiguous pages to
 * accommodate the requested size of data. The memory address and size
 * values are stored globally and on every call to this function the new
 * size is checked to see if more data is required than the existing size.
 * If true the previous memory is freed and new allocation is done to
 * accommodate the new size. If the incoming size is less then than the
 * already allocated size, then that memory is reused. This function is
 * called with lock held and returns with lock held.
 */
static int img_update_realloc(unsigned long size)
{}

static ssize_t read_packet_data(char *buffer, loff_t pos, size_t count)
{}

static ssize_t read_rbu_mono_data(char *buffer, loff_t pos, size_t count)
{}

static ssize_t data_read(struct file *filp, struct kobject *kobj,
			 struct bin_attribute *bin_attr,
			 char *buffer, loff_t pos, size_t count)
{}
static BIN_ATTR_RO(data, 0);

static void callbackfn_rbu(const struct firmware *fw, void *context)
{}

static ssize_t image_type_read(struct file *filp, struct kobject *kobj,
			       struct bin_attribute *bin_attr,
			       char *buffer, loff_t pos, size_t count)
{}

static ssize_t image_type_write(struct file *filp, struct kobject *kobj,
				struct bin_attribute *bin_attr,
				char *buffer, loff_t pos, size_t count)
{}
static BIN_ATTR_RW(image_type, 0);

static ssize_t packet_size_read(struct file *filp, struct kobject *kobj,
				struct bin_attribute *bin_attr,
				char *buffer, loff_t pos, size_t count)
{}

static ssize_t packet_size_write(struct file *filp, struct kobject *kobj,
				 struct bin_attribute *bin_attr,
				 char *buffer, loff_t pos, size_t count)
{}
static BIN_ATTR_RW(packet_size, 0);

static struct bin_attribute *rbu_bin_attrs[] =;

static const struct attribute_group rbu_group =;

static int __init dcdrbu_init(void)
{}

static __exit void dcdrbu_exit(void)
{}

module_exit(dcdrbu_exit);
module_init();