qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ahci: SATA FIS is 20 bytes, not 0x20


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] ahci: SATA FIS is 20 bytes, not 0x20
Date: Wed, 23 May 2012 17:48:29 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1

Am 23.05.2012 01:26, schrieb Daniel Verkamp:
As in the SATA and AHCI specifications, a FIS is 5 Dwords of 4 bytes
each, which comes to 20 bytes (decimal), not 0x20.

Signed-off-by: Daniel Verkamp<address@hidden>
---
  hw/ide/ahci.c |    4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hw/ide/ahci.c b/hw/ide/ahci.c
index a883a92..2d7d03d 100644
--- a/hw/ide/ahci.c
+++ b/hw/ide/ahci.c
@@ -462,7 +462,7 @@ static void ahci_check_cmd_bh(void *opaque)

  static void ahci_init_d2h(AHCIDevice *ad)
  {
-    uint8_t init_fis[0x20];
+    uint8_t init_fis[20];
      IDEState *ide_state =&ad->port.ifs[0];

The current code only uses 14 elements, so 20 elements
still waste some local memory (and 0x20 elements waste
even more).



      memset(init_fis, 0, sizeof(init_fis));
@@ -619,7 +619,7 @@ static void ahci_write_fis_d2h(AHCIDevice *ad, uint8_t 
*cmd_fis)
      d2h_fis[11] = cmd_fis[11];
      d2h_fis[12] = cmd_fis[12];
      d2h_fis[13] = cmd_fis[13];
-    for (i = 14; i<  0x20; i++) {
+    for (i = 14; i<  20; i++) {
          d2h_fis[i] = 0;
      }

I am not sure whether this change is correct.
This code does _not_ access the array which was allocated above:

    d2h_fis = &ad->res_fis[RES_FIS_RFIS];

Regards,
Stefan W.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]