]> git.proxmox.com Git - mirror_edk2.git/commit
DuetPkg: SataControllerDxe: fix private array subscripting
authorLaszlo Ersek <lersek@redhat.com>
Tue, 22 Sep 2015 11:18:13 +0000 (11:18 +0000)
committerlersek <lersek@Edk2>
Tue, 22 Sep 2015 11:18:13 +0000 (11:18 +0000)
commit83be6beea56f9f6e93c04f316e91be18e44654f0
tree866f470ec572a4b8d4fb278b0c0eeb79e2369b7c
parentd80e8c459ab29d198a4718bec9fd77d3fa2db1ee
DuetPkg: SataControllerDxe: fix private array subscripting

Each one of the DisqualifiedModes, IdentifyData and IdentifyValid arrays
in the EFI_SATA_CONTROLLER_PRIVATE_DATA structure is a matrix, represented
as a flat array.

The code currently uses the incorrect formula

  Channel * Device

to index them. The right formula is

  [Channel][Device]

which can be implemented as

  Channel * NumDevicePerChannel + Device

Add a helper function that does this, and replace the incorrect
subscripts.

Cc: Alexander Graf <agraf@suse.de>
Cc: Reza Jelveh <reza.jelveh@tuhh.de>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Gabriel L. Somlo <somlo@cmu.edu>
Cc: Feng Tian <feng.tian@intel.com>
Reported-by: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Tested-by: Gabriel Somlo <somlo@cmu.edu>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18525 6f19259b-4bc3-4df7-8a09-765794883524
DuetPkg/SataControllerDxe/SataController.c