Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

mfmhd.c File Reference

#include <linux/module.h>
#include <linux/config.h>
#include <linux/sched.h>
#include <linux/fs.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/timer.h>
#include <linux/tqueue.h>
#include <linux/mm.h>
#include <linux/errno.h>
#include <linux/genhd.h>
#include <linux/major.h>
#include <linux/ioport.h>
#include <linux/delay.h>
#include <linux/blk.h>
#include <asm/system.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
#include <asm/dma.h>
#include <asm/hardware.h>
#include <asm/ecard.h>
#include <asm/ioc.h>

Include dependency graph for mfmhd.c:

Go to the source code of this file.

Defines

#define MAJOR_NR   MFM_ACORN_MAJOR
#define HDIO_GETGEO   0x301
#define MFM_MAXDRIVES   2
#define ONBOARD_MFM_ADDRESS   ((0x002d0000 >> 2) | 0x80000000)
#define NO_TRACK   -1
#define NEED_1_RECAL   -2
#define NEED_2_RECAL   -3
#define MFM_DRV_INFO   mfm_info[raw_cmd.dev]
#define MFM_COMMAND   (mfm_addr + 0)
#define MFM_DATAOUT   (mfm_addr + 1)
#define MFM_STATUS   (mfm_addr + 8)
#define MFM_DATAIN   (mfm_addr + 9)
#define CMD_ABT   0xF0
#define CMD_SPC   0xE8
#define CMD_TST   0xE0
#define CMD_RCLB   0xC8
#define CMD_SEK   0xC0
#define CMD_WFS   0xAB
#define CMD_WFM   0xA3
#define CMD_MTB   0x90
#define CMD_CMPD   0x88
#define CMD_WD   0x87
#define CMD_RED   0x70
#define CMD_RIS   0x68
#define CMD_FID   0x61
#define CMD_RID   0x60
#define CMD_BTM   0x50
#define CMD_CKD   0x48
#define CMD_RD   0x40
#define CMD_OPBW   0x38
#define CMD_OPBR   0x30
#define CMD_CKV   0x28
#define CMD_CKE   0x20
#define CMD_POD   0x18
#define CMD_POL   0x10
#define CMD_RCAL   0x08
#define STAT_BSY   0x8000
#define STAT_CPR   0x4000
#define STAT_CED   0x2000
#define STAT_SED   0x1000
#define STAT_DER   0x0800
#define STAT_ABN   0x0400
#define STAT_POL   0x0200
#define DBG(x...)
#define IDEA2
#define SPEC_SL   0x00
#define SPEC_SH   0x21

Functions

static void mfm_seek (void)
static void mfm_rerequest (void)
static void mfm_request (void)
static int mfm_reread_partitions (kdev_t dev)
static void mfm_specify (void)
static void issue_request (int dev, unsigned int block, unsigned int nsect, struct request *req)
static void print_status (void)
static void issue_command (int command, unsigned char *cmdb, int len)
static void wait_for_completion (void)
static void wait_for_command_end (void)
static void mfm_rw_intr (void)
static void mfm_setup_rw (void)
static void mfm_recal_intr (void)
static void mfm_seek_intr (void)
static void mfm_setupspecify (int drive, unsigned char *cmdb)
static void mfm_initialise (void)
static void request_done (int uptodate)
static void error_handler (void)
static void rw_interrupt (void)
static void do_mfm_request (void)
static void mfm_interrupt_handler (int unused, void *dev_id, struct pt_regs *regs)
static void mfm_geometry (int drive)
static int mfm_initdrives (void)
static int mfm_ioctl (struct inode *inode, struct file *file, u_int cmd, u_long arg)
static int mfm_open (struct inode *inode, struct file *file)
static int mfm_release (struct inode *inode, struct file *file)
void mfm_setup (char *str, int *ints)
void xd_set_geometry (kdev_t dev, unsigned char secsptrack, unsigned char heads, unsigned long discsize, unsigned int secsize)
static void mfm_geninit (struct gendisk *gdev)
static int mfm_probecontroller (unsigned int mfm_addr)
int mfm_init (void)

Variables

static const card_ids mfm_cids []
mfm_info mfm_info [MFM_MAXDRIVES]
static struct hd_struct mfm [MFM_MAXDRIVES<< 6]
static int mfm_sizes [MFM_MAXDRIVES<< 6]
static int mfm_blocksizes [MFM_MAXDRIVES<< 6]
static int mfm_sectsizes [MFM_MAXDRIVES<< 6]
static struct wait_queue * mfm_wait_open = NULL
unsigned int hdc63463_baseaddress
unsigned int hdc63463_irqpolladdress
unsigned int hdc63463_irqpollmask
unsigned int hdc63463_dataptr
int hdc63463_dataleft
static int lastspecifieddrive
static unsigned Busy
static unsigned int PartFragRead
static unsigned int PartFragRead_RestartBlock
static unsigned int PartFragRead_SectorsLeft
static int Sectors256LeftInCurrent
static int SectorsLeftInRequest
static int Copy_Sector
static char * Copy_buffer
static unsigned int mfm_addr
static unsigned int mfm_IRQPollLoc
static unsigned int mfm_irqenable
static unsigned char mfm_irq
static int mfm_drives = 0
static int mfm_status = 0
static int * errors
static struct rawcmd raw_cmd
static unsigned char result [16]
static struct contcont
int number_mfm_drives = 1
static struct cont rw_cont
static struct gendisk mfm_gendisk
static struct file_operations mfm_fops
static struct expansion_cardecs


Define Documentation

#define CMD_ABT   0xF0
 

Definition at line 281 of file mfmhd.c.

Referenced by mfm_probecontroller().

#define CMD_BTM   0x50
 

Definition at line 295 of file mfmhd.c.

#define CMD_CKD   0x48
 

Definition at line 296 of file mfmhd.c.

#define CMD_CKE   0x20
 

Definition at line 301 of file mfmhd.c.

#define CMD_CKV   0x28
 

Definition at line 300 of file mfmhd.c.

Referenced by mfm_initdrives(), and request_done().

#define CMD_CMPD   0x88
 

Definition at line 289 of file mfmhd.c.

#define CMD_FID   0x61
 

Definition at line 293 of file mfmhd.c.

#define CMD_MTB   0x90
 

Definition at line 288 of file mfmhd.c.

#define CMD_OPBR   0x30
 

Definition at line 299 of file mfmhd.c.

#define CMD_OPBW   0x38
 

Definition at line 298 of file mfmhd.c.

#define CMD_POD   0x18
 

Definition at line 302 of file mfmhd.c.

Referenced by mfm_recal_intr(), and mfm_seek_intr().

#define CMD_POL   0x10
 

Definition at line 303 of file mfmhd.c.

Referenced by mfm_recal_intr(), and mfm_seek_intr().

#define CMD_RCAL   0x08
 

Definition at line 304 of file mfmhd.c.

Referenced by issue_command(), mfm_interrupt_handler(), mfm_probecontroller(), mfm_recal_intr(), mfm_rw_intr(), mfm_seek_intr(), and wait_for_command_end().

#define CMD_RCLB   0xC8
 

Definition at line 284 of file mfmhd.c.

Referenced by mfm_seek().

#define CMD_RD   0x40
 

Definition at line 297 of file mfmhd.c.

Referenced by issue_request().

#define CMD_RED   0x70
 

Definition at line 291 of file mfmhd.c.

#define CMD_RID   0x60
 

Definition at line 294 of file mfmhd.c.

#define CMD_RIS   0x68
 

Definition at line 292 of file mfmhd.c.

#define CMD_SEK   0xC0
 

Definition at line 285 of file mfmhd.c.

Referenced by mfm_probecontroller(), and mfm_seek().

#define CMD_SPC   0xE8
 

Definition at line 282 of file mfmhd.c.

Referenced by mfm_initdrives(), and mfm_specify().

#define CMD_TST   0xE0
 

Definition at line 283 of file mfmhd.c.

#define CMD_WD   0x87
 

Definition at line 290 of file mfmhd.c.

Referenced by issue_request().

#define CMD_WFM   0xA3
 

Definition at line 287 of file mfmhd.c.

#define CMD_WFS   0xAB
 

Definition at line 286 of file mfmhd.c.

#define DBG x...   ) 
 

Definition at line 335 of file mfmhd.c.

#define HDIO_GETGEO   0x301
 

Definition at line 132 of file mfmhd.c.

Referenced by acsi_ioctl(), cciss_ioctl(), DAC960_IOCTL(), ddv_ioctl(), do_dasd_ioctl(), do_format_dasd(), fd_ioctl(), hd_ioctl(), hdio_getgeo(), i2ob_ioctl(), ida_ioctl(), ide_ioctl(), md_ioctl(), mdisk_ioctl(), mfm_ioctl(), pd_ioctl(), pf_ioctl(), sd_ioctl(), sys32_ioctl(), xd_ioctl(), and xpram_ioctl().

