NVIDIA DRIVE OS Linux API Reference

5.1.3.0 Release

 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
qbpartmgr.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010-2018, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 
66 #ifndef INCLUDED_QBPARTMGR_H
67 #define INCLUDED_QBPARTMGR_H
68 
69 #include <nvcommon.h>
70 #include <partition.h>
71 #include <device_id.h>
72 #include <kernel_dt_service.h>
73 
74 #define MAX_PARTITIONS_INDEX 41
75 #define MAX_NUM_PARTITIONS (MAX_PARTITIONS_INDEX - 1)
76 #define GPT_SIZE_IN_SECTORS 33
77 #define GUEST_BOOT_PARTITION_FLAG 0x80000000
78 
79 #define PT_LEVEL_1 (1)
80 #define PT_LEVEL_2 (2)
81 
82 typedef struct QbAllocPartArgsRec
83 {
85  NvU64 Size;
90  NvU64 DeviceSize;
91  NvPartMgrAllocPolicyType AllocationType;
92  NvU32 Index;
94  QbPartitionType PartitionType;
96 
110 
119 NvBool QbQueryThreeLevelPtInfo(void);
120 
126 NvError
127 QbPartMgrInit(void);
128 
132 void
133 QbPartMgrDeinit(void);
134 
157 NvError
159  QbDriver DeviceId,
160  NvU32 DeviceInstance,
161  NvU64 StartLogicalByte,
162  NvU64 NumLogicalBytes,
163  NvBool IsSigned,
164  NvBool IsEncrypted);
165 
166 /*
167  * Query prefix used for specified boot chain and prepend it to the partition name.
168  *
169  * @param pPartName Buffer holding partition name, also gets updated with the prefix.
170  * @param Size size of the buffer.
171  * @param IsActiveChain Boolean flag telling whether to prepend prefix for active or inactive chain.
172  *
173  * @return NvSuccess if the partition table load was successful, or an appropriate error code.
174  */
175 NvError
177  NvS8 *pPartName,
178  NvU32 Size,
179  NvBool IsActiveChain);
180 
181 /*
182  * Query partition name from partition type based on the boot chain type.
183  *
184  * @param PartType QbPartitionType for which partition name is to be queried.
185  * @param IsActiveChain Boolean flag telling partition name required for active or inactive chain.
186  * @param pPartName Buffer holding partition name, also gets updated with the boot chain prefix.
187  * @param PartNameBufferSize size of the buffer.
188  *
189  * @return NvSuccess if the partition name is successfully populated, or an appropriate error code.
190  */
191 
192 NvError
194  QbPartitionType PartType,
195  NvBool IsActiveChain,
196  NvS8 *pPartName,
197  NvS32 PartNameBufferSize);
198 
209 NvError QbPartMgrQueryIvcChannelInfo(NvU32 PartId, NvU32 *pIvc);
210 
220 NvError
222  QbDriver DeviceId,
223  NvU32 DeviceInstance);
224 
250 NvError
252  QbDriver DeviceId,
253  NvU32 DeviceInstance);
254 
267 void QbPartMgrLoadAllGuestPt(void);
268 
275 
280 
290 NvError
291 QbPartMgrCreateTableStart(NvU32 NumPartitions);
292 
298 NvError
300 
323 NvError
325  NvU32 PartId,
326  char *pPartName,
327  char *pGuestPartName,
328  QbPartInfo PartInfo,
329  QbAllocPartArgs PartArgs);
330 
349 NvError
351  QbDriver DeviceId,
352  NvU32 DevInstance,
353  NvBool SignTable,
354  NvBool EncryptTable,
355  NvS8 *FileName);
356 
366 NvError
368  const char *PartitionName,
369  NvU32 *PartitionId);
370 
380 NvError
382  QbPartitionType PartitionType,
383  NvU32 *PartitionId);
384 
395 NvError
397  NvU32 PartitionId,
398  char *PartitionName);
399 
410 NvError
412  NvU32 PartitionId,
413  char *PartitionName,
414  QbPartitionTable QbPartTable);
415 
432 NvError
434  NvU32 PartitionId,
435  NvU32 *BootCompHdrPartId);
436 
448 NvError
450  NvU32 PartitionId,
451  QbPartInfo *pPartInfo);
452 
465 NvError
467  NvU32 PartitionId,
468  QbPartInfo *pPartInfo,
469  QbPartitionTable QbPartTable);
470 
489 NvU32
491  NvU32 PartitionId);
492 
512 NvU32
514  NvU32 PartitionId, QbPartitionTable QbPartTable);
515 
539 NvU32
541  NvU32 DeviceId,
542  NvU32 DeviceInstance,
543  NvU32 PartitionId);
544 
561 NvError
563  NvU32 DeviceId,
564  NvU32 DeviceInstance,
565  NvU32 *NextDeviceId,
566  NvU32 *NextDeviceInstance);
567 
575 NvU32
577 
578 #ifdef CONFIG_HYPERVISOR_SUPPORT
579 
593 NvError QbQueryAssignedPartitions(
594  NvU32 GuestId,
595  NvU32 Level,
596  QbPartitionChainType ChainType,
597  QbPartitionTableEntry *pPtEntries,
598  NvU32 NumPtEntries,
599  NvU32 *pNumFilledEntries);
600 
607 void QbInitGuestAssignmentTable(void);
608 
615 NvU32 QbGetStorageServerId(void);
616 
623 NvU32 QbGetUpdateServerId(void);
624 
631 NvU32 QbGetMaxGuestId(void);
632 
640 NvError QbQueryActiveBcbInfo(QbBcbInfo *pBcbInfo, NvU32 Size, NvU32 *pNumEntries);
641 
649 NvError QbQueryLastPartInfo(
650  QbDriver InputDeviceId,
651  NvU32 InputDevInstance,
652  QbPartInfo *pPartInfo);
653 
661 NvError QbQueryGlobalDevList(
662  QbPartMgrDeviceList *pDevList,
663  NvU32 BuffSize,
664  NvU32 *pNumEntries);
665 
672 NvU32 QbGetNumAssignedPartitions(NvU32 GuestId);
673 
674 #endif
675 
684 
695 NvError
697  QbDriver DriverType,
698  NvU32 Instance,
699  NvU64 Offset,
700  NvU32 *PartitionId);
701 
702 #ifndef QB_BL_BUILD
703 
711 NvError NvLoadPtFromFile(NvS8 *pPtImagePath);
712 
722 NvError NvLoadPtFromFileToBuffer(NvS8 *pPtImagePath,
723  NvBool IsSigned, QbPartitionTable **ppQbPartTable);
724 
725 #endif
726 
727 #endif /* #ifndef INCLUDED_QBPARTMGR_H */
728 
NvError NvLoadPtFromFile(NvS8 *pPtImagePath)
Loads partition table from specified file.
NvError QbPartMgrAddTableEntry(NvU32 PartId, char *pPartName, char *pGuestPartName, QbPartInfo PartInfo, QbAllocPartArgs PartArgs)
Adds an entry to the Partition Table.
QbDriver
Defines Quickboot device driver types.
Definition: device_id.h:34
NvError QbPartMgrCreateTableStart(NvU32 NumPartitions)
Allocates memory for partition table and fills the default PT header.
NvError QbPartMgrGetIdByName(const char *PartitionName, NvU32 *PartitionId)
Returns the partition ID for the named partition.
void QbPartMgrDeinit(void)
Shuts down the partition manager.
NvU32 QbPartMgrGetNextIdForDeviceInstance(NvU32 DeviceId, NvU32 DeviceInstance, NvU32 PartitionId)
Iterates over partition IDs in the Partition Table, where only certain IDs are considered.
NvError QbPartMgrLoadAllPt(QbDriver DeviceId, NvU32 DeviceInstance)
This API is used by update library to load partition table.
NvU64 StartLogicalAddress
Definition: qbpartmgr.h:86
NVIDIA Quickboot Interface: Kernel Device Tree Service
NvError QbPartMgrGetNameByIdFromBuffer(NvU32 PartitionId, char *PartitionName, QbPartitionTable QbPartTable)
Returns the name of the specified partition ID for the input PT buffer.
NvError QbPartMgrSaveTable(QbDriver DeviceId, NvU32 DevInstance, NvBool SignTable, NvBool EncryptTable, NvS8 *FileName)
Writes the Partition Table to the storage device.
NvError QbPrependBootChainPrefix(NvS8 *pPartName, NvU32 Size, NvBool IsActiveChain)
NvError QbUpdateGuestPartInfo(void)
Updates the guest-related partition information in the Partition Table.
NvError QbPartMgrLoadTable(QbDriver DeviceId, NvU32 DeviceInstance, NvU64 StartLogicalByte, NvU64 NumLogicalBytes, NvBool IsSigned, NvBool IsEncrypted)
Reads the Partition Table from specified storage device.
NvError QbUpdateGuestPartTableWithSysInfo(void)
Updates the PT with information in SysInfo.
NvU32 AllocationAttribute
Definition: qbpartmgr.h:93
NvError NvLoadPtFromFileToBuffer(NvS8 *pPtImagePath, NvBool IsSigned, QbPartitionTable **ppQbPartTable)
Loads partition table from specified file to a PT buffer provided back to caller. ...
NvU32 QbPartMgrGetNextId(NvU32 PartitionId)
Iterates over the partition IDs in the Partition Table.
NvError QbLoadAndInitPartMgr(void)
Loads and initializes partitions.
NvU64 EndPhysicalAddress
Definition: qbpartmgr.h:89
NvError
The NvError enumeration contains ALL return / error codes.
Definition: nverror.h:36
NvError QbPartMgrInit(void)
Initializes the partition manager.
NvError QbPartMgrCreateTableFinish(void)
Returns with a success indication if a Partition Table has been created.
NvError QbPartMgrGetNameById(NvU32 PartitionId, char *PartitionName)
Returns the name of the specified partition ID.
NvError QbGetPartNameFromType(QbPartitionType PartType, NvBool IsActiveChain, NvS8 *pPartName, NvS32 PartNameBufferSize)
NvError QbPartMgrShowPT(void)
Prints the partition table.
NvError QbPartMgrGetPartInfoFromBuffer(NvU32 PartitionId, QbPartInfo *pPartInfo, QbPartitionTable QbPartTable)
Gets information about the location, size, and other attributes for the specified partition for the i...
NvBool QbQueryThreeLevelPtInfo(void)
Query information about 3-level PT.
NvU64 StartPhysicalAddress
Definition: qbpartmgr.h:88
NvU32 QbPartMgrGetNextIdFromBuffer(NvU32 PartitionId, QbPartitionTable QbPartTable)
Iterates over the partition IDs in the input PT buffer.
NvError QbPartMgrGetIdByType(QbPartitionType PartitionType, NvU32 *PartitionId)
Returns the partition ID for the partition type.
NvError QbPartMgrLoadSecondLevelPt(QbDriver DeviceId, NvU32 DeviceInstance)
This API is used by the update library for loading second level PT.
NvU32 QbPartMgrGetNumPartition(void)
Gets the number of the partition.
void QbPartMgrLoadAllGuestPt(void)
Iterates over the global PT for guest blobs found.
NvError QbPartMgrQueryIvcChannelInfo(NvU32 PartId, NvU32 *pIvc)
This API is used by update library to query IVC channel info for a partition specified by partition i...
QbPartitionType PartitionType
Definition: qbpartmgr.h:94
struct QbAllocPartArgsRec QbAllocPartArgs
NVIDIA Quickboot Interface: Device Driver Types
NvError QbPartMgrGetNextDeviceInstance(NvU32 DeviceId, NvU32 DeviceInstance, NvU32 *NextDeviceId, NvU32 *NextDeviceInstance)
Finds the next device ID and device Instance in the PT relative to the given device ID and device Ins...
NvError QbDeviceGetPartitionIdByOffset(QbDriver DriverType, NvU32 Instance, NvU64 Offset, NvU32 *PartitionId)
Finds the partition in which the given offset lies.
NvU64 NumLogicalBytes
Definition: qbpartmgr.h:87
NvError QbPartMgrGetPartInfo(NvU32 PartitionId, QbPartInfo *pPartInfo)
Gets information about the location, size, and other attributes for the specified partition...
NvPartMgrAllocPolicyType AllocationType
Definition: qbpartmgr.h:91
NvError QbPartMgrGetBootCompHdrPartId(NvU32 PartitionId, NvU32 *BootCompHdrPartId)
Returns the Partition ID of the partition that has the BCH for the given partition.