aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ide/ide-floppy.c
diff options
context:
space:
mode:
authorBorislav Petkov <bbpetkov@yahoo.de>2008-02-02 13:56:34 -0500
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-02-02 13:56:34 -0500
commit948391d17c34b87811e1ddbe1fa96b670510e5e1 (patch)
tree9858d2fd4e33c75ba9181641e8dea4ddbfa655cc /drivers/ide/ide-floppy.c
parentbcc77d9cc12f5fd3e54ea01a6ef8f09e4d7b54a8 (diff)
ide-floppy: remove struct idefloppy_capabilities_page
This change is rather temporary and is in preparation of using generic commands as is the case with ide-cd and the uniform cdrom layer (i.e. init_cdrom_command()) However, before this happens, we'll have to remove all typedefs and teach idefloppy_create_mode_sense_cmd() to work directly on u8 buffers. Also, since idefloppy_get_capability_page() was used to read only the sfrp bit, rename the latter so that the name reflects what it does. Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-floppy.c')
-rw-r--r--drivers/ide/ide-floppy.c55
1 files changed, 6 insertions, 49 deletions
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index 2860398b193c..13cb08f5eb92 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -120,44 +120,6 @@ typedef struct idefloppy_packet_command_s {
120#define PC_SUPPRESS_ERROR 6 /* Suppress error reporting */ 120#define PC_SUPPRESS_ERROR 6 /* Suppress error reporting */
121 121
122/* 122/*
123 * Removable Block Access Capabilities Page
124 */
125typedef struct {
126#if defined(__LITTLE_ENDIAN_BITFIELD)
127 unsigned page_code :6; /* Page code - Should be 0x1b */
128 unsigned reserved1_6 :1; /* Reserved */
129 unsigned ps :1; /* Should be 0 */
130#elif defined(__BIG_ENDIAN_BITFIELD)
131 unsigned ps :1; /* Should be 0 */
132 unsigned reserved1_6 :1; /* Reserved */
133 unsigned page_code :6; /* Page code - Should be 0x1b */
134#else
135#error "Bitfield endianness not defined! Check your byteorder.h"
136#endif
137 u8 page_length; /* Page Length - Should be 0xa */
138#if defined(__LITTLE_ENDIAN_BITFIELD)
139 unsigned reserved2 :6;
140 unsigned srfp :1; /* Supports reporting progress of format */
141 unsigned sflp :1; /* System floppy type device */
142 unsigned tlun :3; /* Total logical units supported by the device */
143 unsigned reserved3 :3;
144 unsigned sml :1; /* Single / Multiple lun supported */
145 unsigned ncd :1; /* Non cd optical device */
146#elif defined(__BIG_ENDIAN_BITFIELD)
147 unsigned sflp :1; /* System floppy type device */
148 unsigned srfp :1; /* Supports reporting progress of format */
149 unsigned reserved2 :6;
150 unsigned ncd :1; /* Non cd optical device */
151 unsigned sml :1; /* Single / Multiple lun supported */
152 unsigned reserved3 :3;
153 unsigned tlun :3; /* Total logical units supported by the device */
154#else
155#error "Bitfield endianness not defined! Check your byteorder.h"
156#endif
157 u8 reserved[8];
158} idefloppy_capabilities_page_t;
159
160/*
161 * Flexible disk page. 123 * Flexible disk page.
162 */ 124 */
163typedef struct { 125typedef struct {
@@ -397,7 +359,8 @@ typedef struct {
397} idefloppy_request_sense_result_t; 359} idefloppy_request_sense_result_t;
398 360
399/* 361/*
400 * Pages of the SELECT SENSE / MODE SENSE packet commands. 362 * Pages of the SELECT SENSE / MODE SENSE packet commands.
363 * See SFF-8070i spec.
401 */ 364 */
402#define IDEFLOPPY_CAPABILITIES_PAGE 0x1b 365#define IDEFLOPPY_CAPABILITIES_PAGE 0x1b
403#define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05 366#define IDEFLOPPY_FLEXIBLE_DISK_PAGE 0x05
@@ -1273,25 +1236,20 @@ static int idefloppy_get_flexible_disk_page (ide_drive_t *drive)
1273 return 0; 1236 return 0;
1274} 1237}
1275 1238
1276static int idefloppy_get_capability_page(ide_drive_t *drive) 1239static int idefloppy_get_sfrp_bit(ide_drive_t *drive)
1277{ 1240{
1278 idefloppy_floppy_t *floppy = drive->driver_data; 1241 idefloppy_floppy_t *floppy = drive->driver_data;
1279 idefloppy_pc_t pc; 1242 idefloppy_pc_t pc;
1280 idefloppy_mode_parameter_header_t *header;
1281 idefloppy_capabilities_page_t *page;
1282 1243
1283 floppy->srfp = 0; 1244 floppy->srfp = 0;
1284 idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE, 1245 idefloppy_create_mode_sense_cmd(&pc, IDEFLOPPY_CAPABILITIES_PAGE,
1285 MODE_SENSE_CURRENT); 1246 MODE_SENSE_CURRENT);
1286 1247
1287 set_bit(PC_SUPPRESS_ERROR, &pc.flags); 1248 set_bit(PC_SUPPRESS_ERROR, &pc.flags);
1288 if (idefloppy_queue_pc_tail(drive,&pc)) { 1249 if (idefloppy_queue_pc_tail(drive, &pc))
1289 return 1; 1250 return 1;
1290 }
1291 1251
1292 header = (idefloppy_mode_parameter_header_t *) pc.buffer; 1252 floppy->srfp = pc.buffer[8 + 2] & 0x40;
1293 page= (idefloppy_capabilities_page_t *)(header+1);
1294 floppy->srfp = page->srfp;
1295 return (0); 1253 return (0);
1296} 1254}
1297 1255
@@ -1497,8 +1455,7 @@ static int idefloppy_begin_format(ide_drive_t *drive, int __user *arg)
1497 return (-EFAULT); 1455 return (-EFAULT);
1498 } 1456 }
1499 1457
1500 /* Get the SFRP bit */ 1458 (void) idefloppy_get_sfrp_bit(drive);
1501 (void) idefloppy_get_capability_page(drive);
1502 idefloppy_create_format_unit_cmd(&pc, blocks, length, flags); 1459 idefloppy_create_format_unit_cmd(&pc, blocks, length, flags);
1503 if (idefloppy_queue_pc_tail(drive, &pc)) { 1460 if (idefloppy_queue_pc_tail(drive, &pc)) {
1504 return (-EIO); 1461 return (-EIO);