diff options
author | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:42 -0400 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> | 2009-03-24 18:22:42 -0400 |
commit | b0b391430bea405ced6038e4cf4d8cf831511935 (patch) | |
tree | 163da180a355778398381b2dba387ac5d8748229 /drivers/ide/ide-acpi.c | |
parent | 1f5892a5d21c905b1614cbd6bd8c5ad2cfbc106f (diff) |
ide-acpi: remove taskfile_load_raw()
* taskfile_load_raw() is used only by do_drive_set_taskfiles()
so inline it there.
While at it:
- rename 'args' variable to 'task'
- remove struct taskfile_array
- do ide_acpigtf check early
- use REGS_PER_GTF
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Diffstat (limited to 'drivers/ide/ide-acpi.c')
-rw-r--r-- | drivers/ide/ide-acpi.c | 71 |
1 files changed, 24 insertions, 47 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index ce5b213e2bc2..5b704f1ea90c 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -20,9 +20,6 @@ | |||
20 | #include <acpi/acpi_bus.h> | 20 | #include <acpi/acpi_bus.h> |
21 | 21 | ||
22 | #define REGS_PER_GTF 7 | 22 | #define REGS_PER_GTF 7 |
23 | struct taskfile_array { | ||
24 | u8 tfa[REGS_PER_GTF]; /* regs. 0x1f1 - 0x1f7 */ | ||
25 | }; | ||
26 | 23 | ||
27 | struct GTM_buffer { | 24 | struct GTM_buffer { |
28 | u32 PIO_speed0; | 25 | u32 PIO_speed0; |
@@ -285,43 +282,6 @@ out: | |||
285 | } | 282 | } |
286 | 283 | ||
287 | /** | 284 | /** |
288 | * taskfile_load_raw - send taskfile registers to drive | ||
289 | * @drive: drive to which output is sent | ||
290 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) | ||
291 | * | ||
292 | * Outputs IDE taskfile to the drive. | ||
293 | */ | ||
294 | static int taskfile_load_raw(ide_drive_t *drive, | ||
295 | const struct taskfile_array *gtf) | ||
296 | { | ||
297 | ide_task_t args; | ||
298 | int err = 0; | ||
299 | |||
300 | DEBPRINT("(0x1f1-1f7): hex: " | ||
301 | "%02x %02x %02x %02x %02x %02x %02x\n", | ||
302 | gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], | ||
303 | gtf->tfa[3], gtf->tfa[4], gtf->tfa[5], gtf->tfa[6]); | ||
304 | |||
305 | memset(&args, 0, sizeof(ide_task_t)); | ||
306 | |||
307 | /* convert gtf to IDE Taskfile */ | ||
308 | memcpy(&args.tf_array[7], >f->tfa, 7); | ||
309 | args.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
310 | |||
311 | if (!ide_acpigtf) { | ||
312 | DEBPRINT("_GTF execution disabled\n"); | ||
313 | return err; | ||
314 | } | ||
315 | |||
316 | err = ide_no_data_taskfile(drive, &args); | ||
317 | if (err) | ||
318 | printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", | ||
319 | __func__, err); | ||
320 | |||
321 | return err; | ||
322 | } | ||
323 | |||
324 | /** | ||
325 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF | 285 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF |
326 | * @drive: the drive to which the taskfile command should be sent | 286 | * @drive: the drive to which the taskfile command should be sent |
327 | * @gtf_length: total number of bytes of _GTF taskfiles | 287 | * @gtf_length: total number of bytes of _GTF taskfiles |
@@ -337,19 +297,36 @@ static int do_drive_set_taskfiles(ide_drive_t *drive, | |||
337 | int rc = 0, err; | 297 | int rc = 0, err; |
338 | int gtf_count = gtf_length / REGS_PER_GTF; | 298 | int gtf_count = gtf_length / REGS_PER_GTF; |
339 | int ix; | 299 | int ix; |
340 | struct taskfile_array *gtf; | ||
341 | 300 | ||
342 | DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n", | 301 | DEBPRINT("total GTF bytes=%u (0x%x), gtf_count=%d, addr=0x%lx\n", |
343 | gtf_length, gtf_length, gtf_count, gtf_address); | 302 | gtf_length, gtf_length, gtf_count, gtf_address); |
344 | 303 | ||
304 | /* send all taskfile registers (0x1f1-0x1f7) *in*that*order* */ | ||
345 | for (ix = 0; ix < gtf_count; ix++) { | 305 | for (ix = 0; ix < gtf_count; ix++) { |
346 | gtf = (struct taskfile_array *) | 306 | u8 *gtf = (u8 *)(gtf_address + ix * REGS_PER_GTF); |
347 | (gtf_address + ix * REGS_PER_GTF); | 307 | ide_task_t task; |
348 | 308 | ||
349 | /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ | 309 | DEBPRINT("(0x1f1-1f7): " |
350 | err = taskfile_load_raw(drive, gtf); | 310 | "hex: %02x %02x %02x %02x %02x %02x %02x\n", |
351 | if (err) | 311 | gtf[0], gtf[1], gtf[2], |
312 | gtf[3], gtf[4], gtf[5], gtf[6]); | ||
313 | |||
314 | if (!ide_acpigtf) { | ||
315 | DEBPRINT("_GTF execution disabled\n"); | ||
316 | continue; | ||
317 | } | ||
318 | |||
319 | /* convert GTF to taskfile */ | ||
320 | memset(&task, 0, sizeof(ide_task_t)); | ||
321 | memcpy(&task.tf_array[7], gtf, REGS_PER_GTF); | ||
322 | task.tf_flags = IDE_TFLAG_TF | IDE_TFLAG_DEVICE; | ||
323 | |||
324 | err = ide_no_data_taskfile(drive, &task); | ||
325 | if (err) { | ||
326 | printk(KERN_ERR "%s: ide_no_data_taskfile failed: %u\n", | ||
327 | __func__, err); | ||
352 | rc = err; | 328 | rc = err; |
329 | } | ||
353 | } | 330 | } |
354 | 331 | ||
355 | return rc; | 332 | return rc; |