Commit 3a32a8e9 authored by Tejun Heo's avatar Tejun Heo Committed by Jeff Garzik

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: default avatarTejun Heo <htejun@gmail.com>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent e92351bb
...@@ -270,8 +270,7 @@ static int get_sata_adr(struct device *dev, acpi_handle handle, ...@@ -270,8 +270,7 @@ static int get_sata_adr(struct device *dev, acpi_handle handle,
/** /**
* do_drive_get_GTF - get the drive bootup default taskfile settings * do_drive_get_GTF - get the drive bootup default taskfile settings
* @ap: the ata_port for the drive * @dev: target ATA device
* @ix: target ata_device (drive) index
* @gtf_length: number of bytes of _GTF data returned at @gtf_address * @gtf_length: number of bytes of _GTF data returned at @gtf_address
* @gtf_address: buffer containing _GTF taskfile arrays * @gtf_address: buffer containing _GTF taskfile arrays
* *
...@@ -286,20 +285,19 @@ static int get_sata_adr(struct device *dev, acpi_handle handle, ...@@ -286,20 +285,19 @@ static int get_sata_adr(struct device *dev, acpi_handle handle,
* The returned @gtf_length and @gtf_address are only valid if the * The returned @gtf_length and @gtf_address are only valid if the
* function return value is 0. * function return value is 0.
*/ */
static int do_drive_get_GTF(struct ata_port *ap, int ix, static int do_drive_get_GTF(struct ata_device *dev, unsigned int *gtf_length,
unsigned int *gtf_length, unsigned long *gtf_address, unsigned long *gtf_address, unsigned long *obj_loc)
unsigned long *obj_loc)
{ {
acpi_status status; struct ata_port *ap = dev->ap;
acpi_handle dev_handle = NULL; acpi_status status;
acpi_handle chan_handle, drive_handle; acpi_handle dev_handle = NULL;
acpi_integer pcidevfn = 0; acpi_handle chan_handle, drive_handle;
u32 dev_adr; acpi_integer pcidevfn = 0;
struct acpi_buffer output; u32 dev_adr;
union acpi_object *out_obj; struct acpi_buffer output;
struct device *dev = ap->host->dev; union acpi_object *out_obj;
struct ata_device *atadev = &ap->device[ix]; struct device *gdev = ap->host->dev;
int err = -ENODEV; int err = -ENODEV;
*gtf_length = 0; *gtf_length = 0;
*gtf_address = 0UL; *gtf_address = 0UL;
...@@ -309,14 +307,14 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -309,14 +307,14 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
return 0; return 0;
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
__FUNCTION__, ap->port_no); __FUNCTION__, ap->port_no);
if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) { if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED)) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: ERR: " ata_dev_printk(dev, KERN_DEBUG, "%s: ERR: "
"ata_dev_present: %d, PORT_DISABLED: %lu\n", "ata_dev_present: %d, PORT_DISABLED: %lu\n",
__FUNCTION__, ata_dev_enabled(atadev), __FUNCTION__, ata_dev_enabled(dev),
ap->flags & ATA_FLAG_DISABLED); ap->flags & ATA_FLAG_DISABLED);
goto out; goto out;
} }
...@@ -324,19 +322,19 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -324,19 +322,19 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
/* Don't continue if device has no _ADR method. /* Don't continue if device has no _ADR method.
* _GTF is intended for known motherboard devices. */ * _GTF is intended for known motherboard devices. */
if (!(ap->cbl == ATA_CBL_SATA)) { if (!(ap->cbl == ATA_CBL_SATA)) {
err = pata_get_dev_handle(dev, &dev_handle, &pcidevfn); err = pata_get_dev_handle(gdev, &dev_handle, &pcidevfn);
if (err < 0) { if (err < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: pata_get_dev_handle failed (%d)\n", "%s: pata_get_dev_handle failed (%d)\n",
__FUNCTION__, err); __FUNCTION__, err);
goto out; goto out;
} }
} else { } else {
err = sata_get_dev_handle(dev, &dev_handle, &pcidevfn); err = sata_get_dev_handle(gdev, &dev_handle, &pcidevfn);
if (err < 0) { if (err < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: sata_get_dev_handle failed (%d\n", "%s: sata_get_dev_handle failed (%d\n",
__FUNCTION__, err); __FUNCTION__, err);
goto out; goto out;
...@@ -344,7 +342,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -344,7 +342,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
} }
/* Get this drive's _ADR info. if not already known. */ /* Get this drive's _ADR info. if not already known. */
if (!atadev->obj_handle) { if (!dev->obj_handle) {
if (!(ap->cbl == ATA_CBL_SATA)) { if (!(ap->cbl == ATA_CBL_SATA)) {
/* get child objects of dev_handle == channel objects, /* get child objects of dev_handle == channel objects,
* + _their_ children == drive objects */ * + _their_ children == drive objects */
...@@ -352,7 +350,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -352,7 +350,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
chan_handle = acpi_get_child(dev_handle, chan_handle = acpi_get_child(dev_handle,
ap->port_no); ap->port_no);
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: chan adr=%d: chan_handle=0x%p\n", "%s: chan adr=%d: chan_handle=0x%p\n",
__FUNCTION__, ap->port_no, __FUNCTION__, ap->port_no,
chan_handle); chan_handle);
...@@ -361,26 +359,26 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -361,26 +359,26 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
goto out; goto out;
} }
/* TBD: could also check ACPI object VALID bits */ /* TBD: could also check ACPI object VALID bits */
drive_handle = acpi_get_child(chan_handle, ix); drive_handle = acpi_get_child(chan_handle, dev->devno);
if (!drive_handle) { if (!drive_handle) {
err = -ENODEV; err = -ENODEV;
goto out; goto out;
} }
dev_adr = ix; dev_adr = dev->devno;
atadev->obj_handle = drive_handle; dev->obj_handle = drive_handle;
} else { /* for SATA mode */ } else { /* for SATA mode */
dev_adr = SATA_ADR_RSVD; dev_adr = SATA_ADR_RSVD;
err = get_sata_adr(dev, dev_handle, pcidevfn, 0, err = get_sata_adr(gdev, dev_handle, pcidevfn, 0,
ap, atadev, &dev_adr); ap, dev, &dev_adr);
} }
if (err < 0 || dev_adr == SATA_ADR_RSVD || if (err < 0 || dev_adr == SATA_ADR_RSVD ||
!atadev->obj_handle) { !dev->obj_handle) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: get_sata/pata_adr failed: " "%s: get_sata/pata_adr failed: "
"err=%d, dev_adr=%u, obj_handle=0x%p\n", "err=%d, dev_adr=%u, obj_handle=0x%p\n",
__FUNCTION__, err, dev_adr, __FUNCTION__, err, dev_adr,
atadev->obj_handle); dev->obj_handle);
goto out; goto out;
} }
} }
...@@ -391,11 +389,11 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -391,11 +389,11 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
/* _GTF has no input parameters */ /* _GTF has no input parameters */
err = -EIO; err = -EIO;
status = acpi_evaluate_object(atadev->obj_handle, "_GTF", status = acpi_evaluate_object(dev->obj_handle, "_GTF",
NULL, &output); NULL, &output);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: Run _GTF error: status = 0x%x\n", "%s: Run _GTF error: status = 0x%x\n",
__FUNCTION__, status); __FUNCTION__, status);
goto out; goto out;
...@@ -403,7 +401,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -403,7 +401,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
if (!output.length || !output.pointer) { if (!output.length || !output.pointer) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: "
"length or ptr is NULL (0x%llx, 0x%p)\n", "length or ptr is NULL (0x%llx, 0x%p)\n",
__FUNCTION__, __FUNCTION__,
(unsigned long long)output.length, (unsigned long long)output.length,
...@@ -416,7 +414,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -416,7 +414,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
if (out_obj->type != ACPI_TYPE_BUFFER) { if (out_obj->type != ACPI_TYPE_BUFFER) {
kfree(output.pointer); kfree(output.pointer);
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: Run _GTF: " ata_dev_printk(dev, KERN_DEBUG, "%s: Run _GTF: "
"error: expected object type of " "error: expected object type of "
" ACPI_TYPE_BUFFER, got 0x%x\n", " ACPI_TYPE_BUFFER, got 0x%x\n",
__FUNCTION__, out_obj->type); __FUNCTION__, out_obj->type);
...@@ -427,7 +425,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -427,7 +425,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
if (!out_obj->buffer.length || !out_obj->buffer.pointer || if (!out_obj->buffer.length || !out_obj->buffer.pointer ||
out_obj->buffer.length % REGS_PER_GTF) { out_obj->buffer.length % REGS_PER_GTF) {
if (ata_msg_drv(ap)) if (ata_msg_drv(ap))
ata_dev_printk(atadev, KERN_ERR, ata_dev_printk(dev, KERN_ERR,
"%s: unexpected GTF length (%d) or addr (0x%p)\n", "%s: unexpected GTF length (%d) or addr (0x%p)\n",
__FUNCTION__, out_obj->buffer.length, __FUNCTION__, out_obj->buffer.length,
out_obj->buffer.pointer); out_obj->buffer.pointer);
...@@ -439,7 +437,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -439,7 +437,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
*gtf_address = (unsigned long)out_obj->buffer.pointer; *gtf_address = (unsigned long)out_obj->buffer.pointer;
*obj_loc = (unsigned long)out_obj; *obj_loc = (unsigned long)out_obj;
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: returning " ata_dev_printk(dev, KERN_DEBUG, "%s: returning "
"gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n", "gtf_length=%d, gtf_address=0x%lx, obj_loc=0x%lx\n",
__FUNCTION__, *gtf_length, *gtf_address, *obj_loc); __FUNCTION__, *gtf_length, *gtf_address, *obj_loc);
err = 0; err = 0;
...@@ -449,7 +447,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -449,7 +447,7 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
/** /**
* taskfile_load_raw - send taskfile registers to host controller * taskfile_load_raw - send taskfile registers to host controller
* @ap: Port to which output is sent * @dev: target ATA device
* @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7) * @gtf: raw ATA taskfile register set (0x1f1 - 0x1f7)
* *
* Outputs ATA taskfile to standard ATA host controller using MMIO * Outputs ATA taskfile to standard ATA host controller using MMIO
...@@ -466,15 +464,15 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix, ...@@ -466,15 +464,15 @@ static int do_drive_get_GTF(struct ata_port *ap, int ix,
* LOCKING: TBD: * LOCKING: TBD:
* Inherited from caller. * Inherited from caller.
*/ */
static void taskfile_load_raw(struct ata_port *ap, static void taskfile_load_raw(struct ata_device *dev,
struct ata_device *atadev, const struct taskfile_array *gtf)
const struct taskfile_array *gtf)
{ {
struct ata_port *ap = dev->ap;
struct ata_taskfile tf; struct ata_taskfile tf;
unsigned int err; unsigned int err;
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: " ata_dev_printk(dev, KERN_DEBUG, "%s: (0x1f1-1f7): hex: "
"%02x %02x %02x %02x %02x %02x %02x\n", "%02x %02x %02x %02x %02x %02x %02x\n",
__FUNCTION__, __FUNCTION__,
gtf->tfa[0], gtf->tfa[1], gtf->tfa[2], gtf->tfa[0], gtf->tfa[1], gtf->tfa[2],
...@@ -485,7 +483,7 @@ static void taskfile_load_raw(struct ata_port *ap, ...@@ -485,7 +483,7 @@ static void taskfile_load_raw(struct ata_port *ap,
&& (gtf->tfa[6] == 0)) && (gtf->tfa[6] == 0))
return; return;
ata_tf_init(atadev, &tf); ata_tf_init(dev, &tf);
/* convert gtf to tf */ /* convert gtf to tf */
tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */ tf.flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE; /* TBD */
...@@ -498,17 +496,16 @@ static void taskfile_load_raw(struct ata_port *ap, ...@@ -498,17 +496,16 @@ static void taskfile_load_raw(struct ata_port *ap,
tf.device = gtf->tfa[5]; /* 0x1f6 */ tf.device = gtf->tfa[5]; /* 0x1f6 */
tf.command = gtf->tfa[6]; /* 0x1f7 */ tf.command = gtf->tfa[6]; /* 0x1f7 */
err = ata_exec_internal(atadev, &tf, NULL, DMA_NONE, NULL, 0); err = ata_exec_internal(dev, &tf, NULL, DMA_NONE, NULL, 0);
if (err && ata_msg_probe(ap)) if (err && ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_ERR, ata_dev_printk(dev, KERN_ERR,
"%s: ata_exec_internal failed: %u\n", "%s: ata_exec_internal failed: %u\n",
__FUNCTION__, err); __FUNCTION__, err);
} }
/** /**
* do_drive_set_taskfiles - write the drive taskfile settings from _GTF * do_drive_set_taskfiles - write the drive taskfile settings from _GTF
* @ap: the ata_port for the drive * @dev: target ATA device
* @atadev: target ata_device
* @gtf_length: total number of bytes of _GTF taskfiles * @gtf_length: total number of bytes of _GTF taskfiles
* @gtf_address: location of _GTF taskfile arrays * @gtf_address: location of _GTF taskfile arrays
* *
...@@ -517,30 +514,31 @@ static void taskfile_load_raw(struct ata_port *ap, ...@@ -517,30 +514,31 @@ static void taskfile_load_raw(struct ata_port *ap,
* Write {gtf_address, length gtf_length} in groups of * Write {gtf_address, length gtf_length} in groups of
* REGS_PER_GTF bytes. * REGS_PER_GTF bytes.
*/ */
static int do_drive_set_taskfiles(struct ata_port *ap, static int do_drive_set_taskfiles(struct ata_device *dev,
struct ata_device *atadev, unsigned int gtf_length, unsigned int gtf_length,
unsigned long gtf_address) unsigned long gtf_address)
{ {
int err = -ENODEV; struct ata_port *ap = dev->ap;
int gtf_count = gtf_length / REGS_PER_GTF; int err = -ENODEV;
int ix; int gtf_count = gtf_length / REGS_PER_GTF;
int ix;
struct taskfile_array *gtf; struct taskfile_array *gtf;
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: ENTER: port#: %d\n", ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER: port#: %d\n",
__FUNCTION__, ap->port_no); __FUNCTION__, ap->port_no);
if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA)) if (libata_noacpi || !(ap->cbl == ATA_CBL_SATA))
return 0; return 0;
if (!ata_dev_enabled(atadev) || (ap->flags & ATA_FLAG_DISABLED)) if (!ata_dev_enabled(dev) || (ap->flags & ATA_FLAG_DISABLED))
goto out; goto out;
if (!gtf_count) /* shouldn't be here */ if (!gtf_count) /* shouldn't be here */
goto out; goto out;
if (gtf_length % REGS_PER_GTF) { if (gtf_length % REGS_PER_GTF) {
if (ata_msg_drv(ap)) if (ata_msg_drv(ap))
ata_dev_printk(atadev, KERN_ERR, ata_dev_printk(dev, KERN_ERR,
"%s: unexpected GTF length (%d)\n", "%s: unexpected GTF length (%d)\n",
__FUNCTION__, gtf_length); __FUNCTION__, gtf_length);
goto out; goto out;
...@@ -551,7 +549,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap, ...@@ -551,7 +549,7 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
(gtf_address + ix * REGS_PER_GTF); (gtf_address + ix * REGS_PER_GTF);
/* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */ /* send all TaskFile registers (0x1f1-0x1f7) *in*that*order* */
taskfile_load_raw(ap, atadev, gtf); taskfile_load_raw(dev, gtf);
} }
err = 0; err = 0;
...@@ -567,11 +565,11 @@ static int do_drive_set_taskfiles(struct ata_port *ap, ...@@ -567,11 +565,11 @@ static int do_drive_set_taskfiles(struct ata_port *ap,
*/ */
int ata_acpi_exec_tfs(struct ata_port *ap) int ata_acpi_exec_tfs(struct ata_port *ap)
{ {
int ix; int ix;
int ret =0; int ret = 0;
unsigned int gtf_length; unsigned int gtf_length;
unsigned long gtf_address; unsigned long gtf_address;
unsigned long obj_loc; unsigned long obj_loc;
if (libata_noacpi) if (libata_noacpi)
return 0; return 0;
...@@ -584,11 +582,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap) ...@@ -584,11 +582,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
return 0; return 0;
for (ix = 0; ix < ATA_MAX_DEVICES; ix++) { for (ix = 0; ix < ATA_MAX_DEVICES; ix++) {
if (!ata_dev_enabled(&ap->device[ix])) struct ata_device *dev = &ap->device[ix];
if (!ata_dev_enabled(dev))
continue; continue;
ret = do_drive_get_GTF(ap, ix, ret = do_drive_get_GTF(dev, &gtf_length, &gtf_address,
&gtf_length, &gtf_address, &obj_loc); &obj_loc);
if (ret < 0) { if (ret < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_port_printk(ap, KERN_DEBUG, ata_port_printk(ap, KERN_DEBUG,
...@@ -597,8 +597,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) ...@@ -597,8 +597,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
break; break;
} }
ret = do_drive_set_taskfiles(ap, &ap->device[ix], ret = do_drive_set_taskfiles(dev, gtf_length, gtf_address);
gtf_length, gtf_address);
kfree((void *)obj_loc); kfree((void *)obj_loc);
if (ret < 0) { if (ret < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
...@@ -614,8 +613,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap) ...@@ -614,8 +613,7 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
/** /**
* ata_acpi_push_id - send Identify data to drive * ata_acpi_push_id - send Identify data to drive
* @ap: the ata_port for the drive * @dev: target ATA device
* @ix: drive index
* *
* _SDD ACPI object: for SATA mode only * _SDD ACPI object: for SATA mode only
* Must be after Identify (Packet) Device -- uses its data * Must be after Identify (Packet) Device -- uses its data
...@@ -623,57 +621,57 @@ int ata_acpi_exec_tfs(struct ata_port *ap) ...@@ -623,57 +621,57 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
* method and if it fails for whatever reason, we should still * method and if it fails for whatever reason, we should still
* just keep going. * just keep going.
*/ */
int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) int ata_acpi_push_id(struct ata_device *dev)
{ {
acpi_handle handle; struct ata_port *ap = dev->ap;
acpi_integer pcidevfn; acpi_handle handle;
int err; acpi_integer pcidevfn;
struct device *dev = ap->host->dev; int err;
struct ata_device *atadev = &ap->device[ix]; struct device *gdev = ap->host->dev;
u32 dev_adr; u32 dev_adr;
acpi_status status; acpi_status status;
struct acpi_object_list input; struct acpi_object_list input;
union acpi_object in_params[1]; union acpi_object in_params[1];
if (libata_noacpi) if (libata_noacpi)
return 0; return 0;
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, "%s: ix = %d, port#: %d\n", ata_dev_printk(dev, KERN_DEBUG, "%s: ix = %d, port#: %d\n",
__FUNCTION__, ix, ap->port_no); __FUNCTION__, dev->devno, ap->port_no);
/* Don't continue if not a SATA device. */ /* Don't continue if not a SATA device. */
if (!(ap->cbl == ATA_CBL_SATA)) { if (!(ap->cbl == ATA_CBL_SATA)) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: Not a SATA device\n", __FUNCTION__); "%s: Not a SATA device\n", __FUNCTION__);
goto out; goto out;
} }
/* Don't continue if device has no _ADR method. /* Don't continue if device has no _ADR method.
* _SDD is intended for known motherboard devices. */ * _SDD is intended for known motherboard devices. */
err = sata_get_dev_handle(dev, &handle, &pcidevfn); err = sata_get_dev_handle(gdev, &handle, &pcidevfn);
if (err < 0) { if (err < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: sata_get_dev_handle failed (%d\n", "%s: sata_get_dev_handle failed (%d\n",
__FUNCTION__, err); __FUNCTION__, err);
goto out; goto out;
} }
/* Get this drive's _ADR info, if not already known */ /* Get this drive's _ADR info, if not already known */
if (!atadev->obj_handle) { if (!dev->obj_handle) {
dev_adr = SATA_ADR_RSVD; dev_adr = SATA_ADR_RSVD;
err = get_sata_adr(dev, handle, pcidevfn, ix, ap, atadev, err = get_sata_adr(gdev, handle, pcidevfn, dev->devno, ap, dev,
&dev_adr); &dev_adr);
if (err < 0 || dev_adr == SATA_ADR_RSVD || if (err < 0 || dev_adr == SATA_ADR_RSVD ||
!atadev->obj_handle) { !dev->obj_handle) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s: get_sata_adr failed: " "%s: get_sata_adr failed: "
"err=%d, dev_adr=%u, obj_handle=0x%p\n", "err=%d, dev_adr=%u, obj_handle=0x%p\n",
__FUNCTION__, err, dev_adr, __FUNCTION__, err, dev_adr,
atadev->obj_handle); dev->obj_handle);
goto out; goto out;
} }
} }
...@@ -683,19 +681,19 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) ...@@ -683,19 +681,19 @@ int ata_acpi_push_id(struct ata_port *ap, unsigned int ix)
input.count = 1; input.count = 1;
input.pointer = in_params; input.pointer = in_params;
in_params[0].type = ACPI_TYPE_BUFFER; in_params[0].type = ACPI_TYPE_BUFFER;
in_params[0].buffer.length = sizeof(atadev->id[0]) * ATA_ID_WORDS; in_params[0].buffer.length = sizeof(dev->id[0]) * ATA_ID_WORDS;
in_params[0].buffer.pointer = (u8 *)atadev->id; in_params[0].buffer.pointer = (u8 *)dev->id;
/* Output buffer: _SDD has no output */ /* Output buffer: _SDD has no output */
/* It's OK for _SDD to be missing too. */ /* It's OK for _SDD to be missing too. */
swap_buf_le16(atadev->id, ATA_ID_WORDS); swap_buf_le16(dev->id, ATA_ID_WORDS);
status = acpi_evaluate_object(atadev->obj_handle, "_SDD", &input, NULL); status = acpi_evaluate_object(dev->obj_handle, "_SDD", &input, NULL);
swap_buf_le16(atadev->id, ATA_ID_WORDS); swap_buf_le16(dev->id, ATA_ID_WORDS);
err = ACPI_FAILURE(status) ? -EIO : 0; err = ACPI_FAILURE(status) ? -EIO : 0;
if (err < 0) { if (err < 0) {
if (ata_msg_probe(ap)) if (ata_msg_probe(ap))
ata_dev_printk(atadev, KERN_DEBUG, ata_dev_printk(dev, KERN_DEBUG,
"%s _SDD error: status = 0x%x\n", "%s _SDD error: status = 0x%x\n",
__FUNCTION__, status); __FUNCTION__, status);
} }
......
...@@ -1869,7 +1869,7 @@ int ata_dev_configure(struct ata_device *dev) ...@@ -1869,7 +1869,7 @@ int ata_dev_configure(struct ata_device *dev)
ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__); ata_dev_printk(dev, KERN_DEBUG, "%s: ENTER\n", __FUNCTION__);
/* set _SDD */ /* set _SDD */
rc = ata_acpi_push_id(ap, dev->devno); rc = ata_acpi_push_id(dev);
if (rc) { if (rc) {
ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n", ata_dev_printk(dev, KERN_WARNING, "failed to set _SDD(%d)\n",
rc); rc);
......
...@@ -99,13 +99,13 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host); ...@@ -99,13 +99,13 @@ extern struct ata_port *ata_port_alloc(struct ata_host *host);
/* libata-acpi.c */ /* libata-acpi.c */
#ifdef CONFIG_ATA_ACPI #ifdef CONFIG_ATA_ACPI
extern int ata_acpi_exec_tfs(struct ata_port *ap); extern int ata_acpi_exec_tfs(struct ata_port *ap);
extern int ata_acpi_push_id(struct ata_port *ap, unsigned int ix); extern int ata_acpi_push_id(struct ata_device *dev);
#else #else
static inline int ata_acpi_exec_tfs(struct ata_port *ap) static inline int ata_acpi_exec_tfs(struct ata_port *ap)
{ {
return 0; return 0;
} }
static inline int ata_acpi_push_id(struct ata_port *ap, unsigned int ix) static inline int ata_acpi_push_id(struct ata_device *dev)
{ {
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment