Skip to content

sw_apps: zynqmp_fsbl: Fixed setting of secondary boot device #170

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 484 commits into
base: master
Choose a base branch
from

Conversation

martinexner
Copy link

In zynqmp_fsbl, two different sets of macros with different values are used to compare the value of FsblInstancePtr->SecondaryBootDevice:

  • XFsbl_SecondaryBootDeviceInit uses XIH_IHT_PPD_*
  • XFsbl_ValidateHeader uses XFSBL_*_BOOT_MODE

This can lead to unexpected behavior as their values do not correspond:

XIH_IHT_PPD_SAME   == XFSBL_JTAG_BOOT_MODE   == 0
XIH_IHT_PPD_QSPI32 == XFSBL_QSPI24_BOOT_MODE == 1
XIH_IHT_PPD_QSPI24 == XFSBL_QSPI32_BOOT_MODE == 2
XIH_IHT_PPD_NAND   == XFSBL_SD0_BOOT_MODE    == 3
XIH_IHT_PPD_SD_0   == XFSBL_NAND_BOOT_MODE   == 4
XIH_IHT_PPD_SD_1   == XFSBL_SD1_BOOT_MODE    == 5
XIH_IHT_PPD_SD_LS  == XFSBL_EMMC_BOOT_MODE   == 6
XIH_IHT_PPD_MMC    == XFSBL_USB_BOOT_MODE    == 7

In more detail:

  1. SecondaryBootDevice is set to the partition present device value read from the image header (for example XIH_IHT_PPD_NAND which is 0x3, see step 4), then, XFsbl_SecondaryBootDeviceInit is called.

u32 XFsbl_BootDeviceInitAndValidate(XFsblPs * FsblInstancePtr)

u32 XFsbl_BootDeviceInitAndValidate(XFsblPs * FsblInstancePtr)
{​
	// ...
	/**
	 * Update the secondary boot device
	 */
	FsblInstancePtr->SecondaryBootDevice =
	 FsblInstancePtr->ImageHeader.ImageHeaderTable.PartitionPresentDevice;

	/**
	 *  Configure the secondary boot device if required
	 */
	if (FsblInstancePtr->SecondaryBootDevice !=
			FsblInstancePtr->PrimaryBootDevice) {
		Status = XFsbl_SecondaryBootDeviceInit(FsblInstancePtr);
		if (XFSBL_SUCCESS != Status) {
			goto END;
		}
	}

END:
	return Status;
}
  1. XFsbl_SecondaryBootDeviceInit switches depending on the previously set SecondaryBootDevice and uses the correct macros (for example XIH_IHT_PPD_NAND), then calls XFsbl_ValidateHeader

static u32 XFsbl_SecondaryBootDeviceInit(XFsblPs * FsblInstancePtr)

static u32 XFsbl_SecondaryBootDeviceInit(XFsblPs * FsblInstancePtr)
{
	// ...
	switch (FsblInstancePtr->SecondaryBootDevice) {
	// ...
	case XIH_IHT_PPD_NAND: {
		XFsbl_Printf(DEBUG_GENERAL, "NAND Boot Mode \n\r");
		// ...
	}
	// ...
	}
	// ...
	/**
	 * Initialize the Secondary Boot Device Driver
	 */
	if (Status == XFSBL_SUCCESS) {
		// ...
		if(Status == XFSBL_SUCCESS) {
			Status = XFsbl_ValidateHeader(FsblInstancePtr);
			// ...
		}
	}

}
  1. XFsbl_ValidateHeader, however, compares SecondaryBootDevice with the wrong macros (e.g. XFSBL_SD0_BOOT_MODE, which is also 0x3, see step 4)

static u32 XFsbl_ValidateHeader(XFsblPs * FsblInstancePtr)

static u32 XFsbl_ValidateHeader(XFsblPs * FsblInstancePtr)
{
	// ...
	else
	{
		if (!((FsblInstancePtr->SecondaryBootDevice == XFSBL_SD0_BOOT_MODE)
				|| (FsblInstancePtr->SecondaryBootDevice == XFSBL_EMMC_BOOT_MODE)
				|| (FsblInstancePtr->SecondaryBootDevice == XFSBL_SD1_BOOT_MODE)
				|| (FsblInstancePtr->SecondaryBootDevice == XFSBL_SD1_LS_BOOT_MODE)
				|| (FsblInstancePtr->SecondaryBootDevice == XFSBL_USB_BOOT_MODE))) {
			FsblInstancePtr->ImageOffsetAddress = MultiBootOffset
					* XFSBL_IMAGE_SEARCH_OFFSET;
		}
	}
	// ...
}
  1. XIH_IHT_PPD_NAND and XFSBL_SD0_BOOT_MODE are both defined as 0x3

