MdeModulePkg SataControllerDxe: Calculate ChannelCount based on PI value
Current code calculates ChannelCount based on CAP(NP) value. It only works when the ports implemented number are <= CAP(NP), for example, platform has CAP(NP) = 5 (means 6 ports) and ports implemented are 0, 1, 2, 3, 4 and 5. But we have some platform that has CAP(NP) = 1 (means 2 ports) and ports implemented are 1 and 2, and has no port 0 implemented, then current code does not work. This patch updates the code to calculate ChannelCount based on PI value. Cc: Amy Chan <amy.chan@intel.com> Cc: Hong-chihX Hsueh <hong-chihx.hsueh@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Hao Wu <hao.a.wu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com> Tested-by: Hong-chihX Hsueh <hong-chihx.hsueh@intel.com>
This commit is contained in:
@@ -44,6 +44,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gSataControllerComponentName2;
|
||||
#define R_AHCI_CAP 0x0
|
||||
#define B_AHCI_CAP_NPS (BIT4 | BIT3 | BIT2 | BIT1 | BIT0) // Number of Ports
|
||||
#define B_AHCI_CAP_SPM BIT17 // Supports Port Multiplier
|
||||
#define R_AHCI_PI 0xC
|
||||
|
||||
///
|
||||
/// AHCI each channel can have up to 1 device
|
||||
|
Reference in New Issue
Block a user