Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139869
b: refs/heads/master
c: 4aaf2fe
h: refs/heads/master
i:
  139867: 8592da9
v: v3
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 1, 2009
1 parent 1c1f374 commit 3b152e5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 73855e13b2bce2bb5cd2a62c270fb07f49353e02
refs/heads/master: 4aaf2fec718f6fbf38668edf733a0ab09a49cab1
30 changes: 13 additions & 17 deletions trunk/drivers/block/xsysace.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/platform_device.h>
#if defined(CONFIG_OF)
Expand Down Expand Up @@ -208,7 +209,7 @@ struct ace_device {
struct gendisk *gd;

/* Inserted CF card parameters */
struct hd_driveid cf_id;
u16 cf_id[ATA_ID_WORDS];
};

static int ace_major;
Expand Down Expand Up @@ -402,21 +403,14 @@ static void ace_dump_regs(struct ace_device *ace)
ace_in32(ace, ACE_CFGLBA), ace_in(ace, ACE_FATSTAT));
}

void ace_fix_driveid(struct hd_driveid *id)
void ace_fix_driveid(u16 *id)
{
#if defined(__BIG_ENDIAN)
u16 *buf = (void *)id;
int i;

/* All half words have wrong byte order; swap the bytes */
for (i = 0; i < sizeof(struct hd_driveid); i += 2, buf++)
*buf = le16_to_cpu(*buf);

/* Some of the data values are 32bit; swap the half words */
id->lba_capacity = ((id->lba_capacity >> 16) & 0x0000FFFF) |
((id->lba_capacity << 16) & 0xFFFF0000);
id->spg = ((id->spg >> 16) & 0x0000FFFF) |
((id->spg << 16) & 0xFFFF0000);
for (i = 0; i < ATA_ID_WORDS; i++, id++)
*id = le16_to_cpu(*id);
#endif
}

Expand Down Expand Up @@ -614,7 +608,7 @@ static void ace_fsm_dostate(struct ace_device *ace)
break;

case ACE_FSM_STATE_IDENTIFY_COMPLETE:
ace_fix_driveid(&ace->cf_id);
ace_fix_driveid(&ace->cf_id[0]);
ace_dump_mem(&ace->cf_id, 512); /* Debug: Dump out disk ID */

if (ace->data_result) {
Expand All @@ -627,9 +621,10 @@ static void ace_fsm_dostate(struct ace_device *ace)
ace->media_change = 0;

/* Record disk parameters */
set_capacity(ace->gd, ace->cf_id.lba_capacity);
set_capacity(ace->gd,
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
dev_info(ace->dev, "capacity: %i sectors\n",
ace->cf_id.lba_capacity);
ata_id_u32(&ace->cf_id, ATA_ID_LBA_CAPACITY));
}

/* We're done, drop to IDLE state and notify waiters */
Expand Down Expand Up @@ -928,12 +923,13 @@ static int ace_release(struct gendisk *disk, fmode_t mode)
static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
struct ace_device *ace = bdev->bd_disk->private_data;
u16 *cf_id = &ace->cf_id[0];

dev_dbg(ace->dev, "ace_getgeo()\n");

geo->heads = ace->cf_id.heads;
geo->sectors = ace->cf_id.sectors;
geo->cylinders = ace->cf_id.cyls;
geo->heads = cf_id[ATA_ID_HEADS];
geo->sectors = cf_id[ATA_ID_SECTORS];
geo->cylinders = cf_id[ATA_ID_CYLS];

return 0;
}
Expand Down

0 comments on commit 3b152e5

Please sign in to comment.