#define IDEA2
 

Definition at line 652 of file mfmhd.c.

#define MAJOR_NR   MFM_ACORN_MAJOR
 

Definition at line 116 of file mfmhd.c.

#define MFM_COMMAND   (mfm_addr + 0)
 

Definition at line 276 of file mfmhd.c.

Referenced by issue_command(), mfm_interrupt_handler(), mfm_probecontroller(), mfm_recal_intr(), mfm_rw_intr(), mfm_seek_intr(), and wait_for_command_end().

#define MFM_DATAIN   (mfm_addr + 9)
 

Definition at line 279 of file mfmhd.c.

Referenced by mfm_interrupt_handler(), mfm_rw_intr(), and wait_for_command_end().

#define MFM_DATAOUT   (mfm_addr + 1)
 

Definition at line 277 of file mfmhd.c.

Referenced by issue_command().

#define MFM_DRV_INFO   mfm_info[raw_cmd.dev]
 

Definition at line 193 of file mfmhd.c.

Referenced by error_handler(), mfm_recal_intr(), mfm_seek(), and mfm_seek_intr().

#define MFM_MAXDRIVES   2
 

Definition at line 147 of file mfmhd.c.

#define MFM_STATUS   (mfm_addr + 8)
 

Definition at line 278 of file mfmhd.c.

Referenced by issue_command(), mfm_interrupt_handler(), mfm_probecontroller(), mfm_rw_intr(), wait_for_command_end(), and wait_for_completion().

#define NEED_1_RECAL   -2
 

Definition at line 181 of file mfmhd.c.

Referenced by recal_interrupt(), reset_fdc_info(), and seek_floppy().

#define NEED_2_RECAL   -3
 

Definition at line 182 of file mfmhd.c.

Referenced by bad_flp_intr(), error_handler(), interpret_errors(), mfm_recal_intr(), mfm_seek_intr(), recal_interrupt(), reset_fdc_info(), and seek_interrupt().

#define NO_TRACK   -1
 

Definition at line 180 of file mfmhd.c.

Referenced by raw_cmd_ioctl(), and seek_floppy().

#define ONBOARD_MFM_ADDRESS   ((0x002d0000 >> 2) | 0x80000000)
 

Definition at line 151 of file mfmhd.c.

Referenced by mfm_init().

#define SPEC_SH   0x21
 

Definition at line 658 of file mfmhd.c.

Referenced by mfm_setupspecify().

#define SPEC_SL   0x00
 

Definition at line 657 of file mfmhd.c.

Referenced by mfm_setupspecify().

#define STAT_ABN   0x0400
 

Definition at line 311 of file mfmhd.c.

Referenced by issue_command(), mfm_recal_intr(), mfm_rw_intr(), mfm_seek_intr(), and print_status().

#define STAT_BSY   0x8000
 

Definition at line 306 of file mfmhd.c.

Referenced by internal_command(), issue_command(), mfm_interrupt_handler(), mfm_probecontroller(), mfm_rw_intr(), print_status(), and wait_for_completion().

#define STAT_CED   0x2000
 

Definition at line 308 of file mfmhd.c.

Referenced by issue_command(), mfm_probecontroller(), mfm_recal_intr(), mfm_rw_intr(), mfm_seek_intr(), print_status(), and wait_for_command_end().

#define STAT_CPR   0x4000
 

Definition at line 307 of file mfmhd.c.

Referenced by issue_command(), mfm_interrupt_handler(), mfm_probecontroller(), mfm_rw_intr(), and print_status().

#define STAT_DER   0x0800
 

Definition at line 310 of file mfmhd.c.

Referenced by issue_command(), mfm_recal_intr(), mfm_rw_intr(), mfm_seek_intr(), and print_status().

#define STAT_POL   0x0200
 

Definition at line 312 of file mfmhd.c.

Referenced by issue_command(), and print_status().

#define STAT_SED   0x1000
 

Definition at line 309 of file mfmhd.c.

Referenced by issue_command(), mfm_recal_intr(), mfm_seek_intr(), and print_status().


Function Documentation

static void do_mfm_request void   )  [static]
 

Definition at line 978 of file mfmhd.c.

References DBG, and mfm_request().

Here is the call graph for this function:

static void error_handler void   )  [static]
 

Definition at line 775 of file mfmhd.c.

References errors, MFM_DRV_INFO, NEED_2_RECAL, print_status(), and printk.

Here is the call graph for this function:

static void issue_command int  command,
unsigned char *  cmdb,
int  len
[static]
 