#define XIH_IHT_PPD_NAND (0x3U)

#define XFSBL_SD0_BOOT_MODE (0x3U)

Jagadeesh Banisetti and others added 30 commits May 12, 2021 06:25
This patch loads the BKSV only once at initialisation.

Signed-off-by: Jagadeesh Banisetti <jagadeesh.banisetti@xilinx.com>

Acked-for-series: Vishal Sagar <vishal.sagar@xilinx.com>
This reverts commit 83e589bfc5d94fc555a1537d0897f8b18f812a8a.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
This reverts commit 238ab744c92904bee1b817536af43a58bd1918b9.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Few of the #defines present in standalone/src/common/xstatus.h
are missing in copy of xstatus.h present in common driver.
As of now keeping both copies of xstatus.h in sync, in future
xstatus.h would be removed from common driver, users are expected
to use standalone/src/common/xstatus.h instead of
common driver xstatus.h.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
As of now keeping both copies of xdebug.h in sync, in future
xdebug.h would be removed from common driver, users are expected
to use standalone/src/common/xdebug.h instead of
common driver xdebug.h.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Fixed warnings reported by doxygen tool. Also, incremented
driver version to 2.11.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.padugu@xilinx.com>
Updated doxygen tags with latest driver version 2.11.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>

Acked-for-series: Siva Durga Prasad Paladugu <siva.durga.padugu@xilinx.com>
This patch adds support to get the base address of the device.

Signed-off-by: Ronak Jain <ronak.jain@xilinx.com>
Acked-by: Izhar Ameer Shaikh <izhar.ameer.shaikh@xilinx.com>
Add TESTAPP_GEN protection for global variables to fix the
"multiple definition" compilation errors with latest toolchain
on peripheral tests.

Signed-off-by: Shravya Kumbham <shravya.kumbham@xilinx.com>
Acked-by: Harini Katakam <harini.katakam@xilinx.com>
Change L2 interrupt enabling macro to 0x3F as BC 0 to 5 are used only
for interrupt routing in SHIM.

Signed-off-by: Wendy Liang <wendy.liang@xilinx.com>
Acked-by: Tejus Siddagangaiah <tejus.siddagangaiah@xilinx.com>
We can not identify specific lmb_bram_if_cntlr instance from
existing canonicals.

Updated tcl to export additional #define related to address
parameters of lmb_bram_if_cntlr, to identify specific instance
of lmb_bram_if_cntlr.

Signed-off-by: Mubin Usman Sayyed <mubin.usman.sayyed@xilinx.com>
Acked-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
… DDR present in design

The patch adds provision to load bitstream from OCM even if DDR is present in design.

Signed-off-by: Vikram Sreenivasa Batchali <b.vikram@xilinx.com>
Acked-by: Krishna Chaitanya Patakamuri <krishna.chaitanya.patakamuri@xilinx.com>
Enabled caches to speed up VCU118 rxo app.

Signed-off-by: nishantd <nishant.dhonde@xilinx.com>

Acked-for-series: Kapil Usgaonkar<kapil.usgaonkar@xilinx.com>
…r VCU118.

Enabled Cache to speed up VCU118 txo app. Bit[12] of 0x1A4(MISC0) set to send VSC every frame.

Signed-off-by: nishantd <nishant.dhonde@xilinx.com>

Acked-for-series: Kapil Usgaonkar<kapil.usgaonkar@xilinx.com>
Add valid_seg, half_valid_seg and line_num fields to the
h/w descriptor and remove s_axilite registers for the same.

Signed-off-by: Vivek Veenam <vivek.veenam@xilinx.com>
Acked-by: Sandip Kothari <sandipk@xilinx.com>
This patches resets the read mode which is set already
after eFuse write.
The XNvm_EfuseSetReadMode API expects a clean value before
proceeding for comparision. Due to unset Readmode value the
comparision check is failing.

Signed-off-by: Kalyani Akula <kalyani.akula@xilinx.com>
Acked-by: Mohan Marutirao Dhanawade <mohan.dhanawade@xilinx.com>
Before doing any FRL SCDC write, the Ready bit is checked. Currently this
fails if in first attempt the ready bit is set and core is found busy
with FRL SCDC transactions.
Instead retry for fixed number of times (512) to check if FRL SCDC
transactions can be done or not.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>

Acked-for-series: Anil Kumar Chimbeti <anil.chimeti@xilinx.com>
The loop back case is failing because the sink version isn't being set
to 1 when the SCDC registers are cleared. Fix this in
XV_HdmiRx1_DdcScdcClear().

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>

Acked-for-series: Anil Kumar Chimbeti <anil.chimeti@xilinx.com>
if resource tries to reserve and is unavailable print
warning instead of error

