1 /*
2 * Copyright (c) 2021 The Linux Foundation. All rights reserved.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for
5 * any purpose with or without fee is hereby granted, provided that the
6 * above copyright notice and this permission notice appear in all
7 * copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 * PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 /**
20 * DOC: qal_devnode
21 * QCA driver framework for device node related APIs prototype
22 */
23
24 #ifndef __QAL_DEVNODE_H
25 #define __QAL_DEVNODE_H
26
27 /* Include Files */
28 #include "qdf_types.h"
29 #include "qdf_trace.h"
30 #include "i_qal_devnode.h"
31
32 #define PCI_DOMAIN_ID_MIN 0x0000
33 #define PCI_DOMAIN_ID_MAX 0xFFFF
34
35 typedef __qdf_devnode_t qdf_devnode_t;
36
37 #ifdef ENHANCED_OS_ABSTRACTION
38
39 /**
40 * qal_devnode_read_u32_array() - Find and read an array of 32 bit integers
41 * from a property.
42 * @devnode: device node from which the property value is to be read.
43 * @pname: name of the property to be searched.
44 * @u32_val: pointer to return value, modified only if return value is 0.
45 * @elem: number of array elements to read
46 *
47 * Return: QDF_STATUS_SUCCESS on success, error code
48 */
49 QDF_STATUS
50 qal_devnode_read_u32_array(const qdf_devnode_t devnode,
51 const char *pname, uint32_t *u32_val, size_t elem);
52 /**
53 * qal_devnode_read_u32() - Find and read 32 bit integer from a property.
54 * @devnode: device node from which the property value is to be read.
55 * @pname: name of the property to be searched.
56 * @u32_val: pointer to return value, modified only if return value is 0.
57 *
58 * Return: QDF_STATUS_SUCCESS on success, error code
59 */
60 QDF_STATUS
61 qal_devnode_read_u32(const qdf_devnode_t devnode,
62 const char *pname, uint32_t *u32_val);
63 #else
64
65 static inline QDF_STATUS
qal_devnode_read_u32_array(const qdf_devnode_t devnode,const char * pname,uint32_t * u32_val,size_t elem)66 qal_devnode_read_u32_array(const qdf_devnode_t devnode,
67 const char *pname, uint32_t *u32_val, size_t elem)
68 {
69 return __qal_devnode_read_u32_array(devnode, pname, u32_val, elem);
70 }
71
72 static inline QDF_STATUS
qal_devnode_read_u32(const qdf_devnode_t devnode,const char * pname,uint32_t * u32_val)73 qal_devnode_read_u32(const qdf_devnode_t devnode,
74 const char *pname, uint32_t *u32_val)
75 {
76 return __qal_devnode_read_u32(devnode, pname, u32_val);
77 }
78 #endif
79
80 #endif /* __QAL_DEVNODE_H */
81