NVIDIA DriveOS Linux NSR SDK API Reference

7.0.3.0 Release
pctlib.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2019, 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 
11 #ifndef INCLUDE_PCTLIB_H
12 #define INCLUDE_PCTLIB_H
13 
14 #include <stdint.h>
15 #include <stdbool.h>
16 #include <pct.h>
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif //__cplusplus
21 
22 // initializes pctlib
23 bool pct_initialize(void);
24 
25 // returns pointer to the calculated end of PCT structure.
26 uintptr_t pct_get_end_struct(void);
27 
28 // returns platform configuration pointer
29 const struct platform_conf *pct_platform_get_conf(void);
30 
31 // returns guest configuration pointer for specified guest
32 const struct guest_conf *pct_guest_get_conf(uint32_t guest_id);
33 
34 // returns ipa configuration pointer for specified ipa index
35 const struct ipa_mapping *pct_ipa_get_mapping(uint32_t ipa_index);
36 
37 // returns gpio configuration pointer for specified gpio index
38 const struct guest_gpio_mapping *pct_gpio_get_mapping(uint32_t gpio_index);
39 
40 // returns mempool configuration pointer for specified mempool index
41 const struct pct_mempool *pct_ivc_get_mempool_conf(uint32_t mempool_id);
42 
43 // returns ivc queue configuration pointer for specified queue index
44 const struct pct_ivc_queue *pct_ivc_get_queue_conf(uint32_t queue_id);
45 
46 // returns vcpu configuration pointer for specified vcpu index
47 const struct vcpu_conf *pct_get_vcpu_conf(uint32_t vcpu);
48 
49 // returns io mapping configuration pointer for specified mapping index
50 const struct guest_io_mapping *pct_io_get_mapping(int32_t periph_id);
51 
52 // returns io owners information for specified io index
53 // owned_by_hyp may be NULL if not needed to be returned
54 void pct_io_get_owners(int32_t periph_id, uint32_t *owner_guest_id,
55  bool *owned_by_hyp);
56 
57 // returns true if guest_id ownes io mapping information.
58 // returnds false otherwise.
59 bool pct_io_mapping_belongs_to_guest(const struct guest_io_mapping *mapping,
60  uint32_t guest_id);
61 
62 // returns true if guest_id ownes io index
63 // returnds false otherwise.
64 bool pct_io_belongs_to_guest(int32_t periph_id, uint32_t guest_id);
65 
66 // returns true if hypervisor ownes io index
67 // returnds false otherwise.
68 bool pct_io_belongs_to_hypervisor(int32_t periph_id);
69 
70 // returns gpio owner information for specified gpio index
71 // owned_by_hyp may be NULL if not needed to be returned
72 bool pct_gpio_mapping_belongs_to_guest(const struct guest_gpio_mapping *mapping,
73  uint32_t guest_id);
74 
75 // returns true if a guest ownes gpio mapping information. returns its id too.
76 // returnds false otherwise.
77 bool pct_gpio_mapping_to_owning_guest(const struct guest_gpio_mapping *mapping,
78  uint32_t *ret_guest_id);
79 
80 // returns true if guest_id ownes ipa index
81 // returnds false otherwise.
82 bool pct_ipa_belongs_to_guest(uint32_t ipa_index, uint32_t guest_id);
83 
84 // returns true if hypervisor ownes ipa index
85 // returnds false otherwise.
86 bool pct_ipa_belongs_to_hyp(uint32_t ipa_index);
87 
88 // returns true if a guest ownes i2c slave. returns its id too.
89 // returnds false otherwise.
90 bool pct_i2c_slave_to_owning_guest(uint32_t controller, uint32_t slave_addr,
91  uint32_t *ret_guest_id);
92 
93 // validates specified guest id
94 bool pct_is_valid_hyp_guest_nr(uint32_t guest_id);
95 
96 extern void pct_hsp_assign(void); // FIXME: create pct_hsp.h and more it there
97 extern void pct_se_init(void); // FIXME: create pct_se.h and more it there
98 extern void pct_bpmp_init(void); // FIXME: create pct_bpmp.h and more it there
99 
100 extern uintptr_t pct_get_start(void);
101 extern uintptr_t pct_get_end(void);
102 
103 #ifdef __cplusplus
104 }
105 #endif //__cplusplus
106 
107 #endif // INCLUDE_PCTLIB_H
pct_get_end
uintptr_t pct_get_end(void)
pct_io_belongs_to_hypervisor
bool pct_io_belongs_to_hypervisor(int32_t periph_id)
pct_initialize
bool pct_initialize(void)
pct_platform_get_conf
const struct platform_conf * pct_platform_get_conf(void)
pct_i2c_slave_to_owning_guest
bool pct_i2c_slave_to_owning_guest(uint32_t controller, uint32_t slave_addr, uint32_t *ret_guest_id)
pct_gpio_get_mapping
const struct guest_gpio_mapping * pct_gpio_get_mapping(uint32_t gpio_index)
pct_bpmp_init
void pct_bpmp_init(void)
pct_gpio_mapping_belongs_to_guest
bool pct_gpio_mapping_belongs_to_guest(const struct guest_gpio_mapping *mapping, uint32_t guest_id)
pct_se_init
void pct_se_init(void)
pct_ivc_get_mempool_conf
const struct pct_mempool * pct_ivc_get_mempool_conf(uint32_t mempool_id)
pct_is_valid_hyp_guest_nr
bool pct_is_valid_hyp_guest_nr(uint32_t guest_id)
pct_get_start
uintptr_t pct_get_start(void)
pct_ivc_get_queue_conf
const struct pct_ivc_queue * pct_ivc_get_queue_conf(uint32_t queue_id)
pct_get_end_struct
uintptr_t pct_get_end_struct(void)
pct_get_vcpu_conf
const struct vcpu_conf * pct_get_vcpu_conf(uint32_t vcpu)
pct_ipa_get_mapping
const struct ipa_mapping * pct_ipa_get_mapping(uint32_t ipa_index)
pct_gpio_mapping_to_owning_guest
bool pct_gpio_mapping_to_owning_guest(const struct guest_gpio_mapping *mapping, uint32_t *ret_guest_id)
pct_io_mapping_belongs_to_guest
bool pct_io_mapping_belongs_to_guest(const struct guest_io_mapping *mapping, uint32_t guest_id)
pct_ipa_belongs_to_hyp
bool pct_ipa_belongs_to_hyp(uint32_t ipa_index)
pct_io_belongs_to_guest
bool pct_io_belongs_to_guest(int32_t periph_id, uint32_t guest_id)
pct_guest_get_conf
const struct guest_conf * pct_guest_get_conf(uint32_t guest_id)
pct_io_get_mapping
const struct guest_io_mapping * pct_io_get_mapping(int32_t periph_id)
pct_hsp_assign
void pct_hsp_assign(void)
pct_io_get_owners
void pct_io_get_owners(int32_t periph_id, uint32_t *owner_guest_id, bool *owned_by_hyp)
pct_ipa_belongs_to_guest
bool pct_ipa_belongs_to_guest(uint32_t ipa_index, uint32_t guest_id)