Signed-off-by: Alex Kiani <alex.kiani@xilinx.com>
Acked-by: Wendy Liang <wendy.liang@xilinx.com>
…l definitions

Some of video driver examples use direct definition macros which is wrong.
So exmaples are modified to use canonical form of definitions in video
driver example applications.

Signed-off-by: Prasad Gutti <prasad.gutti@xilinx.com>
Acked-by: Sandip Kothari <sandipk@xilinx.com>
DPDMA subsystem initialization resets some link configurations,
which overwrites configs set by DP training, so call
InitDpDmaSubsystem() before the DP link training.

This fixes black screen issue for monitors having link rate
capacity max upto 2.7Gbps

While at it, updated driver version(minor) to 1.4 for 2021.1 release.

Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com>

Acked-by:Varunkumar Allagadapa <varunkumar.allagadapa@xilinx.com>
The existing API Xil_IsSpinLockEnabled is dereferencing to address zero
when spinlock mechanism is not enabled. Though it may not result in
crash and many of the test cases would still pass, this is incorrect
implementation which is fixed in this patch.

Signed-off-by: Anirudha Sarangi <anirudha.sarangi@xilinx.com>
Acked-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
The XV_HdmiRx1_FrlDdcWriteField() returns only XST_FAILURE or
XST_DEVICE_BUSY. Fix this to correctly return XST_SUCCESS.

Signed-off-by: Vishal Sagar <vishal.sagar@xilinx.com>
Acked-by: Anil Kumar Chimbeti <anil.chimeti@xilinx.com>
Fixed issue where driver was attempting to start ADC 3 for DFE variant
(ADC 3 does not exist in this case).
Some refactoring for XRFdc_GetTileLayout, XRFdc_RestartIPSM and
XRFdc_WaitForState were also required to do this.

Signed-off-by: Conall O'Griofa <conall.o'griofa@xilinx.com>

Acked-for-series: Anand Ashok Dumbre <anandash@xilinx.com>
Fixed issue where ADC0 would not fully start if distributing a full rate
clock from ADC 1 to ADC 0 and ADC 2/3.

Signed-off-by: Conall O'Griofa <conall.o'griofa@xilinx.com>

Acked-for-series: Anand Ashok Dumbre <anandash@xilinx.com>
Rename MAX/MIN to XRFDC_MAX/XRFDC_MIN to avoid any potential conflicts.

Signed-off-by: Conall O'Griofa <conall.o'griofa@xilinx.com>

Acked-for-series: Anand Ashok Dumbre <anandash@xilinx.com>
If running the IPSM from a state further along than "shutdown"
then in certain cases the some extra dividers and delays must
be set in order for calibration to run optimally.
Also needed to flip bits in dynamicpllconfig.

Signed-off-by: Conall O'Griofa <conall.o'griofa@xilinx.com>

Acked-for-series: Anand Ashok Dumbre <anandash@xilinx.com>
getEvent did not return XAIE_OK on proper event return
update so that if tile found, RC set to XAIE_OK

Signed-off-by: Alex Kiani <alex.kiani@xilinx.com>
Acked-by: Wendy Liang <wendy.liang@xiilnx.com>
3GB DL output is not coming because bit 15 of payload and the VTC are
incorrectly configured for 3G DL case because the video stream properties
struct doesn't have a member to store the transport scan/type in the video
common struct.
The Transport Scan bit for 3GB DL should be interlaced. This patch modifies
exclusively for 3GB DL. Even the reporting API is also currently fixed only
for 3GB DL path.

Once the video common library structure has member for transport type
(interlaced / progressive), this patch would need modification.

Signed-off-by: Jagadeesh Banisetti <jagadeesh.banisetti@xilinx.com>
Acked-by: Sandip Kothari <sandipk@xilinx.com>
Fixed doxygen warnings in xilfpga source code

Signed-off-by: Nava kishore Manne <nava.manne@xilinx.com>
Acked-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
Ronak Jain and others added 19 commits June 2, 2021 23:28
This patch fixes MISRA C-2012 Rule 12.3 i.e. the comma operator
should not be used.

Signed-off-by: Ronak Jain <ronak.jain@xilinx.com>

Acked-for-series: Rajan Vaja <rajan.vaja@xilinx.com>
This patch fixes MISRA C-2012 Rule 4.6, i.e. typedefs that indicate
size and signedness should be used in place of the basic numerical
types.

Signed-off-by: Ronak Jain <ronak.jain@xilinx.com>

Acked-for-series: Rajan Vaja <rajan.vaja@xilinx.com>
This patch fixes MISRA C-2012 Rule 4.6, i.e. typedefs that indicate
size and signedness should be used in place of the basic numerical
types.

Signed-off-by: Ronak Jain <ronak.jain@xilinx.com>

