diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-17 12:09:14 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2008-10-17 12:09:14 -0400 |
commit | 806f80a6fc203ad0bde84e5a9e94572617d2ae45 (patch) | |
tree | 20c684323e6e9f24af96df84008f06425a67ec6a /drivers/ide/ide-floppy.h | |
parent | 79cb380397c834a35952d8497651d93b543ef968 (diff) |
ide: add generic ATA/ATAPI disk driver
* Add struct ide_disk_ops containing protocol specific methods.
* Add 'struct ide_disk_ops *' to ide_drive_t.
* Convert ide-{disk,floppy} drivers to use struct ide_disk_ops.
* Merge ide-{disk,floppy} drivers into generic ide-gd driver.
While at it:
- ide_disk_init_capacity() -> ide_disk_get_capacity()
Acked-by: Borislav Petkov <petkovbb@gmail.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.h')
-rw-r--r-- | drivers/ide/ide-floppy.h | 58 |
1 files changed, 10 insertions, 48 deletions
diff --git a/drivers/ide/ide-floppy.h b/drivers/ide/ide-floppy.h index b965da2f41ce..acebc8c5a827 100644 --- a/drivers/ide/ide-floppy.h +++ b/drivers/ide/ide-floppy.h | |||
@@ -1,48 +1,10 @@ | |||
1 | #ifndef __IDE_FLOPPY_H | 1 | #ifndef __IDE_FLOPPY_H |
2 | #define __IDE_FLOPPY_H | 2 | #define __IDE_FLOPPY_H |
3 | 3 | ||
4 | #define DRV_NAME "ide-floppy" | 4 | #include "ide-gd.h" |
5 | #define PFX DRV_NAME ": " | ||
6 | 5 | ||
7 | /* define to see debug info */ | 6 | #ifdef CONFIG_IDE_GD_ATAPI |
8 | #define IDEFLOPPY_DEBUG_LOG 0 | 7 | typedef struct ide_disk_obj idefloppy_floppy_t; |
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 | |||
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 | |||
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 | |||
33 | /* Last error information */ | ||
34 | u8 sense_key, asc, ascq; | ||
35 | |||
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 | 8 | ||
47 | /* | 9 | /* |
48 | * Pages of the SELECT SENSE / MODE SENSE packet commands. | 10 | * Pages of the SELECT SENSE / MODE SENSE packet commands. |
@@ -57,23 +19,23 @@ typedef struct ide_floppy_obj { | |||
57 | #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 | 19 | #define IDEFLOPPY_IOCTL_FORMAT_START 0x4602 |
58 | #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 | 20 | #define IDEFLOPPY_IOCTL_FORMAT_GET_PROGRESS 0x4603 |
59 | 21 | ||
60 | sector_t ide_gd_capacity(ide_drive_t *); | ||
61 | |||
62 | /* ide-floppy.c */ | 22 | /* ide-floppy.c */ |
23 | extern const struct ide_disk_ops ide_atapi_disk_ops; | ||
63 | void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8); | 24 | void ide_floppy_create_mode_sense_cmd(struct ide_atapi_pc *, u8); |
64 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *); | 25 | void ide_floppy_create_read_capacity_cmd(struct ide_atapi_pc *); |
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); | ||
69 | 26 | ||
70 | /* ide-floppy_ioctl.c */ | 27 | /* ide-floppy_ioctl.c */ |
71 | int ide_floppy_ioctl(struct inode *, struct file *, unsigned, unsigned long); | 28 | int ide_floppy_ioctl(ide_drive_t *, struct inode *, struct file *, unsigned int, |
29 | unsigned long); | ||
72 | 30 | ||
73 | #ifdef CONFIG_IDE_PROC_FS | 31 | #ifdef CONFIG_IDE_PROC_FS |
74 | /* ide-floppy_proc.c */ | 32 | /* ide-floppy_proc.c */ |
75 | extern ide_proc_entry_t ide_floppy_proc[]; | 33 | extern ide_proc_entry_t ide_floppy_proc[]; |
76 | extern const struct ide_proc_devset ide_floppy_settings[]; | 34 | extern const struct ide_proc_devset ide_floppy_settings[]; |
77 | #endif | 35 | #endif |
36 | #else | ||
37 | #define ide_floppy_proc NULL | ||
38 | #define ide_floppy_settings NULL | ||
39 | #endif | ||
78 | 40 | ||
79 | #endif /*__IDE_FLOPPY_H */ | 41 | #endif /*__IDE_FLOPPY_H */ |