NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
update.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2019, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA Corporation and its licensors retain all intellectual property and
5  * proprietary rights in and to this software and related documentation. Any
6  * use, reproduction, disclosure or distribution of this software and related
7  * documentation without an express license agreement from NVIDIA Corporation
8  * is strictly prohibited.
9  */
10 
11 #ifndef INCLUDED_LIBNVUPDATE_H
12 #define INCLUDED_LIBNVUPDATE_H
13 
14 /*
15  * Libnvupdate Version Information
16  * --------------------------------------------------------------------------------
17  * Revision Changes/Additions
18  *
19  * V2.4 Added new APIs NvGetOtaBootModeFlag() and NvSetOtaBootModeFlag().
20  *
21  * V2.3 Added new API NvGuestPtUpdate(). Marked NvGuestPtGphUpdate() as deprecated.
22  *
23  * V2.2 Added new API NvIsFirstLevelPtChanged()
24  *
25  * v2.1 Added new APIs NvGuestPtGphUpdate(), NvSetBootChainSelectionInfo(),
26  * NvGetBootChainSelectionInfo(), NvSetBootChain(), NvTriggerReboot()
27  * and NvGetPartSize().
28  *
29  */
30 
40 #include <stdio.h>
41 #include <nvcommon.h>
42 #include <device_id.h>
43 #include <partname.h>
44 
66 #define NV_LIBNVUPDATE_MAJOR_VERSION 2
67 #define NV_LIBNVUPDATE_MINOR_VERSION 3
68 
69 #define MAX_SYS_PART_LEN 100
70 
71 #define BOOT_CHAIN_TYPE_INTERFACE "/sys/kernel/debug/PMC/boot-chain-type"
72 
73 #define MARKER_CHAIN_A (0)
74 #define MARKER_CHAIN_B (1)
75 
76 #define READ_CHUNK_SIZE (1 * MB)
77 
78 #define BCH_HEADER_MAGIC "NVDA"
79 #define MAX_PARTITIONS 100
80 #define MAX_PART_STRING 1024
81 #define MAX_COMPONENT_COUNT 4
82 /* Ensure MAX_GUESTS specified below
83  * has the same value as GUEST_MAX_NR specified in
84  * qb-t18x-partner/include/asm-arm/proc-t186/system_map.h
85  */
86 #define MAX_GUESTS (16)
87 
88 typedef enum
89 {
92  BootChainType_Invalid = 0x7fffffff
94 
96 {
99 };
100 
102 {
104 };
105 
107 {
108  NvU32 GuestId;
111 };
112 
114 {
117 
120 
123 
126 
129 
131 
133 typedef void (*PUPDATE_RUNNING_TOTAL_FUNC)(NvU64);
135 typedef float (*PTOTAL_PERCENT_FUNC)(void);
136 
140 struct PIPE_DATA {
144  int pipefd;
145  NvBool bFlush;
146 };
147 
158 NvError NvQueryTegraChipId(NvU32 *pChipId);
159 
170 NvError NvSetSuppliedTegraChipId(NvU32 ChipId);
171 
172 
182 NvError NvSetSystemPart(QbDriver DeviceId, NvU32 DevInstance, NvS8 *SysPart);
183 
194 NvError NvGetPartitionUpdateProgress(QbDriver DeviceId, NvS32 *Percent);
195 
216  QbDriver DeviceId,
217  NvU32 DevInstance,
218  NvS8 *PartName,
219  NvS8 *PartPath,
220  struct PIPE_DATA *pPipeData);
221 
241  QbDriver DeviceId,
242  NvU32 DevInstance,
243  NvS8 *pMb1ImagePath,
244  NvS8 *pBrBctImagePath,
245  struct PIPE_DATA *pPipeData);
246 
268 NvError
270  QbDriver DeviceId,
271  NvU32 DevInstance,
272  NvS8 *pPtImagePath,
273  NvS8 *pBrBctImagePath,
274  struct PIPE_DATA *pPipeData);
275 
284 NvError NvShowPT(QbDriver DeviceId, NvU32 DevInstance);
285 
286 
302 NvError
304  QbDriver DeviceId,
305  NvU32 DevInstance,
306  NvS8 *pPartName,
307  NvU8 *pBuffer,
308  NvU64 BufferSize,
309  NvU64 Offset);
310 
322  QbDriver DeviceId,
323  NvU32 DevInstance,
324  NvS8 *pPartitionName,
325  struct PIPE_DATA *pPipeData);
326 
336 
347 
360  QbDriver DeviceId,
361  NvU32 DevInstance,
362  NvS8 *pPartName,
363  NvBool *pIsPartPresent);
364 
382  QbDriver DeviceId,
383  NvU32 DevInstance,
384  NvS8 *pPartitionName,
385  NvBool *pIsPartErased);
386 
406  QbDriver DeviceId,
407  NvU32 DevInstance,
408  NvS8 *pPartName,
409  NvS8 *pImagePath,
410  struct PIPE_DATA *pPipeData,
411  NvBool LogError
412  );
413 
427 NvError
429  QbDriver DeviceId,
430  NvU32 DevInstance,
431  NvU32 ActiveChainMarker,
432  NvS8 *pBrBctImagePath);
433 
443  QbDriver DeviceId,
444  NvU32 DevInstance,
445  NvS8 *pBrBctImagePath);
446 
456  QbDriver DeviceId,
457  NvU32 DevInstance,
458  BootChainSelectionInfo *pChainSelectionInfo);
459 
470 NvError
472  QbDriver DeviceId,
473  NvU32 DevInstance,
474  NvU32 *pActiveChainMarker);
475 
485 NvError
487  QbDriver DeviceId,
488  NvU32 DevInstance);
489 
499 NvError
501  QbDriver DeviceId,
502  NvU32 DevInstance,
503  NvS8 *pImagePath);
504 
520 NvError
522  QbDriver DeviceId,
523  NvU32 DevInstance,
524  struct UpdateGroup *pUpdateGrp,
525  NvU32 NumParts,
526  struct PIPE_DATA *pPipeData);
527 
547  QbDriver DeviceId,
548  NvU32 DevInstance,
549  NvU32 GuestId,
550  NvS8 *pGphPath,
551  NvS8 *pGuestPtPath);
552 
568  QbDriver DeviceId,
569  NvU32 DevInstance,
570  NvU32 GuestId,
571  NvS8 *pGuestPtPath);
572 
590 
601 
612  QbDriver DeviceId,
613  NvU32 DevInstance,
614  const char *pPartName,
615  NvU64 *pPartSize);
616 
624 NvError NvOverrideLogLevel(NvU32 LogLevel);
625 
639 NvError
641  QbDriver DeviceId,
642  NvU32 DevInstance,
643  const NvS8 *pPtImage,
644  NvBool *pIsFirstLevelPtChanged);
645 
655 NvError
657  QbDriver DeviceId,
658  NvU32 DevInstance,
659  NvBool *pOtaBootModeFlag);
660 
671 NvError
673  QbDriver DeviceId,
674  NvU32 DevInstance,
675  NvBool OtaBootModeFlag);
676 
679 #endif // INCLUDED_LIBNVUPDATE_H
NvError NvQueryTegraChipId(NvU32 *pChipId)
Queries the NVIDIA® Tegra® chip ID.
NvError NvReadBackVerify(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPartName, NvS8 *pImagePath, struct PIPE_DATA *pPipeData, NvBool LogError)
Ensures the partition was correctly written on the device.
QbDriver
Defines Quickboot device driver types.
Definition: device_id.h:34
NvError NvSetBootChain(BootChainType BootChainType)
Updates the scratch register SCRATCH_99 based on desired boot chain type.
NvError NvMb1PartitionUpdate(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pMb1ImagePath, NvS8 *pBrBctImagePath, struct PIPE_DATA *pPipeData)
Updates the primary and recovery MB1 partition, along with the BR BCT (Parker only).
NvS8 PtFileName[MAX_PART_STRING]
Definition: update.h:110
NvError NvIsFirstLevelPtChanged(QbDriver DeviceId, NvU32 DevInstance, const NvS8 *pPtImage, NvBool *pIsFirstLevelPtChanged)
Check if first level partition table on storage is different from input partition table...
PTOTAL_PERCENT_FUNC pSingle_Phase
Definition: update.h:143
PUPDATE_RUNNING_TOTAL_FUNC pUpdate_Func
Definition: update.h:141
NvU32 ForceABIImcompatibleBoot
When set forces to continue current boot chain despite being incompatible.
Definition: update.h:119
NvError NvUpdatePartitionLayout(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPtImagePath, NvS8 *pBrBctImagePath, struct PIPE_DATA *pPipeData)
Updates the BR BCT and PT to facilitate changing the whole partition layout.
NvError NvPostUpdateBrBctSanityCheck(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pImagePath)
Performs a post-update BR BCT sanity check.
BootChainType
Definition: update.h:88
PTOTAL_PERCENT_FUNC pTwo_Phase
Definition: update.h:142
NvError NvGuestPtGphUpdate(QbDriver DeviceId, NvU32 DevInstance, NvU32 GuestId, NvS8 *pGphPath, NvS8 *pGuestPtPath)
Updates the GPH and GPT partitions.
NvError NvGetPartSize(QbDriver DeviceId, NvU32 DevInstance, const char *pPartName, NvU64 *pPartSize)
Gets the partition size of the input partition.
NvError NvSetSystemPart(QbDriver DeviceId, NvU32 DevInstance, NvS8 *SysPart)
Sets the device-file-based boot device.
struct UpdateParts UpdatePart[MAX_COMPONENT_COUNT]
Definition: update.h:103
NvError NvSetBootChainSelectionInfo(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pBrBctImagePath)
Set boot chain selection information.
Holds data for a progress bar implementation that shows the level of completion of a partition update...
Definition: update.h:140
struct BootChainSelectionInfoRec BootChainSelectionInfo
NvError NvGuestPtUpdate(QbDriver DeviceId, NvU32 DevInstance, NvU32 GuestId, NvS8 *pGuestPtPath)
Updates the guest partition table for the specified guest.
NvError NvErasePartition(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPartitionName, struct PIPE_DATA *pPipeData)
Erases a specified partition.
NvError NvSetSuppliedTegraChipId(NvU32 ChipId)
Sets the Tegra chip ID.
NvError NvIsPartitionPresent(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPartName, NvBool *pIsPartPresent)
Checks for the presence of a partition in the partition table.
NvError NvTriggerBootChain(BootChainType BootChainType)
Updates the scratch register SCRATCH_99, based on desired boot-chain type.
NvError
The NvError enumeration contains ALL return / error codes.
Definition: nverror.h:36
int pipefd
Definition: update.h:144
NvError NvGetActiveMarker(QbDriver DeviceId, NvU32 DevInstance, NvU32 *pActiveChainMarker)
Gets the active chain marker value.
void(* PUPDATE_RUNNING_TOTAL_FUNC)(NvU64)
Defines one of two callbacks used to determine progress when updating the partition.
Definition: update.h:133
NvError NvGetOtaBootModeFlag(QbDriver DeviceId, NvU32 DevInstance, NvBool *pOtaBootModeFlag)
Query special OTA boot mode flag set in the BR BCT.
NvS8 GphFileName[MAX_PART_STRING]
Definition: update.h:109
NvS8 FileName[MAX_PART_STRING]
Definition: update.h:98
NvError NvTriggerReboot(void)
Triggers system reboot.
#define MAX_COMPONENT_COUNT
Definition: update.h:81
NvError NvPartitionUpdate(QbDriver DeviceId, NvU32 DevInstance, NvS8 *PartName, NvS8 *PartPath, struct PIPE_DATA *pPipeData)
Updates the specified partition with the specified image.
NvError NvReadPartition(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPartName, NvU8 *pBuffer, NvU64 BufferSize, NvU64 Offset)
Gets data from the specified partition.
NvError NvOverrideLogLevel(NvU32 LogLevel)
Overrides the default log level of messages printed to console.
NvU32 DisableSwitchBootChain
Specifies whether switching boot chain for recovery is disabled or not.
Definition: update.h:128
NvError NvSetOtaBootModeFlag(QbDriver DeviceId, NvU32 DevInstance, NvBool OtaBootModeFlag)
Enable/disable special OTA boot mode flag in the BR BCT as per input value.
NvError NvSetActiveMarker(QbDriver DeviceId, NvU32 DevInstance, NvU32 ActiveChainMarker, NvS8 *pBrBctImagePath)
Sets the active chain marker value, which specifies which chain to boot.
float(* PTOTAL_PERCENT_FUNC)(void)
Defines one of two callbacks used to determine progress when updating the partition.
Definition: update.h:135
NvU32 GPIOConfigBaseAddress
Specifies the GPIO pin/pad address to read and find out the desired boot chain.
Definition: update.h:125
NvU32 GPIOBootChainSelect
Holds the key to select between gpio boot chain select or active marker select.
Definition: update.h:116
NvError NvIsPartitionErased(QbDriver DeviceId, NvU32 DevInstance, NvS8 *pPartitionName, NvBool *pIsPartErased)
Determines whether the partition is erased.
NvError NvGroupPartitionUpdate(QbDriver DeviceId, NvU32 DevInstance, struct UpdateGroup *pUpdateGrp, NvU32 NumParts, struct PIPE_DATA *pPipeData)
Updates a group of partitions.
NvError NvDisplayBlVersion(QbDriver DeviceId, NvU32 DevInstance)
Displays the BL version (Parker only).
NvError NvGetBootChainSelectionInfo(QbDriver DeviceId, NvU32 DevInstance, BootChainSelectionInfo *pChainSelectionInfo)
Get boot chain selection information.
NVIDIA Quickboot Interface: Device Driver Types
#define MAX_PART_STRING
Definition: update.h:80
NvError NvQueryBootChainType(BootChainType *pBootType)
Queries the current boot-chain type that the system booted.
NvError NvGetPartitionUpdateProgress(QbDriver DeviceId, NvS32 *Percent)
Gets the progress of the partition update.
NvBool bFlush
Definition: update.h:145
NvS8 Name[MAX_PART_STRING]
Definition: update.h:97
NvU32 GPIOPadCtrlAddress
Specifies the GPIO pin/pad address to read and find out the desired boot chain.
Definition: update.h:122
NvError NvShowPT(QbDriver DeviceId, NvU32 DevInstance)
Displays the partition table stored on the boot device.