165c80d60SJolly Shah /* 2619bc13eSMichal Simek * Copyright (c) 2013-2020, Arm Limited and Contributors. All rights reserved. 328ba1400SRajan Vaja * Copyright (c) 2019-2022, Xilinx, Inc. All rights reserved. 472eb16b7SDevanshi Chauhan Alpeshbhai * Copyright (c) 2022-2025, Advanced Micro Devices, Inc. All rights reserved. 565c80d60SJolly Shah * 665c80d60SJolly Shah * SPDX-License-Identifier: BSD-3-Clause 765c80d60SJolly Shah */ 865c80d60SJolly Shah 965c80d60SJolly Shah 1065c80d60SJolly Shah #include <arch_helpers.h> 11*4fd510e0SRonak Jain #include <common/debug.h> 1265c80d60SJolly Shah #include <lib/bakery_lock.h> 1365c80d60SJolly Shah #include <lib/mmio.h> 140b3a2cf0SJay Buddhabhatti #include <lib/spinlock.h> 1501a326abSPrasad Kummari #include <plat/common/platform.h> 1601a326abSPrasad Kummari 1765c80d60SJolly Shah #include <ipi.h> 1865c80d60SJolly Shah #include <plat_ipi.h> 1965c80d60SJolly Shah #include <plat_private.h> 2028ba1400SRajan Vaja #include "pm_defs.h" 2165c80d60SJolly Shah #include "pm_ipi.h" 2265c80d60SJolly Shah 2315dc3e4fSHariBabu Gattem #define ERROR_CODE_MASK (0xFFFFU) 24590519a8SHariBabu Gattem #define PM_OFFSET (0U) 25addc4e96SRavi Patel 260b3a2cf0SJay Buddhabhatti /* 270b3a2cf0SJay Buddhabhatti * ARM v8.2, the cache will turn off automatically when cpu 280b3a2cf0SJay Buddhabhatti * power down. Therefore, there is no doubt to use the spin_lock here. 290b3a2cf0SJay Buddhabhatti */ 300b3a2cf0SJay Buddhabhatti #if !HW_ASSISTED_COHERENCY 314b4080d7SDevanshi Chauhan Alpeshbhai static DEFINE_BAKERY_LOCK(pm_secure_lock); 320b3a2cf0SJay Buddhabhatti static inline void pm_ipi_lock_get(void) 330b3a2cf0SJay Buddhabhatti { 340b3a2cf0SJay Buddhabhatti bakery_lock_get(&pm_secure_lock); 350b3a2cf0SJay Buddhabhatti } 360b3a2cf0SJay Buddhabhatti 370b3a2cf0SJay Buddhabhatti static inline void pm_ipi_lock_release(void) 380b3a2cf0SJay Buddhabhatti { 390b3a2cf0SJay Buddhabhatti bakery_lock_release(&pm_secure_lock); 400b3a2cf0SJay Buddhabhatti } 410b3a2cf0SJay Buddhabhatti #else 420b3a2cf0SJay Buddhabhatti spinlock_t pm_secure_lock; 430b3a2cf0SJay Buddhabhatti static inline void pm_ipi_lock_get(void) 440b3a2cf0SJay Buddhabhatti { 450b3a2cf0SJay Buddhabhatti spin_lock(&pm_secure_lock); 460b3a2cf0SJay Buddhabhatti } 470b3a2cf0SJay Buddhabhatti 480b3a2cf0SJay Buddhabhatti static inline void pm_ipi_lock_release(void) 490b3a2cf0SJay Buddhabhatti { 500b3a2cf0SJay Buddhabhatti spin_unlock(&pm_secure_lock); 510b3a2cf0SJay Buddhabhatti } 520b3a2cf0SJay Buddhabhatti #endif 5365c80d60SJolly Shah 5465c80d60SJolly Shah /** 5565c80d60SJolly Shah * pm_ipi_init() - Initialize IPI peripheral for communication with 56de7ed953SPrasad Kummari * remote processor. 57de7ed953SPrasad Kummari * @proc: Pointer to the processor who is initiating request. 5865c80d60SJolly Shah * 59de7ed953SPrasad Kummari * Return: On success, the initialization function must return 0. 6065c80d60SJolly Shah * Any other return value will cause the framework to ignore 61de7ed953SPrasad Kummari * the service. 6265c80d60SJolly Shah * 63de7ed953SPrasad Kummari * Called from pm_setup initialization function. 6465c80d60SJolly Shah */ 65590519a8SHariBabu Gattem void pm_ipi_init(const struct pm_proc *proc) 6665c80d60SJolly Shah { 6765c80d60SJolly Shah ipi_mb_open(proc->ipi->local_ipi_id, proc->ipi->remote_ipi_id); 6865c80d60SJolly Shah } 6965c80d60SJolly Shah 7065c80d60SJolly Shah /** 71de7ed953SPrasad Kummari * pm_ipi_send_common() - Sends IPI request to the remote processor. 72de7ed953SPrasad Kummari * @proc: Pointer to the processor who is initiating request. 73de7ed953SPrasad Kummari * @payload: API id and call arguments to be written in IPI buffer. 74de7ed953SPrasad Kummari * @is_blocking: if to trigger the notification in blocking mode or not. 7565c80d60SJolly Shah * 7665c80d60SJolly Shah * Send an IPI request to the power controller. Caller needs to hold 7765c80d60SJolly Shah * the 'pm_secure_lock' lock. 7865c80d60SJolly Shah * 79de7ed953SPrasad Kummari * Return: Returns status, either success or error+reason. 80de7ed953SPrasad Kummari * 8165c80d60SJolly Shah */ 8265c80d60SJolly Shah static enum pm_ret_status pm_ipi_send_common(const struct pm_proc *proc, 8365c80d60SJolly Shah uint32_t payload[PAYLOAD_ARG_CNT], 8465c80d60SJolly Shah uint32_t is_blocking) 8565c80d60SJolly Shah { 86590519a8SHariBabu Gattem uint32_t offset = PM_OFFSET; 8765c80d60SJolly Shah uintptr_t buffer_base = proc->ipi->buffer_base + 8865c80d60SJolly Shah IPI_BUFFER_TARGET_REMOTE_OFFSET + 8965c80d60SJolly Shah IPI_BUFFER_REQ_OFFSET; 90d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK 91fe550edeSVenkatesh Yadav Abbarapu payload[PAYLOAD_CRC_POS] = calculate_crc(payload, IPI_W0_TO_W6_SIZE); 92fe550edeSVenkatesh Yadav Abbarapu #endif 9365c80d60SJolly Shah 9465c80d60SJolly Shah /* Write payload into IPI buffer */ 9565c80d60SJolly Shah for (size_t i = 0; i < PAYLOAD_ARG_CNT; i++) { 9665c80d60SJolly Shah mmio_write_32(buffer_base + offset, payload[i]); 9765c80d60SJolly Shah offset += PAYLOAD_ARG_SIZE; 9865c80d60SJolly Shah } 9965c80d60SJolly Shah 10065c80d60SJolly Shah /* Generate IPI to remote processor */ 10162f9134dSVenkatesh Yadav Abbarapu ipi_mb_notify(proc->ipi->local_ipi_id, proc->ipi->remote_ipi_id, 10265c80d60SJolly Shah is_blocking); 10365c80d60SJolly Shah 10462f9134dSVenkatesh Yadav Abbarapu return PM_RET_SUCCESS; 1054d9b9b23STejas Patel } 1064d9b9b23STejas Patel 10765c80d60SJolly Shah /** 10865c80d60SJolly Shah * pm_ipi_send_non_blocking() - Sends IPI request to the remote processor 109de7ed953SPrasad Kummari * without blocking notification. 110de7ed953SPrasad Kummari * @proc: Pointer to the processor who is initiating request. 111de7ed953SPrasad Kummari * @payload: API id and call arguments to be written in IPI buffer. 11265c80d60SJolly Shah * 11365c80d60SJolly Shah * Send an IPI request to the power controller. 11465c80d60SJolly Shah * 115de7ed953SPrasad Kummari * Return: Returns status, either success or error+reason. 116de7ed953SPrasad Kummari * 11765c80d60SJolly Shah */ 11865c80d60SJolly Shah enum pm_ret_status pm_ipi_send_non_blocking(const struct pm_proc *proc, 11965c80d60SJolly Shah uint32_t payload[PAYLOAD_ARG_CNT]) 12065c80d60SJolly Shah { 12165c80d60SJolly Shah enum pm_ret_status ret; 12265c80d60SJolly Shah 1230b3a2cf0SJay Buddhabhatti pm_ipi_lock_get(); 12465c80d60SJolly Shah 12565c80d60SJolly Shah ret = pm_ipi_send_common(proc, payload, IPI_NON_BLOCKING); 12665c80d60SJolly Shah 1270b3a2cf0SJay Buddhabhatti pm_ipi_lock_release(); 12865c80d60SJolly Shah 12965c80d60SJolly Shah return ret; 13065c80d60SJolly Shah } 13165c80d60SJolly Shah 13265c80d60SJolly Shah /** 133de7ed953SPrasad Kummari * pm_ipi_send() - Sends IPI request to the remote processor. 134de7ed953SPrasad Kummari * @proc: Pointer to the processor who is initiating request. 135de7ed953SPrasad Kummari * @payload: API id and call arguments to be written in IPI buffer. 13665c80d60SJolly Shah * 13765c80d60SJolly Shah * Send an IPI request to the power controller. 13865c80d60SJolly Shah * 139de7ed953SPrasad Kummari * Return: Returns status, either success or error+reason. 140de7ed953SPrasad Kummari * 14165c80d60SJolly Shah */ 14265c80d60SJolly Shah enum pm_ret_status pm_ipi_send(const struct pm_proc *proc, 14365c80d60SJolly Shah uint32_t payload[PAYLOAD_ARG_CNT]) 14465c80d60SJolly Shah { 14565c80d60SJolly Shah enum pm_ret_status ret; 14665c80d60SJolly Shah 1470b3a2cf0SJay Buddhabhatti pm_ipi_lock_get(); 14865c80d60SJolly Shah 14965c80d60SJolly Shah ret = pm_ipi_send_common(proc, payload, IPI_BLOCKING); 15065c80d60SJolly Shah 1510b3a2cf0SJay Buddhabhatti pm_ipi_lock_release(); 15265c80d60SJolly Shah 15365c80d60SJolly Shah return ret; 15465c80d60SJolly Shah } 15565c80d60SJolly Shah 15665c80d60SJolly Shah 15765c80d60SJolly Shah /** 15865c80d60SJolly Shah * pm_ipi_buff_read() - Reads IPI response after remote processor has handled 159de7ed953SPrasad Kummari * interrupt. 160de7ed953SPrasad Kummari * @proc: Pointer to the processor who is waiting and reading response. 161de7ed953SPrasad Kummari * @value: Used to return value from IPI buffer element (optional). 162de7ed953SPrasad Kummari * @count: Number of values to return in @value. 16365c80d60SJolly Shah * 164de7ed953SPrasad Kummari * Return: Returns status, either success or error+reason. 165de7ed953SPrasad Kummari * 16665c80d60SJolly Shah */ 16765c80d60SJolly Shah static enum pm_ret_status pm_ipi_buff_read(const struct pm_proc *proc, 16802943d0dSJay Buddhabhatti uint32_t *value, size_t count) 16965c80d60SJolly Shah { 17065c80d60SJolly Shah size_t i; 1715e92be51SNaman Trivedi Manojbhai enum pm_ret_status ret; 17202943d0dSJay Buddhabhatti #if IPI_CRC_CHECK 17302943d0dSJay Buddhabhatti uint32_t crc; 17402943d0dSJay Buddhabhatti #endif 17565c80d60SJolly Shah uintptr_t buffer_base = proc->ipi->buffer_base + 17665c80d60SJolly Shah IPI_BUFFER_TARGET_REMOTE_OFFSET + 17765c80d60SJolly Shah IPI_BUFFER_RESP_OFFSET; 17865c80d60SJolly Shah 17965c80d60SJolly Shah /* 18065c80d60SJolly Shah * Read response from IPI buffer 18165c80d60SJolly Shah * buf-0: success or error+reason 18265c80d60SJolly Shah * buf-1: value 18365c80d60SJolly Shah * buf-2: unused 18465c80d60SJolly Shah * buf-3: unused 18565c80d60SJolly Shah */ 18602943d0dSJay Buddhabhatti for (i = 0U; i < count; i++) { 18702943d0dSJay Buddhabhatti value[i] = mmio_read_32(buffer_base + ((i + 1U) * PAYLOAD_ARG_SIZE)); 18865c80d60SJolly Shah } 1895e92be51SNaman Trivedi Manojbhai 19072eb16b7SDevanshi Chauhan Alpeshbhai /* 19172eb16b7SDevanshi Chauhan Alpeshbhai * Here mmio_read_32() reads return status stored in IPI payload that 19272eb16b7SDevanshi Chauhan Alpeshbhai * is received from firmware and it's value will be one the values 19372eb16b7SDevanshi Chauhan Alpeshbhai * listed in enum pm_ret_status. 19472eb16b7SDevanshi Chauhan Alpeshbhai */ 19572eb16b7SDevanshi Chauhan Alpeshbhai ret = (enum pm_ret_status)mmio_read_32(buffer_base); 196d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK 19702943d0dSJay Buddhabhatti crc = mmio_read_32(buffer_base + (PAYLOAD_CRC_POS * PAYLOAD_ARG_SIZE)); 19802943d0dSJay Buddhabhatti if (crc != calculate_crc((uint32_t *)buffer_base, IPI_W0_TO_W6_SIZE)) { 19902943d0dSJay Buddhabhatti NOTICE("ERROR in CRC response payload value:0x%x\n", crc); 2005e92be51SNaman Trivedi Manojbhai ret = PM_RET_ERROR_INVALID_CRC; 2015e92be51SNaman Trivedi Manojbhai /* Payload data is invalid as CRC validation failed 2025e92be51SNaman Trivedi Manojbhai * Clear the payload to avoid leakage of data to upper layers 2035e92be51SNaman Trivedi Manojbhai */ 20402943d0dSJay Buddhabhatti memset(value, 0, count); 205eb0d2b17SVenkatesh Yadav Abbarapu } 206fe550edeSVenkatesh Yadav Abbarapu #endif 20765c80d60SJolly Shah 2085e92be51SNaman Trivedi Manojbhai return ret; 20965c80d60SJolly Shah } 21065c80d60SJolly Shah 21165c80d60SJolly Shah /** 212b96065a0SNaman Patel * pm_ipi_buff_read_callb() - Callback function that reads value from 213de7ed953SPrasad Kummari * ipi response buffer. 214de7ed953SPrasad Kummari * @value: Used to return value from IPI buffer element. 215de7ed953SPrasad Kummari * @count: Number of values to return in @value. 21665c80d60SJolly Shah * 217b96065a0SNaman Patel * This callback function fills requested data in @value from ipi response 218b96065a0SNaman Patel * buffer. 219de7ed953SPrasad Kummari * 220de7ed953SPrasad Kummari * Return: Returns status, either success or error. 221de7ed953SPrasad Kummari * 22265c80d60SJolly Shah */ 2236173d914SNaman Trivedi Manojbhai enum pm_ret_status pm_ipi_buff_read_callb(uint32_t *value, size_t count) 22465c80d60SJolly Shah { 22565c80d60SJolly Shah size_t i; 226d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK 227e5adcfcdSDevanshi Chauhan Alpeshbhai size_t local_count = count; 22802943d0dSJay Buddhabhatti uint32_t crc; 229fe550edeSVenkatesh Yadav Abbarapu #endif 23065c80d60SJolly Shah uintptr_t buffer_base = IPI_BUFFER_REMOTE_BASE + 23165c80d60SJolly Shah IPI_BUFFER_TARGET_LOCAL_OFFSET + 23265c80d60SJolly Shah IPI_BUFFER_REQ_OFFSET; 2336173d914SNaman Trivedi Manojbhai enum pm_ret_status ret = PM_RET_SUCCESS; 23465c80d60SJolly Shah 23503fa6f42SJay Buddhabhatti for (i = 0; i < count; i++) { 23602943d0dSJay Buddhabhatti value[i] = mmio_read_32(buffer_base + (i * PAYLOAD_ARG_SIZE)); 23765c80d60SJolly Shah } 238d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK 239e5adcfcdSDevanshi Chauhan Alpeshbhai if (local_count > (uint32_t)IPI_BUFFER_MAX_WORDS) { 240e5adcfcdSDevanshi Chauhan Alpeshbhai local_count = IPI_BUFFER_MAX_WORDS; 241e5adcfcdSDevanshi Chauhan Alpeshbhai } 242e5adcfcdSDevanshi Chauhan Alpeshbhai 24302943d0dSJay Buddhabhatti crc = mmio_read_32(buffer_base + (PAYLOAD_CRC_POS * PAYLOAD_ARG_SIZE)); 24402943d0dSJay Buddhabhatti if (crc != calculate_crc((uint32_t *)buffer_base, IPI_W0_TO_W6_SIZE)) { 24502943d0dSJay Buddhabhatti NOTICE("ERROR in CRC response payload value:0x%x\n", crc); 2466173d914SNaman Trivedi Manojbhai ret = PM_RET_ERROR_INVALID_CRC; 2476173d914SNaman Trivedi Manojbhai /* Payload data is invalid as CRC validation failed 2486173d914SNaman Trivedi Manojbhai * Clear the payload to avoid leakage of data to upper layers 2496173d914SNaman Trivedi Manojbhai */ 250b21e2874SMaheedhar Bollapalli memset(value, 0, local_count); 251eb0d2b17SVenkatesh Yadav Abbarapu } 252fe550edeSVenkatesh Yadav Abbarapu #endif 2536173d914SNaman Trivedi Manojbhai return ret; 25465c80d60SJolly Shah } 25565c80d60SJolly Shah 25665c80d60SJolly Shah /** 257de7ed953SPrasad Kummari * pm_ipi_send_sync() - Sends IPI request to the remote processor. 258de7ed953SPrasad Kummari * @proc: Pointer to the processor who is initiating request. 259de7ed953SPrasad Kummari * @payload: API id and call arguments to be written in IPI buffer. 260de7ed953SPrasad Kummari * @value: Used to return value from IPI buffer element (optional). 261de7ed953SPrasad Kummari * @count: Number of values to return in @value. 26265c80d60SJolly Shah * 26365c80d60SJolly Shah * Send an IPI request to the power controller and wait for it to be handled. 26465c80d60SJolly Shah * 265de7ed953SPrasad Kummari * Return: Returns status, either success or error+reason and, optionally, 266de7ed953SPrasad Kummari * @value. 267de7ed953SPrasad Kummari * 26865c80d60SJolly Shah */ 26965c80d60SJolly Shah enum pm_ret_status pm_ipi_send_sync(const struct pm_proc *proc, 27065c80d60SJolly Shah uint32_t payload[PAYLOAD_ARG_CNT], 271ffa91031SVenkatesh Yadav Abbarapu uint32_t *value, size_t count) 27265c80d60SJolly Shah { 27365c80d60SJolly Shah enum pm_ret_status ret; 27465c80d60SJolly Shah 2750b3a2cf0SJay Buddhabhatti pm_ipi_lock_get(); 27665c80d60SJolly Shah 27765c80d60SJolly Shah ret = pm_ipi_send_common(proc, payload, IPI_BLOCKING); 278eb0d2b17SVenkatesh Yadav Abbarapu if (ret != PM_RET_SUCCESS) { 27965c80d60SJolly Shah goto unlock; 280eb0d2b17SVenkatesh Yadav Abbarapu } 28165c80d60SJolly Shah 28272eb16b7SDevanshi Chauhan Alpeshbhai ret = (enum pm_ret_status)(ERROR_CODE_MASK & 28372eb16b7SDevanshi Chauhan Alpeshbhai (uint32_t)(pm_ipi_buff_read(proc, value, count))); 28465c80d60SJolly Shah 28565c80d60SJolly Shah unlock: 2860b3a2cf0SJay Buddhabhatti pm_ipi_lock_release(); 28765c80d60SJolly Shah 28865c80d60SJolly Shah return ret; 28965c80d60SJolly Shah } 29065c80d60SJolly Shah 29165c80d60SJolly Shah void pm_ipi_irq_enable(const struct pm_proc *proc) 29265c80d60SJolly Shah { 29365c80d60SJolly Shah ipi_mb_enable_irq(proc->ipi->local_ipi_id, proc->ipi->remote_ipi_id); 29465c80d60SJolly Shah } 29565c80d60SJolly Shah 29665c80d60SJolly Shah void pm_ipi_irq_clear(const struct pm_proc *proc) 29765c80d60SJolly Shah { 29865c80d60SJolly Shah ipi_mb_ack(proc->ipi->local_ipi_id, proc->ipi->remote_ipi_id); 29965c80d60SJolly Shah } 30065c80d60SJolly Shah 30165c80d60SJolly Shah uint32_t pm_ipi_irq_status(const struct pm_proc *proc) 30265c80d60SJolly Shah { 303bdba3c84SDevanshi Chauhan Alpeshbhai uint32_t ret; 30472eb16b7SDevanshi Chauhan Alpeshbhai uint32_t result = (uint32_t)PM_RET_SUCCESS; 30565c80d60SJolly Shah 30665c80d60SJolly Shah ret = ipi_mb_enquire_status(proc->ipi->local_ipi_id, 30765c80d60SJolly Shah proc->ipi->remote_ipi_id); 308bdba3c84SDevanshi Chauhan Alpeshbhai if ((ret & IPI_MB_STATUS_RECV_PENDING) != 0U) { 30972eb16b7SDevanshi Chauhan Alpeshbhai result = IPI_MB_STATUS_RECV_PENDING; 31065c80d60SJolly Shah } 311906d5892SNithin G 312906d5892SNithin G return result; 313eb0d2b17SVenkatesh Yadav Abbarapu } 314fe550edeSVenkatesh Yadav Abbarapu 315d7758354SVenkatesh Yadav Abbarapu #if IPI_CRC_CHECK 3167d0eb0e1SDevanshi Chauhan Alpeshbhai uint32_t calculate_crc(uint32_t payload[PAYLOAD_ARG_CNT], uint32_t buffersize) 317fe550edeSVenkatesh Yadav Abbarapu { 318fe550edeSVenkatesh Yadav Abbarapu uint32_t crcinit = CRC_INIT_VALUE; 319fe550edeSVenkatesh Yadav Abbarapu uint32_t order = CRC_ORDER; 320fe550edeSVenkatesh Yadav Abbarapu uint32_t polynom = CRC_POLYNOM; 321fe550edeSVenkatesh Yadav Abbarapu uint32_t i, j, c, bit, datain, crcmask, crchighbit; 322fe550edeSVenkatesh Yadav Abbarapu uint32_t crc = crcinit; 323fe550edeSVenkatesh Yadav Abbarapu 3247d0eb0e1SDevanshi Chauhan Alpeshbhai crcmask = ((((uint32_t)1U << (order - 1U)) - 1U) << 1U) | 1U; 3257d0eb0e1SDevanshi Chauhan Alpeshbhai crchighbit = ((uint32_t)1U << (order - 1U)); 326fe550edeSVenkatesh Yadav Abbarapu 3277d0eb0e1SDevanshi Chauhan Alpeshbhai for (i = 0U; i < buffersize; i++) { 328fe550edeSVenkatesh Yadav Abbarapu datain = mmio_read_8((unsigned long)payload + i); 329fe550edeSVenkatesh Yadav Abbarapu c = datain; 330fe550edeSVenkatesh Yadav Abbarapu j = 0x80U; 331fe550edeSVenkatesh Yadav Abbarapu while (j != 0U) { 332fe550edeSVenkatesh Yadav Abbarapu bit = crc & crchighbit; 333fe550edeSVenkatesh Yadav Abbarapu crc <<= 1U; 3347d0eb0e1SDevanshi Chauhan Alpeshbhai if (0U != (c & j)) { 335fe550edeSVenkatesh Yadav Abbarapu bit ^= crchighbit; 3367d0eb0e1SDevanshi Chauhan Alpeshbhai } 3377d0eb0e1SDevanshi Chauhan Alpeshbhai if (bit != 0U) { 338fe550edeSVenkatesh Yadav Abbarapu crc ^= polynom; 3397d0eb0e1SDevanshi Chauhan Alpeshbhai } 340fe550edeSVenkatesh Yadav Abbarapu j >>= 1U; 341fe550edeSVenkatesh Yadav Abbarapu } 342fe550edeSVenkatesh Yadav Abbarapu crc &= crcmask; 343fe550edeSVenkatesh Yadav Abbarapu } 344fe550edeSVenkatesh Yadav Abbarapu return crc; 345fe550edeSVenkatesh Yadav Abbarapu } 346fe550edeSVenkatesh Yadav Abbarapu #endif 347