Definition at line 387 of file mfmhd.c.

References CMD_RCAL, DBG, i, inw, MFM_COMMAND, MFM_DATAOUT, MFM_STATUS, outw, STAT_ABN, STAT_BSY, STAT_CED, STAT_CPR, STAT_DER, STAT_POL, STAT_SED, and status.

Referenced by mfm_initdrives(), mfm_recal_intr(), mfm_seek(), mfm_seek_intr(), mfm_setup_rw(), mfm_specify(), and request_done().

static void issue_request int  dev,
unsigned int  block,
unsigned int  nsect,
struct request req
[static]
 

Definition at line 803 of file mfmhd.c.

References CMD_RD, CMD_WD, rawcmd::cmdcode, rawcmd::cmddata, rawcmd::cmdlen, rawcmd::cmdtype, Copy_buffer, CURRENT, rawcmd::cylinder, DBG, rawcmd::dev, errors, hdc63463_dataleft, hdc63463_dataptr, rawcmd::head, IMMEDIATE_BH, lastspecifieddrive, mark_bh, mfm_initialise(), mfm_specify(), PartFragRead, PartFragRead_RestartBlock, PartFragRead_SectorsLeft, queue_task, raw_cmd, READ, tq_struct::routine, rawcmd::sector, sectors, tq_immediate, and WRITE.

Referenced by mfm_request(), and request_done().

Here is the call graph for this function:

static void mfm_geninit struct gendisk gdev  )  [static]
 

Definition at line 1342 of file mfmhd.c.

References blksize_size, hardsect_size, i, MAJOR_NR, mfm_blocksizes, mfm_drives, mfm_geometry(), mfm_initdrives(), mfm_interrupt_handler(), mfm_irq, mfm_irqenable, mfm_sectsizes, gendisk::nr_real, outw, printk, request_irq(), SA_INTERRUPT, and x80.

Here is the call graph for this function:

static void mfm_geometry int  drive  )  [static]
 

Definition at line 1023 of file mfmhd.c.

References heads, hd_struct::nr_sects, printk, sectors, and hd_struct::start_sect.

Referenced by mfm_geninit(), and xd_set_geometry().

int mfm_init void   ) 
 

Definition at line 1432 of file mfmhd.c.

References blk_dev, Busy, DEVICE_REQUEST, ecard_address(), ecard_claim, ecard_find(), ECARD_IOC, ECARD_MEDIUM, gendisk_head, hdc63463_baseaddress, hdc63463_irqpolladdress, hdc63463_irqpollmask, ioaddr, IOC_IRQSTATB, IRQ_HARDDISK, expansion_card::irqmask, lastspecifieddrive, MAJOR_NR, mfm_addr, mfm_irq, mfm_irqenable, mfm_IRQPollLoc, mfm_probecontroller(), gendisk::next, ONBOARD_MFM_ADDRESS, printk, read_ahead, register_blkdev(), blk_dev_struct::request_fn, and request_region.

Referenced by __initfunc().

Here is the call graph for this function:

static int mfm_initdrives void   )  [static]
 

Definition at line 1132 of file mfmhd.c.

References CMD_CKV, CMD_SPC, issue_command(), mfm_setupspecify(), number_mfm_drives, printk, and wait_for_completion().

Referenced by mfm_geninit().

Here is the call graph for this function:

static void mfm_initialise void   )  [static]
 

Definition at line 722 of file mfmhd.c.

References DBG, and mfm_seek().

Referenced by issue_request().

Here is the call graph for this function:

static void mfm_interrupt_handler int  unused,
void *  dev_id,
struct pt_regs regs
[static]
 

Definition at line 984 of file mfmhd.c.

References CLEAR_INTR, CMD_RCAL, DBG, DEVICE_INTR, handler, inw, len, MFM_COMMAND, MFM_DATAIN, MFM_STATUS, mfm_status, outw, print_status(), printk, result, STAT_BSY, and STAT_CPR.

Referenced by mfm_geninit().

Here is the call graph for this function:

static int mfm_ioctl struct inode *  inode,
struct file file,
u_int  cmd,
u_long  arg
[static]
 

Definition at line 1183 of file mfmhd.c.

References BLKFLSBUF, BLKFRAGET, BLKFRASET, BLKGETSIZE, BLKRAGET, BLKRASET, BLKRRPART, BLKSECTGET, CAP_SYS_ADMIN, capable, hd_geometry::cylinders, dev, device, DEVICE_NR, EACCES, EFAULT, EINVAL, fsync_dev(), HDIO_GETGEO, hd_geometry::heads, heads, MAJOR, major, max_readahead, max_sectors, mfm_drives, mfm_reread_partitions(), MINOR, minor, put_user, read_ahead, RO_IOCTLS, hd_geometry::sectors, sectors, hd_geometry::start, and xff.

