aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/soc/marvell/octeontx2-rm/otxrmcmd.h
blob: 0ae5b9cac613b31c8d08514cdac7b93528b0f3da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/* SPDX-License-Identifier: GPL-2.0
 * Marvell OcteonTx2 RVU Resource Manager driver
 *
 * Copyright (C) 2020 Marvell International Ltd.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef __OTXRMCMD_H__
#define __OTXRMCMD_H__

#include <linux/ioctl.h>

#define VERPACK(_mj, _mn, _rl) ((_mj) << 16 | (_mn) << 8 | (_rl))
#define VERMAJ(_v) ((_v) >> 16)
#define VERMIN(_v) (((_v) >> 8) & 0xFF)

#define OTXRM_VERSION VERPACK(1, 0, 0)
#define OTXRM_DRVNAME "/dev/otxrm"

/* MEM */
struct otx_mem {
	uint64_t pa; /* Phys.base address or offset from base address */
	uint16_t nbytes; /* Number of bytes to read */
	uint8_t *buf; /* Buffer address for return memory values */
} __packed;

/* MEMV */
struct otx_memv {
	uint64_t pbase; /* Base physical address */
	uint16_t msize; /* Array of mem size */
	struct otx_mem *mm; /* Array of mem */
} __packed;

/* OTXRM IOCTL commands/messages */
#define IOC_TYPE	110

#define IOC_MEMREAD     _IOWR(IOC_TYPE, 1, struct otx_mem *)
#define IOC_MEMREADV    _IOWR(IOC_TYPE, 2, struct otx_memv *)

#endif /* __OTXRMCMD_H__ */