Acked-for-series: Rajan Vaja <rajan.vaja@xilinx.com>
This patch fixes advisory MISRA rule 8.13 i.e. a pointer should
point to const-qualified type whenever possible.

Signed-off-by: Ronak Jain <ronak.jain@xilinx.com>

Acked-for-series: Rajan Vaja <rajan.vaja@xilinx.com>
This commit updates device names to their proper name

Signed-off-by: Nicole Baze <nicole.baze@xilinx.com>
Acked-by: Jyotheeswar Reddy Mutthareddyvari <jyotheeswar.reddy.mutthareddyvari@xilinx.com>
Remove not needed text from PRACH doxygen documentation.

Signed-off-by: Dragan Cvetic <dragan.cvetic@xilinx.com>
Acked-by: Anish Kadamathikuttiyil Karthikeyan Pillai <anishk@xilinx.com>
Update the ReadMesage and WriteMessage routines to calculate CRC
for IPI buffer contents rather than user provided buffer. This is
needed as the remote side will operate on IPI buffer and not on the user buffer.
Also removed the check of Msglength with IPI buffer max length as user can
provide data of any size and no need to force the user to provide IPI
max length always.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Acked-by: Srinivas Goud <srinivas.goud@xilinx.com>
updated changelog

Signed-off-by: Meena Paleti <meena.paleti@xilinx.com>

Acked-by : Siva Addepalli<saddepal@xilinx.com>
updated changelog

Signed-off-by: Meena Paleti <meena.paleti@xilinx.com>

Acked-by : Siva Addepalli<saddepal@xilinx.com>
Fix issue in that when querying for if a PGGS Node has been requested, the node
being queried would be off by one. Fix this by adding 1 to the calculated ID
for a PGGS Node.

This is a fix because the lowest valid RegNum is 0U and the lowest possible
PGGS Node ID is 4. As GGS_MAX is 3 an extra addition of 1 is required
to construct the Node ID to be queried in a correct manner.

Signed-off-by: Ben Levinsky <ben.levinsky@xilinx.com>
Acked-by: Ravi Patel <ravi.patel@xilinx.com>
updated changelog

Signed-off-by: Meena Paleti <meena.paleti@xilinx.com>

Acked-by : Siva Addepalli<saddepal@xilinx.com>
This patch fixes "warning: cast from pointer to integer of different size"
for R5 processor by typecasting with UINTPTR instead of u64.

Signed-off-by: Harsha <harsha.harsha@xilinx.com>
Acked-by: Kalyani Akula <Kalyani.akula@xilinx.com>
Fixed MISRA C-2012 Declarations and Definitions (Rule 8.4) below
warning:
misra_c_2012_rule_8_4_violation: Object definition does not have
a visible prototype."

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>

Acked-for-series: Srinivas Goud <srinivas.goud@xilinx.com>
Fixed MISRA C-2012 Rule 10.6  below warning:
"misra_c_2012_rule_10_6_violation: Assigning expression
InstancePtr->Config.BaseAddress of width 32 to a target
of width 64."
Replaced u32 data type with UINTPTR.

misra_c_2012_rule_10_6_violation: Assigning composite expression
"(UsbEpNum << 1U) | Dir" of width 8 to a target of width 32.
Assign proper type cast to match assignement requirement.

Signed-off-by: Piyush Mehta <piyush.mehta@xilinx.com>

Acked-for-series: Srinivas Goud <srinivas.goud@xilinx.com>
updated changelog

Signed-off-by: Meena Paleti <meena.paleti@xilinx.com>

Acked-by : Siva Addepalli<saddepal@xilinx.com>
Updated the changelog

Signed-off-by: Meena Paleti <meena.paleti@xilinx.com>

Acked-by : Siva Addepalli<saddepal@xilinx.com>
Microblaze CPU support is being added into the dhrystone application
through this patch. For Microblaze Dhrystone to work, it is mandatory
that the design has an Axi Timer.

Signed-off-by: Anirudha Sarangi <anirudha.sarangi@xilinx.com>
Acked-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
…r libraries

Signed-off-by: Siva Addepalli <sivaprasad.addepalli@xilinx.com>
Signed-off-by: Martin Exner <martinexner@uint.io>
@bsvikram
Copy link

bsvikram commented Jul 7, 2021

@martinexner
It is a bug. Thanks for identifying. This will be fixed in 2021.2 release. Will review the patch and get back on it in sometime. Thank You.

@bsvikram
Copy link

@martinexner The logic for your patch is correct but I observed that there are too many changes. I fixed it with fewer changes( lines of code). I just assigned FsblInstancePtr->SecondaryBootDevice = SecBootMode; below line 1589 in xfsbl_initialization.c
Going forward, please mail to git@xilinx.com for any issues / bugs you find. We do not accept pull requests.
Thank You again for finding the bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants