blob: 618624e88e7df5c373befff956754de39237fcf0 [file] [log] [blame]
Tejas Patel9d09ff92019-01-08 01:46:35 -08001/*
2 * Copyright (c) 2019, Xilinx, Inc. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7/*
8 * Versal system level PM-API functions and communication with PMC via
9 * IPI interrupts
10 */
11
12#include <pm_common.h>
13#include <pm_ipi.h>
14#include "pm_api_sys.h"
15#include "pm_client.h"
16
17/*********************************************************************
18 * Target module IDs macros
19 ********************************************************************/
20#define LIBPM_MODULE_ID 0x2
21#define LOADER_MODULE_ID 0x7
22
23/**
24 * Assigning of argument values into array elements.
25 */
26#define PM_PACK_PAYLOAD1(pl, mid, arg0) { \
27 pl[0] = (uint32_t)((uint32_t)((arg0) & 0xFF) | (mid << 8)); \
28}
29
30/* PM API functions */
31
32/**
33 * pm_get_api_version() - Get version number of PMC PM firmware
34 * @version Returns 32-bit version number of PMC Power Management Firmware
35 *
36 * @return Returns status, either success or error+reason
37 */
38enum pm_ret_status pm_get_api_version(unsigned int *version)
39{
40 uint32_t payload[PAYLOAD_ARG_CNT];
41
42 /* Send request to the PMC */
43 PM_PACK_PAYLOAD1(payload, LIBPM_MODULE_ID, PM_GET_API_VERSION);
44 return pm_ipi_send_sync(primary_proc, payload, version, 1);
45}