Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 1 | #ifndef __IDE_FLOPPY_H |
| 2 | #define __IDE_FLOPPY_H |
| 3 | |
Bartlomiej Zolnierkiewicz | c84d9bb | 2008-10-17 18:09:13 +0200 | [diff] [blame^] | 4 | #define DRV_NAME "ide-floppy" |
| 5 | #define PFX DRV_NAME ": " |
| 6 | |
| 7 | /* define to see debug info */ |
| 8 | #define IDEFLOPPY_DEBUG_LOG 0 |
| 9 | |
| 10 | #if IDEFLOPPY_DEBUG_LOG |
| 11 | #define ide_debug_log(lvl, fmt, args...) __ide_debug_log(lvl, fmt, args) |
| 12 | #else |
| 13 | #define ide_debug_log(lvl, fmt, args...) do {} while (0) |
| 14 | #endif |
| 15 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 16 | /* |
| 17 | * Most of our global data which we need to save even as we leave the driver |
| 18 | * due to an interrupt or a timer event is stored in a variable of type |
| 19 | * idefloppy_floppy_t, defined below. |
| 20 | */ |
| 21 | typedef struct ide_floppy_obj { |
| 22 | ide_drive_t *drive; |
| 23 | ide_driver_t *driver; |
| 24 | struct gendisk *disk; |
| 25 | struct kref kref; |
| 26 | unsigned int openers; /* protected by BKL for now */ |
| 27 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 28 | /* Last failed packet command */ |
| 29 | struct ide_atapi_pc *failed_pc; |
| 30 | /* used for blk_{fs,pc}_request() requests */ |
| 31 | struct ide_atapi_pc queued_pc; |
| 32 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 33 | /* Last error information */ |
| 34 | u8 sense_key, asc, ascq; |
Bartlomiej Zolnierkiewicz | baf08f0 | 2008-10-13 21:39:32 +0200 | [diff] [blame] | 35 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 36 | int progress_indication; |
| 37 | |
| 38 | /* Device information */ |
| 39 | /* Current format */ |
| 40 | int blocks, block_size, bs_factor; |
| 41 | /* Last format capacity descriptor */ |
| 42 | u8 cap_desc[8]; |
| 43 | /* Copy of the flexible disk page */ |
| 44 | u8 flexible_disk_page[32]; |
| 45 | } idefloppy_floppy_t; |
| 46 | |
| 47 | /* |
| 48 | * Pages of the SELECT SENSE / MODE SENSE packet commands. |
| 49 | * See SFF-8070i spec. |
| 50 | */ |
| 51 | #define IDEFLOPPY_CAPABILITIES_PAGE 0x1b |
| 52 | #define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 |
| 53 | |
| 54 | /* IOCTLs used in low-level formatting. */ |
| 55 | #define IDEFLOPPY_IOCTL_FORMAT_SUPPORTED 0x4600 |
| 56 | #define IDEFLOPPY_IOCTL_FORMAT_GET_CAPACITY 0x4601 |
| 57 | #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 |
| 58 | #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 |
| 59 | |
Bartlomiej Zolnierkiewicz | c84d9bb | 2008-10-17 18:09:13 +0200 | [diff] [blame^] | 60 | sector_t ide_floppy_capacity(ide_drive_t *); |
| 61 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 62 | /* ide-floppy.c */ |
| 63 | void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8); |
| 64 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *); |
Bartlomiej Zolnierkiewicz | c84d9bb | 2008-10-17 18:09:13 +0200 | [diff] [blame^] | 65 | int ide_floppy_get_capacity(ide_drive_t *); |
| 66 | void ide_floppy_setup(ide_drive_t *); |
| 67 | ide_startstop_t ide_floppy_do_request(ide_drive_t *, struct request *, sector_t); |
| 68 | int ide_floppy_end_request(ide_drive_t *, int, int); |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 69 | |
| 70 | /* ide-floppy_ioctl.c */ |
Bartlomiej Zolnierkiewicz | 5bb1536 | 2008-10-13 21:39:44 +0200 | [diff] [blame] | 71 | int ide_floppy_ioctl(struct inode *, struct file *, unsigned, unsigned long); |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 72 | |
Bartlomiej Zolnierkiewicz | b9103da | 2008-10-13 21:39:44 +0200 | [diff] [blame] | 73 | #ifdef CONFIG_IDE_PROC_FS |
| 74 | /* ide-floppy_proc.c */ |
| 75 | extern ide_proc_entry_t ide_floppy_proc[]; |
| 76 | extern const struct ide_proc_devset ide_floppy_settings[]; |
| 77 | #endif |
| 78 | |
Bartlomiej Zolnierkiewicz | 0127854 | 2008-10-10 22:39:38 +0200 | [diff] [blame] | 79 | #endif /*__IDE_FLOPPY_H */ |