#include <linux/module.h>#include <linux/sched.h>#include <linux/fs.h>#include <linux/kernel.h>#include <linux/timer.h>#include <linux/tqueue.h>#include <linux/fdreg.h>#include <linux/fd.h>#include <linux/hdreg.h>#include <linux/errno.h>#include <linux/malloc.h>#include <linux/mm.h>#include <linux/string.h>#include <linux/fcntl.h>#include <linux/delay.h>#include <linux/mc146818rtc.h>#include <linux/ioport.h>#include <linux/interrupt.h>#include <linux/init.h>#include <asm/dma.h>#include <asm/irq.h>#include <asm/system.h>#include <asm/io.h>#include <asm/uaccess.h>#include <asm/floppy.h>#include <linux/blk.h>#include <linux/cdrom.h>Include dependency graph for floppy.c:

Go to the source code of this file.
Defines | |
| #define | FLOPPY_SANITY_CHECK |
| #define | REALLY_SLOW_IO |
| #define | DEBUGT 2 |
| #define | DCL_DEBUG |
| #define | FDPATCHES |
| #define | K_64 0x10000 |
| #define | MAJOR_NR FLOPPY_MAJOR |
| #define | fd_get_dma_residue() get_dma_residue(FLOPPY_DMA) |
| #define | fd_dma_mem_free(addr, size) free_pages(addr, __get_order(size)) |
| #define | fd_dma_mem_alloc(size) __get_dma_pages(GFP_KERNEL,__get_order(size)) |
| #define | ITYPE(x) (((x)>>2) & 0x1f) |
| #define | TOMINOR(x) ((x & 3) | ((x & 4) << 5)) |
| #define | UNIT(x) ((x) & 0x03) |
| #define | FDC(x) (((x) & 0x04) >> 2) |
| #define | REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) |
| #define | DP (&drive_params[current_drive]) |
| #define | DRS (&drive_state[current_drive]) |
| #define | DRWE (&write_errors[current_drive]) |
| #define | FDCS (&fdc_state[fdc]) |
| #define | CLEARF(x) (clear_bit(x##_BIT, &DRS->flags)) |
| #define | SETF(x) (set_bit(x##_BIT, &DRS->flags)) |
| #define | TESTF(x) (test_bit(x##_BIT, &DRS->flags)) |
| #define | UDP (&drive_params[drive]) |
| #define | UDRS (&drive_state[drive]) |
| #define | UDRWE (&write_errors[drive]) |
| #define | UFDCS (&fdc_state[FDC(drive)]) |
| #define | UCLEARF(x) (clear_bit(x##_BIT, &UDRS->flags)) |
| #define | USETF(x) (set_bit(x##_BIT, &UDRS->flags)) |
| #define | UTESTF(x) (test_bit(x##_BIT, &UDRS->flags)) |
| #define | DPRINT(format, args...) printk(DEVICE_NAME "%d: " format, current_drive , ## args) |
| #define | PH_HEAD(floppy, head) (((((floppy)->stretch & 2) >>1) ^ head) << 2) |
| #define | STRETCH(floppy) ((floppy)->stretch & FD_STRETCH) |
| #define | CLEARSTRUCT(x) memset((x), 0, sizeof(*(x))) |
| #define | INT_OFF save_flags(flags); cli() |
| #define | INT_ON restore_flags(flags) |
| #define | COMMAND raw_cmd->cmd[0] |
| #define | DR_SELECT raw_cmd->cmd[1] |
| #define | TRACK raw_cmd->cmd[2] |
| #define | HEAD raw_cmd->cmd[3] |
| #define | SECTOR raw_cmd->cmd[4] |
| #define | SIZECODE raw_cmd->cmd[5] |
| #define | SECT_PER_TRACK raw_cmd->cmd[6] |
| #define | GAP raw_cmd->cmd[7] |
| #define | SIZECODE2 raw_cmd->cmd[8] |
| #define | NR_RW 9 |
| #define | F_SIZECODE raw_cmd->cmd[2] |
| #define | F_SECT_PER_TRACK raw_cmd->cmd[3] |
| #define | F_GAP raw_cmd->cmd[4] |
| #define | F_FILL raw_cmd->cmd[5] |
| #define | NR_F 6 |
| #define | MAX_DISK_SIZE 4 |
| #define | MAX_REPLIES 16 |
| #define | ST0 (reply_buffer[0]) |
| #define | ST1 (reply_buffer[1]) |
| #define | ST2 (reply_buffer[2]) |
| #define | ST3 (reply_buffer[0]) |
| #define | R_TRACK (reply_buffer[3]) |
| #define | R_HEAD (reply_buffer[4]) |
| #define | R_SECTOR (reply_buffer[5]) |
| #define | R_SIZECODE (reply_buffer[6]) |
| #define | SEL_DLY (2*HZ/100) |
| #define | ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
| #define | NUMBER(x) (sizeof(x) / sizeof(*(x))) |
| #define | SECTSIZE (_FD_SECTSIZE(*floppy)) |
| #define | FD_COMMAND_NONE -1 |
| #define | FD_COMMAND_ERROR 2 |
| #define | FD_COMMAND_OKAY 3 |
| #define | NO_SIGNAL (!interruptible || !signal_pending(current)) |
| #define | CALL(x) if ((x) == -EINTR) return -EINTR |
| #define | ECALL(x) if ((ret = (x))) return ret; |
| #define | _WAIT(x, i) CALL(ret=wait_til_done((x),i)) |
| #define | WAIT(x) _WAIT((x),interruptible) |
| #define | IWAIT(x) _WAIT((x),1) |
| #define | CHECK_RESET { if (FDCS->reset){ reset_fdc(); return; } } |
| #define | NO_TRACK -1 |
| #define | NEED_1_RECAL -2 |
| #define | NEED_2_RECAL -3 |
| #define | fd_eject(x) -EINVAL |
| #define | OLOGSIZE 20 |
| #define | CURRENTD -1 |
| #define | MAXTIMEOUT -2 |
| #define | INFBOUND(a, b) (a)=maximum((a),(b)); |
| #define | SUPBOUND(a, b) (a)=minimum((a),(b)); |
| #define | LOCK_FDC(drive, interruptible) if (lock_fdc(drive,interruptible)) return -EINTR; |
| #define | LAST_OUT(x) if (output_byte(x)<0){ reset_fdc();return;} |
| #define | MORE_OUTPUT -2 |
| #define | NOMINAL_DTR 500 |
| #define | CODE2SIZE (ssize = ((1 << SIZECODE) + 3) >> 2) |
| #define | FM_MODE(x, y) ((y) & ~(((x)->rate & 0x80) >>1)) |
| #define | CT(x) ((x) | 0xc0) |
| #define | REPEAT {request_done(0); continue; } |
| #define | _COPYOUT(x) (copy_to_user((void *)param, &(x), sizeof(x)) ? -EFAULT : 0) |
| #define | _COPYIN(x) (copy_from_user(&(x), (void *)param, sizeof(x)) ? -EFAULT : 0) |
| #define | COPYOUT(x) ECALL(_COPYOUT(x)) |
| #define | COPYIN(x) ECALL(_COPYIN(x)) |
| #define | IOCTL_MODE_BIT 8 |
| #define | OPEN_WRITE_BIT 16 |
| #define | IOCTL_ALLOWED (filp && (filp->f_mode & IOCTL_MODE_BIT)) |
| #define | OUT(c, x) case c: outparam = (const char *) (x); break |
| #define | IN(c, x, tag) case c: *(x) = inparam. tag ; return 0 |
| #define | RETERR(x) do{floppy_release(inode,filp); return -(x);}while(0) |
| #define | NO_GEOM (!current_type[drive] && !TYPE(dev)) |
| #define | FLOPPY_SETUP |
Typedefs | |
| typedef void(* | done_f )(int) |
| typedef void(* | timeout_fn )(unsigned long) |
Functions | |
| void | floppy_interrupt (int irq, void *dev_id, struct pt_regs *regs) |
| static int | set_dor (int fdc, char mask, char data) |
| static int | __get_order (unsigned long size) |
| static void | fallback_on_nodma_alloc (char **addr, size_t l) |
| static int | TYPE (kdev_t x) |
| static int | DRIVE (kdev_t x) |
| static void | floppy_ready (void) |
| static void | floppy_start (void) |
| static void | process_fd_request (void) |
| static void | recalibrate_floppy (void) |
| static void | floppy_shutdown (void) |
| static int | floppy_grab_irq_and_dma (void) |
| static void | floppy_release_irq_and_dma (void) |
| static void | reset_fdc (void) |
| static void | set_debugt (void) |
| static void | debugt (const char *message) |
| static void | is_alive (const char *message) |
| static void | reschedule_timeout (int drive, const char *message, int marg) |
| static int | maximum (int a, int b) |
| static int | minimum (int a, int b) |
| static int | disk_change (int drive) |
| static int | is_selected (int dor, int unit) |
| static void | twaddle (void) |
| static void | reset_fdc_info (int mode) |
| static void | set_fdc (int drive) |
| static int | lock_fdc (int drive, int interruptible) |
| static void | unlock_fdc (void) |
| static void | motor_off_callback (unsigned long nr) |
| static void | floppy_off (unsigned int drive) |
| static void | scandrives (void) |
| static void | empty (void) |
| static void | schedule_bh (void(*handler)(void *)) |
| static void | cancel_activity (void) |
| static void | fd_watchdog (void) |
| static void | main_command_interrupt (void) |
| static int | wait_for_completion (unsigned long delay, timeout_fn function) |
| static void | floppy_disable_hlt (void) |
| static void | floppy_enable_hlt (void) |
| static void | setup_DMA (void) |
| static void | show_floppy (void) |
| static int | wait_til_ready (void) |
| static int | output_byte (char byte) |
| static int | result (void) |
| static int | need_more_output (void) |
| static void | perpendicular_mode (void) |
| static int | fdc_configure (void) |
| static void | fdc_specify (void) |
| static int | fdc_dtr (void) |
| static void | tell_sector (void) |
| static int | interpret_errors (void) |
| static void | setup_rw_floppy (void) |
| static void | seek_interrupt (void) |
| static void | check_wp (void) |
| static void | seek_floppy (void) |
| static void | recal_interrupt (void) |
| static void | print_result (char *message, int inr) |
| static void | reset_interrupt (void) |
| static int | start_motor (void(*function)(void)) |
| static void | do_wakeup (void) |
| static int | wait_til_done (void(*handler)(void), int interruptible) |
| static void | generic_done (int result) |
| static void | generic_success (void) |
| static void | generic_failure (void) |
| static void | success_and_wakeup (void) |
| static int | next_valid_format (void) |
| static void | bad_flp_intr (void) |
| static void | set_floppy (kdev_t device) |
| static void | format_interrupt (void) |
| static void | setup_format_params (int track) |
| static void | redo_format (void) |
| static int | do_format (kdev_t device, struct format_descr *tmp_format_req) |
| static void | request_done (int uptodate) |
| static void | rw_interrupt (void) |
| static int | buffer_chain_size (void) |
| static int | transfer_size (int ssize, int max_sector, int max_size) |
| static void | copy_buffer (int ssize, int max_sector, int max_sector_2) |
| static void | virtualdmabug_workaround (void) |
| static int | make_raw_rw_request (void) |
| static void | redo_fd_request (void) |
| static void | do_fd_request (void) |
| static int | poll_drive (int interruptible, int flag) |
| static void | reset_intr (void) |
| static int | user_reset_fdc (int drive, int arg, int interruptible) |
| static int | fd_copyout (void *param, const void *address, unsigned long size) |
| static int | fd_copyin (void *param, void *address, unsigned long size) |
| static const char * | drive_name (int type, int drive) |
| static void | raw_cmd_done (int flag) |
| static int | raw_cmd_copyout (int cmd, char *param, struct floppy_raw_cmd *ptr) |
| static void | raw_cmd_free (struct floppy_raw_cmd **ptr) |
| static int | raw_cmd_copyin (int cmd, char *param, struct floppy_raw_cmd **rcmd) |
| static int | raw_cmd_ioctl (int cmd, void *param) |
| static int | invalidate_drive (kdev_t rdev) |
| static void | clear_write_error (int drive) |
| static int | set_geometry (unsigned int cmd, struct floppy_struct *g, int drive, int type, kdev_t device) |
| static int | normalize_ioctl (int *cmd, int *size) |
| static int | get_floppy_geometry (int drive, int type, struct floppy_struct **g) |
| static int | fd_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long param) |
| static void | config_types (void) |
| static ssize_t | floppy_read (struct file *filp, char *buf, size_t count, loff_t *ppos) |
| static ssize_t | floppy_write (struct file *filp, const char *buf, size_t count, loff_t *ppos) |
| static int | floppy_release (struct inode *inode, struct file *filp) |
| static int | floppy_open (struct inode *inode, struct file *filp) |
| static int | check_floppy_change (kdev_t dev) |
| static int | floppy_revalidate (kdev_t dev) |
| __initfunc (static char get_fdc_version(void)) | |
| __initfunc (static void floppy_set_flags(int *ints, int param, int param2)) | |
| __initfunc (static void set_cmos(int *ints, int dummy, int dummy2)) | |
| __initfunc (void floppy_setup(char *str, int *ints)) | |
| __initfunc (int floppy_init(void)) | |
| void | floppy_eject (void) |
Variables | |
| static int | print_unex = 1 |
| static int | FLOPPY_IRQ = 6 |
| static int | FLOPPY_DMA = 2 |
| static int | allowed_drive_mask = 0x33 |
| static int | irqdma_allocated = 0 |
| static int | slow_floppy = 0 |
| static int | can_use_virtual_dma = 2 |
| static int | use_virtual_dma = 0 |
| static unsigned short | virtual_dma_port = 0x3f0 |
| static unsigned long | fake_change = 0 |
| static int | initialising = 1 |
| static unsigned char | reply_buffer [MAX_REPLIES] |
| static int | inr |
| struct { | |
| floppy_drive_params params | |
| const char * name | |
| } | default_drive_params [] |
| static struct floppy_drive_params | drive_params [N_DRIVE] |
| static struct floppy_drive_struct | drive_state [N_DRIVE] |
| static struct floppy_write_errors | write_errors [N_DRIVE] |
| static struct floppy_raw_cmd * | raw_cmd |
| static struct floppy_raw_cmd | default_raw_cmd |
| static struct floppy_struct | floppy_type [32] |
| static struct floppy_struct * | current_type [N_DRIVE] |
| static struct floppy_struct | user_params [N_DRIVE] |
| static int | floppy_sizes [256] |
| static int | floppy_blocksizes [256] = { 0, } |
| static int | probing = 0 |
| static volatile int | command_status = FD_COMMAND_NONE |
| static volatile int | fdc_busy = 0 |
| static struct wait_queue * | fdc_wait = NULL |
| static struct wait_queue * | command_done = NULL |
| static int | format_errors |
| static struct format_descr | format_req |
| static char * | floppy_track_buffer = 0 |
| static int | max_buffer_sectors = 0 |
| static int * | errors |
| static struct cont_t * | cont |
| static int | usage_count = 0 |
| static int | buffer_track = -1 |
| static int | buffer_drive = -1 |
| static int | buffer_min = -1 |
| static int | buffer_max = -1 |
| static struct floppy_fdc_state | fdc_state [N_FDC] |
| static int | fdc |
| static struct floppy_struct * | _floppy = floppy_type |
| static unsigned char | current_drive = 0 |
| static long | current_count_sectors = 0 |
| static unsigned char | sector_t |
| static unsigned char | in_sector_offset |
| static long unsigned | debugtimer |
| static struct timer_list | fd_timeout |
| static const char * | timeout_message |
| static void(* | lasthandler )(void) = NULL |
| static unsigned long | interruptjiffies = 0 |
| static unsigned long | resultjiffies = 0 |
| static int | resultsize = 0 |
| static unsigned long | lastredo = 0 |
| static struct output_log | output_log [OLOGSIZE] |
| static int | output_log_pos = 0 |
| static struct timer_list | motor_off_timer [N_DRIVE] |
| static struct tq_struct | floppy_tq |
| static struct timer_list | fd_timer = { NULL, NULL, 0, 0, 0 } |
| static int | hlt_disabled = 0 |
| static int | fifo_depth = 0xa |
| static int | no_fifo = 0 |
| static int | blind_seek |
| static struct cont_t | wakeup_cont |
| static struct cont_t | intr_cont |
| static struct cont_t | format_cont |
| static struct cont_t | rw_cont |
| static struct cont_t | poll_cont |
| static struct cont_t | reset_cont |
| static struct cont_t | raw_cmd_cont |
| static int | ioctl_table [] |
| static struct file_operations | floppy_fops |
| static struct param_table | config_params [] |
| static int | have_no_fdc = -EIO |
|
|
|
|
|
Definition at line 3032 of file floppy.c. Referenced by fd_ioctl(). |
|
|
|
|
|
Definition at line 338 of file floppy.c. Referenced by __initfunc(), do_qcomm(), normalize_ioctl(), rtl8139_init_board(), and ultrastor_14f_detect(). |
|
|
Definition at line 477 of file floppy.c. Referenced by fd_ioctl(), get_floppy_geometry(), and set_geometry(). |
|
|
Definition at line 531 of file floppy.c. Referenced by floppy_ready(). |
|
|
Definition at line 272 of file floppy.c. Referenced by check_wp(), interpret_errors(), recal_interrupt(), and seek_interrupt(). |
|
|
Definition at line 289 of file floppy.c. Referenced by __initfunc(), clear_write_error(), and fd_ioctl(). |
|
|
Definition at line 2145 of file floppy.c. Referenced by make_raw_rw_request(), and rw_interrupt(). |
|
|
Definition at line 295 of file floppy.c. Referenced by copy_buffer(), epic_interrupt(), epic_open(), epic_pause(), epic_restart(), epic_start_xmit(), epic_tx_timeout(), make_raw_rw_request(), rw_interrupt(), setup_format_params(), and virtualdmabug_workaround(). |
|
|
Definition at line 3036 of file floppy.c. Referenced by raw_cmd_copyin(). |
|
|
Definition at line 3035 of file floppy.c. Referenced by raw_cmd_copyout(). |
|
|
Definition at line 2147 of file floppy.c. Referenced by copy_buffer(), make_raw_rw_request(), rw_interrupt(), and virtualdmabug_workaround(). |
|
|
Definition at line 627 of file floppy.c. Referenced by floppy_start(), redo_fd_request(), and reschedule_timeout(). |
|
|
|
|
|
Definition at line 120 of file floppy.c. Referenced by debugt(). |
|
|
|
|
|
|
|
|
Definition at line 296 of file floppy.c. Referenced by make_raw_rw_request(), and setup_format_params(). |
|
|
Definition at line 269 of file floppy.c. Referenced by bad_flp_intr(), interpret_errors(), make_raw_rw_request(), next_valid_format(), raw_cmd_ioctl(), recal_interrupt(), redo_fd_request(), request_done(), rw_interrupt(), seek_floppy(), seek_interrupt(), set_geometry(), setup_rw_floppy(), start_motor(), and twaddle(). |
|
|
Definition at line 270 of file floppy.c. Referenced by bad_flp_intr(), and request_done(). |
|
|
Definition at line 478 of file floppy.c. Referenced by fd_ioctl(), raw_cmd_copyin(), and raw_cmd_copyout(). |
|
|
Definition at line 310 of file floppy.c. Referenced by setup_format_params(). |
|
|
Definition at line 309 of file floppy.c. Referenced by setup_format_params(). |
|
|
Definition at line 308 of file floppy.c. Referenced by setup_format_params(). |
|
|
Definition at line 307 of file floppy.c. Referenced by setup_format_params(). |
|
|
Definition at line 471 of file floppy.c. Referenced by wait_til_done(). |
|
|
Definition at line 470 of file floppy.c. Referenced by lock_fdc(), unlock_fdc(), and wait_til_done(). |
|
|
Definition at line 472 of file floppy.c. Referenced by wait_til_done(). |
|
|
Definition at line 234 of file floppy.c. Referenced by floppy_open(), and raw_cmd_copyin(). |
|
|
Definition at line 230 of file floppy.c. Referenced by floppy_open(), floppy_release_irq_and_dma(), and raw_cmd_free(). |
|
|
Definition at line 565 of file floppy.c. Referenced by fd_ioctl(), floppy_eject(), floppy_ioctl(), and swim3_fd_eject(). |
|
|
Definition at line 210 of file floppy.c. Referenced by raw_cmd_done(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 2146 of file floppy.c. Referenced by make_raw_rw_request(), and setup_format_params(). |
|
|
Definition at line 302 of file floppy.c. Referenced by make_raw_rw_request(). |
|
|
Definition at line 298 of file floppy.c. Referenced by make_raw_rw_request(), mcdx_xfer(), and rw_interrupt(). |
|
|
|
|
|
Definition at line 656 of file floppy.c. Referenced by bad_flp_intr(), fdc_specify(), floppy_open(), floppy_write(), |