NVIDIA DRIVE OS Linux API Reference

5.1.0.2 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 
109 NvError QbLoadAndInitPartMgr(void);
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 
269 #ifdef CONFIG_OS_LOADER
270 
275 NvError QbUpdateGuestPartInfo(void);
276 
280 NvError QbUpdateGuestPartTableWithSysInfo(void);
281 
282 #endif
283 
293 NvError
294 QbPartMgrCreateTableStart(NvU32 NumPartitions);
295 
301 NvError
303 
326 NvError
328  NvU32 PartId,
329  char *pPartName,
330  char *pGuestPartName,
331  QbPartInfo PartInfo,
332  QbAllocPartArgs PartArgs);
333 
352 NvError
354  QbDriver DeviceId,
355  NvU32 DevInstance,
356  NvBool SignTable,
357  NvBool EncryptTable,
358  NvS8 *FileName);
359 
369 NvError
371  const char *PartitionName,
372  NvU32 *PartitionId);
373 
383 NvError
385  QbPartitionType PartitionType,
386  NvU32 *PartitionId);
387 
398 NvError
400  NvU32 PartitionId,
401  char *PartitionName);
402 
413 NvError
415  NvU32 PartitionId,
416  char *PartitionName,
417  QbPartitionTable QbPartTable);
418 
435 NvError
437  NvU32 PartitionId,
438  NvU32 *BootCompHdrPartId);
439 
451 NvError
453  NvU32 PartitionId,
454  QbPartInfo *pPartInfo);
455 
468 NvError
470  NvU32 PartitionId,
471  QbPartInfo *pPartInfo,
472  QbPartitionTable QbPartTable);
473 
492 NvU32
494  NvU32 PartitionId);
495 
515 NvU32
517  NvU32 PartitionId, QbPartitionTable QbPartTable);
518 
542 NvU32
544  NvU32 DeviceId,
545  NvU32 DeviceInstance,
546  NvU32 PartitionId);
547 
564 NvError
566  NvU32 DeviceId,
567  NvU32 DeviceInstance,
568  NvU32 *NextDeviceId,
569  NvU32 *NextDeviceInstance);
570 
578 NvU32
580 
581 #ifdef CONFIG_HYPERVISOR_SUPPORT
582 
596 NvError QbQueryAssignedPartitions(
597  NvU32 GuestId,
598  NvU32 Level,
599  QbPartitionChainType ChainType,
600  QbPartitionTableEntry *pPtEntries,
601  NvU32 NumPtEntries,
602  NvU32 *pNumFilledEntries);
603 
610 void QbInitGuestAssignmentTable(void);
611 
618 NvU32 QbGetStorageServerId(void);
619 
626 NvU32 QbGetUpdateServerId(void);
627 
634 NvU32 QbGetMaxGuestId(void);
635 
642 NvU32 QbGetNumAssignedPartitions(NvU32 GuestId);
643 
644 #endif
645 
653 NvError QbPartMgrShowPT(void);
654 
665 NvError
667  QbDriver DriverType,
668  NvU32 Instance,
669  NvU64 Offset,
670  NvU32 *PartitionId);
671 
672 #ifndef QB_BL_BUILD
673 
681 NvError NvLoadPtFromFile(NvS8 *pPtImagePath);
682 
692 NvError NvLoadPtFromFileToBuffer(NvS8 *pPtImagePath,
693  NvBool IsSigned, QbPartitionTable **ppQbPartTable);
694 
695 #else
696 
704 NvError QbPartMgrQueryUpdateInfo(DtUpdateInfo *pDtUpdateInfo);
705 
706 #endif
707 
708 #endif /* #ifndef INCLUDED_QBPARTMGR_H */
709 
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 QbPartMgrLoadTable(QbDriver DeviceId, NvU32 DeviceInstance, NvU64 StartLogicalByte, NvU64 NumLogicalBytes, NvBool IsSigned, NvBool IsEncrypted)
Reads the Partition Table from specified storage device.
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 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.