Here is the call graph for this function:

static int mfm_open struct inode *  inode,
struct file file
[static]
 

Definition at line 1258 of file mfmhd.c.

References busy, dev, DEVICE_NR, ENODEV, mfm_drives, mfm_wait_open, MINOR, MOD_INC_USE_COUNT, and sleep_on().

Here is the call graph for this function:

static int mfm_probecontroller unsigned int  mfm_addr  )  [static]
 

Definition at line 1396 of file mfmhd.c.

References check_region, CMD_ABT, CMD_RCAL, CMD_SEK, count, inw, MFM_COMMAND, MFM_STATUS, outw, STAT_BSY, STAT_CED, STAT_CPR, and udelay.

Referenced by mfm_init().

static void mfm_recal_intr void   )  [static]
 

Definition at line 586 of file mfmhd.c.

References CMD_POD, CMD_POL, CMD_RCAL, issue_command(), MFM_COMMAND, MFM_DRV_INFO, mfm_seek(), mfm_status, NEED_2_RECAL, NULL, outw, print_status(), printk, STAT_ABN, STAT_CED, STAT_DER, and STAT_SED.

Referenced by mfm_seek().

Here is the call graph for this function:

static int mfm_release struct inode *  inode,
struct file file
[static]
 

Definition at line 1277 of file mfmhd.c.

References DEVICE_NR, fsync_dev(), MINOR, and MOD_DEC_USE_COUNT.

Here is the call graph for this function:

static void mfm_request void   )  [static]
 

Definition at line 889 of file mfmhd.c.

References Busy, CLEAR_INTR, Copy_buffer, Copy_Sector, CURRENT, DBG, dev, issue_request(), kdevname(), mfm_drives, MINOR, printk, READ, RQ_INACTIVE, Sectors256LeftInCurrent, SectorsLeftInRequest, hd_struct::start_sect, sti, and WRITE.

Referenced by do_mfm_request(), mfm_rerequest(), and request_done().

Here is the call graph for this function:

static int mfm_reread_partitions kdev_t  dev  )  [static]
 

Definition at line 1490 of file mfmhd.c.

References access_count, busy, DEVICE_NR, EBUSY, get_super(), i, invalidate_inodes(), MAJOR_NR, gendisk::max_p, mfm_wait_open, minor, MINOR, gendisk::minor_shift, MKDEV, hd_struct::nr_sects, gendisk::part, resetup_one_dev(), restore_flags, save_flags_cli, start, hd_struct::start_sect, sync_dev(), and target.

Referenced by mfm_ioctl().

Here is the call graph for this function:

static void mfm_rerequest void   )  [static]
 

Definition at line 881 of file mfmhd.c.

References Busy, cli, DBG, and mfm_request().

Here is the call graph for this function:

static void mfm_rw_intr void   )  [static]
 

Definition at line 445 of file mfmhd.c.

References CMD_RCAL, Copy_buffer, Copy_Sector, CURRENT, DBG, errors, hdc63463_dataleft, hdc63463_dataptr, inw, len, MFM_COMMAND, MFM_DATAIN, MFM_STATUS, mfm_status, outw, print_status(), printk, result, Sectors256LeftInCurrent, SectorsLeftInRequest, STAT_ABN, STAT_BSY, STAT_CED, STAT_CPR, STAT_DER, and WRITE.

Referenced by mfm_setup_rw().

Here is the call graph for this function:

static void mfm_seek void   )  [static]
 

Definition at line 694 of file mfmhd.c.

References CMD_RCLB, CMD_SEK, rawcmd::cylinder, DBG, rawcmd::dev, issue_command(), MFM_DRV_INFO, mfm_recal_intr(), mfm_seek_intr(), mfm_setup_rw(), mfm_specify(), and raw_cmd.

Referenced by mfm_initialise(), mfm_recal_intr(), and mfm_seek_intr().

Here is the call graph for this function:

static void mfm_seek_intr void   )  [static]
 

Definition at line 619 of file mfmhd.c.

References CMD_POD, CMD_POL, CMD_RCAL, rawcmd::cylinder, issue_command(), MFM_COMMAND, MFM_DRV_INFO, mfm_seek(), mfm_status, NEED_2_RECAL,