public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Wang, Jian J" <jian.j.wang@intel.com>
Subject: Re: [PATCH v2 0/2] Add PEI BlockIO support for ATA AHCI mode devices
Date: Mon, 22 Apr 2019 20:20:15 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C0FC8E8@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190410011313.4268-1-hao.a.wu@intel.com>

Comments:
1. Can we add EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST to  mAhciAtaPassThruPpiListTemplate/mAhciBlkIoPpiListTemplate as well? I understand that requires calling PeiServicesInstallPpi() 3 times instead of once. But I see the benefit of change is the code is more understandable and potential bug-free. And you could also create a global mAhciBlkIoPpi/mAhciBlkIo2Ppi variables and let the mAhciBlkIoPpiListTemplate/mAhciBlkIo2PpiListTemplate point to them respectively. The reason we cannot have a global AtaPassThruPpi is there is a Mode field in the PPI that cannot be read-only.
2. Below code snip is used by AhciBlockIoReadBlocks(),AhciBlockIoGetMediaInfo(), AhciBlockIoGetMediaInfo2() in AhciPeiBlockIo.c, maybe you can re-write SearchDeviceByIndex() to include the below code.
	
  Private = GET_AHCI_PEIM_HC_PRIVATE_DATA_FROM_THIS_BLKIO (This);

  //
  // Check parameters
  //
  if ((This == NULL) ||
      (DeviceIndex == 0) ||
      (DeviceIndex > Private->ActiveDevices)) {
    return EFI_INVALID_PARAMETER;
  }

  DeviceData = SearchDeviceByIndex (Private, DeviceIndex);
  if (DeviceData == NULL) {
    return EFI_NOT_FOUND;
  }

3. For the checks in AhciRead(), how about re-order as below?

  BlockSize = DeviceData->Media.BlockSize;
  if ((BufferSize % BlockSize) != 0) {
    return EFI_BAD_BUFFER_SIZE;
  }

  if (StartLba > DeviceData->Media.LastBlock) {
    return EFI_INVALID_PARAMETER;
  }
  NumberOfBlocks  = BufferSize / BlockSize;
  if (NumberOfBlocks - 1 > DeviceData->Media.LastBlock - StartLba) {
    return EFI_INVALID_PARAMETER;
  }

  if (BufferSize == 0) {
    return EFI_SUCCESS;
  }

  if (Buffer == NULL) {
    return EFI_INVALID_PARAMETER;
  }

4. Can you explain more for the first patch? Why VTd PEI module cannot be changed to support 0xFFFF?

//
// Due to limited resource on VTd PEI DMA buffer size, driver limits the
// maximum transfer block number for 48-bit addressing.
// Setting to 0x800 here means 1M bytes for device with 512-byte block size.
//
#define MAX_48BIT_TRANSFER_BLOCK_NUM     0x800


> -----Original Message-----
> From: Wu, Hao A
> Sent: Tuesday, April 9, 2019 6:13 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong,
> Eric <eric.dong@intel.com>; Wang, Jian J <jian.j.wang@intel.com>
> Subject: [PATCH v2 0/2] Add PEI BlockIO support for ATA AHCI mode devices
> 
> The series is also available at:
> https://github.com/hwu25/edk2/tree/ahci_pei_blockio_v2
> 
> 
> V2 changges:
> 
> Due to the file license change, rebase the whole series onto the tip of the
> master branch. The 'Contributed-under' tag is removed from the log
> messages as well.
> 
> 
> V1 history:
> 
> The series will add the PEI BlockIO support for ATA AHCI mode devices.
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> 
> Hao Wu (2):
>   MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address
>   MdeModulePkg/AhciPei: Add PEI BlockIO support
> 
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.inf      |   4 +
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.h        |  30 ++
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPeiBlockIo.h | 257 ++++++++++
>  MdeModulePkg/Bus/Ata/AhciPei/AhciMode.c       | 125 ++++-
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPei.c        |  35 +-
>  MdeModulePkg/Bus/Ata/AhciPei/AhciPeiBlockIo.c | 526
> ++++++++++++++++++++
>  6 files changed, 975 insertions(+), 2 deletions(-)  create mode 100644
> MdeModulePkg/Bus/Ata/AhciPei/AhciPeiBlockIo.h
>  create mode 100644 MdeModulePkg/Bus/Ata/AhciPei/AhciPeiBlockIo.c
> 
> --
> 2.12.0.windows.1


  parent reply	other threads:[~2019-04-22 20:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-10  1:13 [PATCH v2 0/2] Add PEI BlockIO support for ATA AHCI mode devices Wu, Hao A
2019-04-10  1:13 ` [PATCH v2 1/2] MdeModulePkg/AhciPei: Limit max transfer blocknum for 48-bit address Wu, Hao A
2019-04-10  1:13 ` [PATCH v2 2/2] MdeModulePkg/AhciPei: Add PEI BlockIO support Wu, Hao A
2019-04-22 20:20 ` Ni, Ray [this message]
2019-04-23  5:17   ` [PATCH v2 0/2] Add PEI BlockIO support for ATA AHCI mode devices Wu, Hao A
2019-04-23  6:40     ` Ni, Ray

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5C0FC8E8@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox