X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=drivers%2Fblock%2Fahci.c;h=a3ca2dcaf70e7b3535816a24d2193c9ec31513d3;hb=cb32ed1fc298875845f166d326a3f2704a0d5364;hp=e1b66fd4b6d3a9fa7b475ac66f796206a1f10e25;hpb=1785dbeed43599eed1d8875673c96912cd770141;p=u-boot diff --git a/drivers/block/ahci.c b/drivers/block/ahci.c index e1b66fd4b6..a3ca2dcaf7 100644 --- a/drivers/block/ahci.c +++ b/drivers/block/ahci.c @@ -1,5 +1,5 @@ /* - * Copyright (C) Freescale Semiconductor, Inc. 2006. All rights reserved. + * Copyright (C) Freescale Semiconductor, Inc. 2006. * Author: Jason Jin * Zhang Wei * @@ -602,7 +602,7 @@ static int ata_scsiop_read10(ccb * pccb) */ static int ata_scsiop_read_capacity10(ccb *pccb) { - u8 buf[8]; + u32 cap; if (!ataid[pccb->target]) { printf("scsi_ahci: SCSI READ CAPACITY10 command failure. " @@ -611,14 +611,12 @@ static int ata_scsiop_read_capacity10(ccb *pccb) return -EPERM; } - memset(buf, 0, 8); + cap = le32_to_cpu(ataid[pccb->target]->lba_capacity); + memcpy(pccb->pdata, &cap, sizeof(cap)); - *(u32 *) buf = le32_to_cpu(ataid[pccb->target]->lba_capacity); - - buf[6] = 512 >> 8; - buf[7] = 512 & 0xff; - - memcpy(pccb->pdata, buf, 8); + pccb->pdata[4] = pccb->pdata[5] = 0; + pccb->pdata[6] = 512 >> 8; + pccb->pdata[7] = 512 & 0xff; return 0; }