linux/drivers/mtd/rfd_ftl.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * rfd_ftl.c -- resident flash disk (flash translation layer)
 *
 * Copyright © 2005  Sean Young <[email protected]>
 *
 * This type of flash translation layer (FTL) is used by the Embedded BIOS
 * by General Software. It is known as the Resident Flash Disk (RFD), see:
 *
 *	http://www.gensw.com/pages/prod/bios/rfd.htm
 *
 * based on ftl.c
 */

#include <linux/hdreg.h>
#include <linux/init.h>
#include <linux/mtd/blktrans.h>
#include <linux/mtd/mtd.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/jiffies.h>
#include <linux/module.h>

#include <asm/types.h>

static int block_size =;
module_param(block_size, int, 0);
MODULE_PARM_DESC();

#define PREFIX

/* This major has been assigned by [email protected] */
#ifndef RFD_FTL_MAJOR
#define RFD_FTL_MAJOR
#endif

/* Maximum number of partitions in an FTL region */
#define PART_BITS

/* An erase unit should start with this value */
#define RFD_MAGIC

/* the second value is 0xffff or 0xffc8; function unknown */

/* the third value is always 0xffff, ignored */

/* next is an array of mapping for each corresponding sector */
#define HEADER_MAP_OFFSET
#define SECTOR_DELETED
#define SECTOR_ZERO
#define SECTOR_FREE

#define SECTOR_SIZE

#define SECTORS_PER_TRACK

struct block {};

struct partition {};

static int rfd_ftl_writesect(struct mtd_blktrans_dev *dev, u_long sector, char *buf);

static int build_block_map(struct partition *part, int block_no)
{}

static int scan_header(struct partition *part)
{}

static int rfd_ftl_readsect(struct mtd_blktrans_dev *dev, u_long sector, char *buf)
{}

static int erase_block(struct partition *part, int block)
{}

static int move_block_contents(struct partition *part, int block_no, u_long *old_sector)
{}

static int reclaim_block(struct partition *part, u_long *old_sector)
{}

/*
 * IMPROVE: It would be best to choose the block with the most deleted sectors,
 * because if we fill that one up first it'll have the most chance of having
 * the least live sectors at reclaim.
 */
static int find_free_block(struct partition *part)
{}

static int find_writable_block(struct partition *part, u_long *old_sector)
{}

static int mark_sector_deleted(struct partition *part, u_long old_addr)
{}

static int find_free_sector(const struct partition *part, const struct block *block)
{}

static int do_writesect(struct mtd_blktrans_dev *dev, u_long sector, char *buf, ulong *old_addr)
{}

static int rfd_ftl_writesect(struct mtd_blktrans_dev *dev, u_long sector, char *buf)
{}

static int rfd_ftl_discardsect(struct mtd_blktrans_dev *dev,
			       unsigned long sector, unsigned int nr_sects)
{}

static int rfd_ftl_getgeo(struct mtd_blktrans_dev *dev, struct hd_geometry *geo)
{}

static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
{}

static void rfd_ftl_remove_dev(struct mtd_blktrans_dev *dev)
{}

static struct mtd_blktrans_ops rfd_ftl_tr =;

module_mtd_blktrans();

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