diff options
author | Tejun Heo <htejun@gmail.com> | 2007-05-05 10:50:38 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-05-11 18:12:42 -0400 |
commit | 3a32a8e96694a243ec7e7feb6d76dfc4b1fe90c1 (patch) | |
tree | c7e326d85996b196770e5bef4d7fd005380b09a0 /drivers/ata/libata-acpi.c | |
parent | e92351bb53c0849fabfa80be53cbf3b0aa166e54 (diff) |
libata-acpi: clean up parameters and misc stuff
This patch cleans up libata-acpi such that it looks similar to other
libata files. This patch doesn't introuce any behavior changes.
* make libata-acpi functions take ata_device instead of ata_port +
device index
* s/atadev/dev/
* de-indent local variable declarations
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/ata/libata-acpi.c')
-rw-r--r-- | drivers/ata/libata-acpi.c | 192 |
1 files changed, 95 insertions, 97 deletions
diff --git a/drivers/ata/libata-acpi.c b/drivers/ata/libata-acpi.c index cb3eab6e379d..ed4138e24b0c 100644 --- a/drivers/ata/libata-acpi.c +++ b/drivers/ata/libata-acpi.c | |||
@@ -270,8 +270,7 @@ out: | |||
270 | 270 | ||
271 | /** | 271 | /** |
272 | * do_drive_get_GTF - get the drive bootup default taskfile settings | 272 | * do_drive_get_GTF - get the drive bootup default taskfile settings |
273 | * @ap: the ata_port for the drive | 273 | * @dev: target ATA device |
274 | * @ix: target ata_device (drive) index | ||
275 | * @gtf_length: number of bytes of _GTF data returned at @gtf_address | 274 | * @gtf_length: number of bytes of _GTF data returned at @gtf_address |
276 | * @gtf_address: buffer containing _GTF taskfile arrays | 275 | * @gtf_address: buffer containing _GTF taskfile arrays |
277 | * | 276 | * |
@@ -286,20 +285,19 @@ out: | |||
286 | * The returned @gtf_length and @gtf_address are only valid if the | 285 | * The returned @gtf_length and @gtf_address are only valid if the |
287 | * function return value is 0. | 286 | * function return value is 0. |
288 | */ | 287 | */ |
289 | static int do_drive_get_GTF(struct ata_port *ap, int ix, | 288 | static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length, |
290 | unsigned int *gtf_length, unsigned long *gtf_address, | 289 | unsigned long *gtf_address, unsigned long *obj_loc) |
291 | unsigned long *obj_loc) | ||
292 | { | 290 | { |
293 | acpi_status status; | 291 | struct ata_port *ap = dev->ap; |
294 | acpi_handle dev_handle = NULL; | 292 | acpi_status status; |
295 | acpi_handle chan_handle, drive_handle; | 293 | acpi_handle dev_handle = NULL; |
296 | acpi_integer pcidevfn = 0; | 294 | acpi_handle chan_handle, drive_handle; |
297 | u32 dev_adr; | 295 | acpi_integer pcidevfn = 0; |
298 | struct acpi_buffer output; | 296 | u32 dev_adr; |
299 | union acpi_object *out_obj; | 297 | struct acpi_buffer output; |
300 | struct device *dev = ap->host->dev; | 298 | union acpi_object *out_obj; |
301 | struct ata_device *atadev = &ap->device[ix]; | 299 | struct device *gdev = ap->host->dev; |
302 | int err = -ENODEV; | 300 | int err = -ENODEV; |
303 | 301 | ||
304 | *gtf_length = 0; | 302 | *gtf_length = 0; |
305 | *gtf_address = 0UL; | 303 | *gtf_address = 0UL; |
@@ -309,14 +307,14 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
309 | return 0; | 307 | return 0; |
310 | 308 | ||
311 | if (ata_msg_probe(ap)) | 309 | if (ata_msg_probe(ap)) |
312 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 310 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
313 | __FUNCTION__, ap->port_no); | 311 | __FUNCTION__, ap->port_no); |
314 | 312 | ||
315 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) { | 313 | if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) { |
316 | if (ata_msg_probe(ap)) | 314 | if (ata_msg_probe(ap)) |
317 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ERR: " | 315 | ata_dev_printk(dev, KERN_DEBUG, "%s: ERR: " |
318 | "ata_dev_present: %d, PORT_DISABLED: %lu\n", | 316 | "ata_dev_present: %d, PORT_DISABLED: %lu\n", |
319 | __FUNCTION__, ata_dev_enabled(atadev), | 317 | __FUNCTION__, ata_dev_enabled(dev), |
320 | ap->flags & ATA_FLAG_DISABLED); | 318 | ap->flags & ATA_FLAG_DISABLED); |
321 | goto out; | 319 | goto out; |
322 | } | 320 | } |
@@ -324,19 +322,19 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
324 | /* Don't continue if device has no _ADR method. | 322 | /* Don't continue if device has no _ADR method. |
325 | * _GTF is intended for known motherboard devices. */ | 323 | * _GTF is intended for known motherboard devices. */ |
326 | if (!(ap->cbl == ATA_CBL_SATA)) { | 324 | if (!(ap->cbl == ATA_CBL_SATA)) { |
327 | err = pata_get_dev_handle(dev, &dev_handle, &pcidevfn); | 325 | err = pata_get_dev_handle(gdev, &dev_handle, &pcidevfn); |
328 | if (err < 0) { | 326 | if (err < 0) { |
329 | if (ata_msg_probe(ap)) | 327 | if (ata_msg_probe(ap)) |
330 | ata_dev_printk(atadev, KERN_DEBUG, | 328 | ata_dev_printk(dev, KERN_DEBUG, |
331 | "%s: pata_get_dev_handle failed (%d)\n", | 329 | "%s: pata_get_dev_handle failed (%d)\n", |
332 | __FUNCTION__, err); | 330 | __FUNCTION__, err); |
333 | goto out; | 331 | goto out; |
334 | } | 332 | } |
335 | } else { | 333 | } else { |
336 | err = sata_get_dev_handle(dev, &dev_handle, &pcidevfn); | 334 | err = sata_get_dev_handle(gdev, &dev_handle, &pcidevfn); |
337 | if (err < 0) { | 335 | if (err < 0) { |
338 | if (ata_msg_probe(ap)) | 336 | if (ata_msg_probe(ap)) |
339 | ata_dev_printk(atadev, KERN_DEBUG, | 337 | ata_dev_printk(dev, KERN_DEBUG, |
340 | "%s: sata_get_dev_handle failed (%d\n", | 338 | "%s: sata_get_dev_handle failed (%d\n", |
341 | __FUNCTION__, err); | 339 | __FUNCTION__, err); |
342 | goto out; | 340 | goto out; |
@@ -344,7 +342,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
344 | } | 342 | } |
345 | 343 | ||
346 | /* Get this drive's _ADR info. if not already known. */ | 344 | /* Get this drive's _ADR info. if not already known. */ |
347 | if (!atadev->obj_handle) { | 345 | if (!dev->obj_handle) { |
348 | if (!(ap->cbl == ATA_CBL_SATA)) { | 346 | if (!(ap->cbl == ATA_CBL_SATA)) { |
349 | /* get child objects of dev_handle == channel objects, | 347 | /* get child objects of dev_handle == channel objects, |
350 | * + _their_ children == drive objects */ | 348 | * + _their_ children == drive objects */ |
@@ -352,7 +350,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
352 | chan_handle = acpi_get_child(dev_handle, | 350 | chan_handle = acpi_get_child(dev_handle, |
353 | ap->port_no); | 351 | ap->port_no); |
354 | if (ata_msg_probe(ap)) | 352 | if (ata_msg_probe(ap)) |
355 | ata_dev_printk(atadev, KERN_DEBUG, | 353 | ata_dev_printk(dev, KERN_DEBUG, |
356 | "%s: chan adr=%d: chan_handle=0x%p\n", | 354 | "%s: chan adr=%d: chan_handle=0x%p\n", |
357 | __FUNCTION__, ap->port_no, | 355 | __FUNCTION__, ap->port_no, |
358 | chan_handle); | 356 | chan_handle); |
@@ -361,26 +359,26 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
361 | goto out; | 359 | goto out; |
362 | } | 360 | } |
363 | /* TBD: could also check ACPI object VALID bits */ | 361 | /* TBD: could also check ACPI object VALID bits */ |
364 | drive_handle = acpi_get_child(chan_handle, ix); | 362 | drive_handle = acpi_get_child(chan_handle, dev->devno); |
365 | if (!drive_handle) { | 363 | if (!drive_handle) { |
366 | err = -ENODEV; | 364 | err = -ENODEV; |
367 | goto out; | 365 | goto out; |
368 | } | 366 | } |
369 | dev_adr = ix; | 367 | dev_adr = dev->devno; |
370 | atadev->obj_handle = drive_handle; | 368 | dev->obj_handle = drive_handle; |
371 | } else { /* for SATA mode */ | 369 | } else { /* for SATA mode */ |
372 | dev_adr = SATA_ADR_RSVD; | 370 | dev_adr = SATA_ADR_RSVD; |
373 | err = get_sata_adr(dev, dev_handle, pcidevfn, 0, | 371 | err = get_sata_adr(gdev, dev_handle, pcidevfn, 0, |
374 | ap, atadev, &dev_adr); | 372 | ap, dev, &dev_adr); |
375 | } | 373 | } |
376 | if (err < 0 || dev_adr == SATA_ADR_RSVD || | 374 | if (err < 0 || dev_adr == SATA_ADR_RSVD || |
377 | !atadev->obj_handle) { | 375 | !dev->obj_handle) { |
378 | if (ata_msg_probe(ap)) | 376 | if (ata_msg_probe(ap)) |
379 | ata_dev_printk(atadev, KERN_DEBUG, | 377 | ata_dev_printk(dev, KERN_DEBUG, |
380 | "%s: get_sata/pata_adr failed: " | 378 | "%s: get_sata/pata_adr failed: " |
381 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", | 379 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", |
382 | __FUNCTION__, err, dev_adr, | 380 | __FUNCTION__, err, dev_adr, |
383 | atadev->obj_handle); | 381 | dev->obj_handle); |
384 | goto out; | 382 | goto out; |
385 | } | 383 | } |
386 | } | 384 | } |
@@ -391,11 +389,11 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
391 | 389 | ||
392 | /* _GTF has no input parameters */ | 390 | /* _GTF has no input parameters */ |
393 | err = -EIO; | 391 | err = -EIO; |
394 | status = acpi_evaluate_object(atadev->obj_handle, "_GTF", | 392 | status = acpi_evaluate_object(dev->obj_handle, "_GTF", |
395 | NULL, &output); | 393 | NULL, &output); |
396 | if (ACPI_FAILURE(status)) { | 394 | if (ACPI_FAILURE(status)) { |
397 | if (ata_msg_probe(ap)) | 395 | if (ata_msg_probe(ap)) |
398 | ata_dev_printk(atadev, KERN_DEBUG, | 396 | ata_dev_printk(dev, KERN_DEBUG, |
399 | "%s: Run _GTF error: status = 0x%x\n", | 397 | "%s: Run _GTF error: status = 0x%x\n", |
400 | __FUNCTION__, status); | 398 | __FUNCTION__, status); |
401 | goto out; | 399 | goto out; |
@@ -403,7 +401,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
403 | 401 | ||
404 | if (!output.length || !output.pointer) { | 402 | if (!output.length || !output.pointer) { |
405 | if (ata_msg_probe(ap)) | 403 | if (ata_msg_probe(ap)) |
406 | ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " | 404 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " |
407 | "length or ptr is NULL (0x%llx, 0x%p)\n", | 405 | "length or ptr is NULL (0x%llx, 0x%p)\n", |
408 | __FUNCTION__, | 406 | __FUNCTION__, |
409 | (unsigned long long)output.length, | 407 | (unsigned long long)output.length, |
@@ -416,7 +414,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
416 | if (out_obj->type != ACPI_TYPE_BUFFER) { | 414 | if (out_obj->type != ACPI_TYPE_BUFFER) { |
417 | kfree(output.pointer); | 415 | kfree(output.pointer); |
418 | if (ata_msg_probe(ap)) | 416 | if (ata_msg_probe(ap)) |
419 | ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " | 417 | ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: " |
420 | "error: expected object type of " | 418 | "error: expected object type of " |
421 | " ACPI_TYPE_BUFFER, got 0x%x\n", | 419 | " ACPI_TYPE_BUFFER, got 0x%x\n", |
422 | __FUNCTION__, out_obj->type); | 420 | __FUNCTION__, out_obj->type); |
@@ -427,7 +425,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
427 | if (!out_obj->buffer.length || !out_obj->buffer.pointer || | 425 | if (!out_obj->buffer.length || !out_obj->buffer.pointer || |
428 | out_obj->buffer.length % REGS_PER_GTF) { | 426 | out_obj->buffer.length % REGS_PER_GTF) { |
429 | if (ata_msg_drv(ap)) | 427 | if (ata_msg_drv(ap)) |
430 | ata_dev_printk(atadev, KERN_ERR, | 428 | ata_dev_printk(dev, KERN_ERR, |
431 | "%s: unexpected GTF length (%d) or addr (0x%p)\n", | 429 | "%s: unexpected GTF length (%d) or addr (0x%p)\n", |
432 | __FUNCTION__, out_obj->buffer.length, | 430 | __FUNCTION__, out_obj->buffer.length, |
433 | out_obj->buffer.pointer); | 431 | out_obj->buffer.pointer); |
@@ -439,7 +437,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, | |||
439 | *gtf_address = (unsigned long)out_obj->buffer.pointer; | 437 | *gtf_address = (unsigned long)out_obj->buffer.pointer; |
440 | *obj_loc = (unsigned long)out_obj; | 438 | *obj_loc = (unsigned long)out_obj; |
441 | if (ata_msg_probe(ap)) | 439 | if (ata_msg_probe(ap)) |
442 | ata_dev_printk(atadev, KERN_DEBUG, "%s: returning " | 440 | ata_dev_printk(dev, KERN_DEBUG, "%s: returning " |
443 | "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", | 441 | "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", |
444 | __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); | 442 | __FUNCTION__, *gtf_length, *gtf_address, *obj_loc); |
445 | err = 0; | 443 | err = 0; |
@@ -449,7 +447,7 @@ out: | |||
449 | 447 | ||
450 | /** | 448 | /** |
451 | * taskfile_load_raw - send taskfile registers to host controller | 449 | * taskfile_load_raw - send taskfile registers to host controller |
452 | * @ap: Port to which output is sent | 450 | * @dev: target ATA device |
453 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) | 451 | * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) |
454 | * | 452 | * |
455 | * Outputs ATA taskfile to standard ATA host controller using MMIO | 453 | * Outputs ATA taskfile to standard ATA host controller using MMIO |
@@ -466,15 +464,15 @@ out: | |||
466 | * LOCKING: TBD: | 464 | * LOCKING: TBD: |
467 | * Inherited from caller. | 465 | * Inherited from caller. |
468 | */ | 466 | */ |
469 | static void taskfile_load_raw(struct ata_port *ap, | 467 | static void taskfile_load_raw(struct ata_device *dev, |
470 | struct ata_device *atadev, | 468 | const struct taskfile_array *gtf) |
471 | const struct taskfile_array *gtf) | ||
472 | { | 469 | { |
470 | struct ata_port *ap = dev->ap; | ||
473 | struct ata_taskfile tf; | 471 | struct ata_taskfile tf; |
474 | unsigned int err; | 472 | unsigned int err; |
475 | 473 | ||
476 | if (ata_msg_probe(ap)) | 474 | if (ata_msg_probe(ap)) |
477 | ata_dev_printk(atadev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " | 475 | ata_dev_printk(dev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " |
478 | "%02x %02x %02x %02x %02x %02x %02x\n", | 476 | "%02x %02x %02x %02x %02x %02x %02x\n", |
479 | __FUNCTION__, | 477 | __FUNCTION__, |
480 | gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], | 478 | gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], |
@@ -485,7 +483,7 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
485 | && (gtf->tfa[6] == 0)) | 483 | && (gtf->tfa[6] == 0)) |
486 | return; | 484 | return; |
487 | 485 | ||
488 | ata_tf_init(atadev, &tf); | 486 | ata_tf_init(dev, &tf); |
489 | 487 | ||
490 | /* convert gtf to tf */ | 488 | /* convert gtf to tf */ |
491 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ | 489 | tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ |
@@ -498,17 +496,16 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
498 | tf.device = gtf->tfa[5]; /* 0x1f6 */ | 496 | tf.device = gtf->tfa[5]; /* 0x1f6 */ |
499 | tf.command = gtf->tfa[6]; /* 0x1f7 */ | 497 | tf.command = gtf->tfa[6]; /* 0x1f7 */ |
500 | 498 | ||
501 | err = ata_exec_internal(atadev, &tf, NULL, DMA_NONE, NULL, 0); | 499 | err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0); |
502 | if (err && ata_msg_probe(ap)) | 500 | if (err && ata_msg_probe(ap)) |
503 | ata_dev_printk(atadev, KERN_ERR, | 501 | ata_dev_printk(dev, KERN_ERR, |
504 | "%s: ata_exec_internal failed: %u\n", | 502 | "%s: ata_exec_internal failed: %u\n", |
505 | __FUNCTION__, err); | 503 | __FUNCTION__, err); |
506 | } | 504 | } |
507 | 505 | ||
508 | /** | 506 | /** |
509 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF | 507 | * do_drive_set_taskfiles - write the drive taskfile settings from _GTF |
510 | * @ap: the ata_port for the drive | 508 | * @dev: target ATA device |
511 | * @atadev: target ata_device | ||
512 | * @gtf_length: total number of bytes of _GTF taskfiles | 509 | * @gtf_length: total number of bytes of _GTF taskfiles |
513 | * @gtf_address: location of _GTF taskfile arrays | 510 | * @gtf_address: location of _GTF taskfile arrays |
514 | * | 511 | * |
@@ -517,30 +514,31 @@ static void taskfile_load_raw(struct ata_port *ap, | |||
517 | * Write {gtf_address, length gtf_length} in groups of | 514 | * Write {gtf_address, length gtf_length} in groups of |
518 | * REGS_PER_GTF bytes. | 515 | * REGS_PER_GTF bytes. |
519 | */ | 516 | */ |
520 | static int do_drive_set_taskfiles(struct ata_port *ap, | 517 | static int do_drive_set_taskfiles(struct ata_device *dev, |
521 | struct ata_device *atadev, unsigned int gtf_length, | 518 | unsigned int gtf_length, |
522 | unsigned long gtf_address) | 519 | unsigned long gtf_address) |
523 | { | 520 | { |
524 | int err = -ENODEV; | 521 | struct ata_port *ap = dev->ap; |
525 | int gtf_count = gtf_length / REGS_PER_GTF; | 522 | int err = -ENODEV; |
526 | int ix; | 523 | int gtf_count = gtf_length / REGS_PER_GTF; |
524 | int ix; | ||
527 | struct taskfile_array *gtf; | 525 | struct taskfile_array *gtf; |
528 | 526 | ||
529 | if (ata_msg_probe(ap)) | 527 | if (ata_msg_probe(ap)) |
530 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", | 528 | ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n", |
531 | __FUNCTION__, ap->port_no); | 529 | __FUNCTION__, ap->port_no); |
532 | 530 | ||
533 | if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) | 531 | if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) |
534 | return 0; | 532 | return 0; |
535 | 533 | ||
536 | if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) | 534 | if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) |
537 | goto out; | 535 | goto out; |
538 | if (!gtf_count) /* shouldn't be here */ | 536 | if (!gtf_count) /* shouldn't be here */ |
539 | goto out; | 537 | goto out; |
540 | 538 | ||
541 | if (gtf_length % REGS_PER_GTF) { | 539 | if (gtf_length % REGS_PER_GTF) { |
542 | if (ata_msg_drv(ap)) | 540 | if (ata_msg_drv(ap)) |
543 | ata_dev_printk(atadev, KERN_ERR, | 541 | ata_dev_printk(dev, KERN_ERR, |
544 | "%s: unexpected GTF length (%d)\n", | 542 | "%s: unexpected GTF length (%d)\n", |
545 | __FUNCTION__, gtf_length); | 543 | __FUNCTION__, gtf_length); |
546 | goto out; | 544 | goto out; |
@@ -551,7 +549,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap, | |||
551 | (gtf_address + ix * REGS_PER_GTF); | 549 | (gtf_address + ix * REGS_PER_GTF); |
552 | 550 | ||
553 | /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ | 551 | /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ |
554 | taskfile_load_raw(ap, atadev, gtf); | 552 | taskfile_load_raw(dev, gtf); |
555 | } | 553 | } |
556 | 554 | ||
557 | err = 0; | 555 | err = 0; |
@@ -567,11 +565,11 @@ out: | |||
567 | */ | 565 | */ |
568 | int ata_acpi_exec_tfs(struct ata_port *ap) | 566 | int ata_acpi_exec_tfs(struct ata_port *ap) |
569 | { | 567 | { |
570 | int ix; | 568 | int ix; |
571 | int ret =0; | 569 | int ret = 0; |
572 | unsigned int gtf_length; | 570 | unsigned int gtf_length; |
573 | unsigned long gtf_address; | 571 | unsigned long gtf_address; |
574 | unsigned long obj_loc; | 572 | unsigned long obj_loc; |
575 | 573 | ||
576 | if (libata_noacpi) | 574 | if (libata_noacpi) |
577 | return 0; | 575 | return 0; |
@@ -584,11 +582,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
584 | return 0; | 582 | return 0; |
585 | 583 | ||
586 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { | 584 | for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { |
587 | if (!ata_dev_enabled(&ap->device[ix])) | 585 | struct ata_device *dev = &ap->device[ix]; |
586 | |||
587 | if (!ata_dev_enabled(dev)) | ||
588 | continue; | 588 | continue; |
589 | 589 | ||
590 | ret = do_drive_get_GTF(ap, ix, | 590 | ret = do_drive_get_GTF(dev, >f_length, >f_address, |
591 | >f_length, >f_address, &obj_loc); | 591 | &obj_loc); |
592 | if (ret < 0) { | 592 | if (ret < 0) { |
593 | if (ata_msg_probe(ap)) | 593 | if (ata_msg_probe(ap)) |
594 | ata_port_printk(ap, KERN_DEBUG, | 594 | ata_port_printk(ap, KERN_DEBUG, |
@@ -597,8 +597,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
597 | break; | 597 | break; |
598 | } | 598 | } |
599 | 599 | ||
600 | ret = do_drive_set_taskfiles(ap, &ap->device[ix], | 600 | ret = do_drive_set_taskfiles(dev, gtf_length, gtf_address); |
601 | gtf_length, gtf_address); | ||
602 | kfree((void *)obj_loc); | 601 | kfree((void *)obj_loc); |
603 | if (ret < 0) { | 602 | if (ret < 0) { |
604 | if (ata_msg_probe(ap)) | 603 | if (ata_msg_probe(ap)) |
@@ -614,8 +613,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
614 | 613 | ||
615 | /** | 614 | /** |
616 | * ata_acpi_push_id - send Identify data to drive | 615 | * ata_acpi_push_id - send Identify data to drive |
617 | * @ap: the ata_port for the drive | 616 | * @dev: target ATA device |
618 | * @ix: drive index | ||
619 | * | 617 | * |
620 | * _SDD ACPI object: for SATA mode only | 618 | * _SDD ACPI object: for SATA mode only |
621 | * Must be after Identify (Packet) Device -- uses its data | 619 | * Must be after Identify (Packet) Device -- uses its data |
@@ -623,57 +621,57 @@ int ata_acpi_exec_tfs(struct ata_port *ap) | |||
623 | * method and if it fails for whatever reason, we should still | 621 | * method and if it fails for whatever reason, we should still |
624 | * just keep going. | 622 | * just keep going. |
625 | */ | 623 | */ |
626 | int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | 624 | int ata_acpi_push_id(struct ata_device *dev) |
627 | { | 625 | { |
628 | acpi_handle handle; | 626 | struct ata_port *ap = dev->ap; |
629 | acpi_integer pcidevfn; | 627 | acpi_handle handle; |
630 | int err; | 628 | acpi_integer pcidevfn; |
631 | struct device *dev = ap->host->dev; | 629 | int err; |
632 | struct ata_device *atadev = &ap->device[ix]; | 630 | struct device *gdev = ap->host->dev; |
633 | u32 dev_adr; | 631 | u32 dev_adr; |
634 | acpi_status status; | 632 | acpi_status status; |
635 | struct acpi_object_list input; | 633 | struct acpi_object_list input; |
636 | union acpi_object in_params[1]; | 634 | union acpi_object in_params[1]; |
637 | 635 | ||
638 | if (libata_noacpi) | 636 | if (libata_noacpi) |
639 | return 0; | 637 | return 0; |
640 | 638 | ||
641 | if (ata_msg_probe(ap)) | 639 | if (ata_msg_probe(ap)) |
642 | ata_dev_printk(atadev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", | 640 | ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", |
643 | __FUNCTION__, ix, ap->port_no); | 641 | __FUNCTION__, dev->devno, ap->port_no); |
644 | 642 | ||
645 | /* Don't continue if not a SATA device. */ | 643 | /* Don't continue if not a SATA device. */ |
646 | if (!(ap->cbl == ATA_CBL_SATA)) { | 644 | if (!(ap->cbl == ATA_CBL_SATA)) { |
647 | if (ata_msg_probe(ap)) | 645 | if (ata_msg_probe(ap)) |
648 | ata_dev_printk(atadev, KERN_DEBUG, | 646 | ata_dev_printk(dev, KERN_DEBUG, |
649 | "%s: Not a SATA device\n", __FUNCTION__); | 647 | "%s: Not a SATA device\n", __FUNCTION__); |
650 | goto out; | 648 | goto out; |
651 | } | 649 | } |
652 | 650 | ||
653 | /* Don't continue if device has no _ADR method. | 651 | /* Don't continue if device has no _ADR method. |
654 | * _SDD is intended for known motherboard devices. */ | 652 | * _SDD is intended for known motherboard devices. */ |
655 | err = sata_get_dev_handle(dev, &handle, &pcidevfn); | 653 | err = sata_get_dev_handle(gdev, &handle, &pcidevfn); |
656 | if (err < 0) { | 654 | if (err < 0) { |
657 | if (ata_msg_probe(ap)) | 655 | if (ata_msg_probe(ap)) |
658 | ata_dev_printk(atadev, KERN_DEBUG, | 656 | ata_dev_printk(dev, KERN_DEBUG, |
659 | "%s: sata_get_dev_handle failed (%d\n", | 657 | "%s: sata_get_dev_handle failed (%d\n", |
660 | __FUNCTION__, err); | 658 | __FUNCTION__, err); |
661 | goto out; | 659 | goto out; |
662 | } | 660 | } |
663 | 661 | ||
664 | /* Get this drive's _ADR info, if not already known */ | 662 | /* Get this drive's _ADR info, if not already known */ |
665 | if (!atadev->obj_handle) { | 663 | if (!dev->obj_handle) { |
666 | dev_adr = SATA_ADR_RSVD; | 664 | dev_adr = SATA_ADR_RSVD; |
667 | err = get_sata_adr(dev, handle, pcidevfn, ix, ap, atadev, | 665 | err = get_sata_adr(gdev, handle, pcidevfn, dev->devno, ap, dev, |
668 | &dev_adr); | 666 | &dev_adr); |
669 | if (err < 0 || dev_adr == SATA_ADR_RSVD || | 667 | if (err < 0 || dev_adr == SATA_ADR_RSVD || |
670 | !atadev->obj_handle) { | 668 | !dev->obj_handle) { |
671 | if (ata_msg_probe(ap)) | 669 | if (ata_msg_probe(ap)) |
672 | ata_dev_printk(atadev, KERN_DEBUG, | 670 | ata_dev_printk(dev, KERN_DEBUG, |
673 | "%s: get_sata_adr failed: " | 671 | "%s: get_sata_adr failed: " |
674 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", | 672 | "err=%d, dev_adr=%u, obj_handle=0x%p\n", |
675 | __FUNCTION__, err, dev_adr, | 673 | __FUNCTION__, err, dev_adr, |
676 | atadev->obj_handle); | 674 | dev->obj_handle); |
677 | goto out; | 675 | goto out; |
678 | } | 676 | } |
679 | } | 677 | } |
@@ -683,19 +681,19 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) | |||
683 | input.count = 1; | 681 | input.count = 1; |
684 | input.pointer = in_params; | 682 | input.pointer = in_params; |
685 | in_params[0].type = ACPI_TYPE_BUFFER; | 683 | in_params[0].type = ACPI_TYPE_BUFFER; |
686 | in_params[0].buffer.length = sizeof(atadev->id[0]) * ATA_ID_WORDS; | 684 | in_params[0].buffer.length = sizeof(dev->id[0]) * ATA_ID_WORDS; |
687 | in_params[0].buffer.pointer = (u8 *)atadev->id; | 685 | in_params[0].buffer.pointer = (u8 *)dev->id; |
688 | /* Output buffer: _SDD has no output */ | 686 | /* Output buffer: _SDD has no output */ |
689 | 687 | ||
690 | /* It's OK for _SDD to be missing too. */ | 688 | /* It's OK for _SDD to be missing too. */ |
691 | swap_buf_le16(atadev->id, ATA_ID_WORDS); | 689 | swap_buf_le16(dev->id, ATA_ID_WORDS); |
692 | status = acpi_evaluate_object(atadev->obj_handle, "_SDD", &input, NULL); | 690 | status = acpi_evaluate_object(dev->obj_handle, "_SDD", &input, NULL); |
693 | swap_buf_le16(atadev->id, ATA_ID_WORDS); | 691 | swap_buf_le16(dev->id, ATA_ID_WORDS); |
694 | 692 | ||
695 | err = ACPI_FAILURE(status) ? -EIO : 0; | 693 | err = ACPI_FAILURE(status) ? -EIO : 0; |
696 | if (err < 0) { | 694 | if (err < 0) { |
697 | if (ata_msg_probe(ap)) | 695 | if (ata_msg_probe(ap)) |
698 | ata_dev_printk(atadev, KERN_DEBUG, | 696 | ata_dev_printk(dev, KERN_DEBUG, |
699 | "%s _SDD error: status = 0x%x\n", | 697 | "%s _SDD error: status = 0x%x\n", |
700 | __FUNCTION__, status); | 698 | __FUNCTION__, status); |
701 | } | 699 | } |