Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) /*******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2)  * This file is part of the Emulex Linux Device Driver for         *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Fibre Channel Host Bus Adapters.                                *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 2017-2018 Broadcom. All Rights Reserved. The term *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.     *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  * Copyright (C) 2004-2011 Emulex.  All rights reserved.           *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * EMULEX and SLI are trademarks of Emulex.                        *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  * www.broadcom.com                                                *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *                                                                 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  * This program is free software; you can redistribute it and/or   *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  * modify it under the terms of version 2 of the GNU General       *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  * Public License as published by the Free Software Foundation.    *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  * This program is distributed in the hope that it will be useful. *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)  * more details, a copy of which can be found in the file COPYING  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20)  * included with this package.                                     *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21)  *******************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24)  * This file provides macros to aid compilation in the Linux 2.4 kernel
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)  * over various platform architectures.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) /*******************************************************************
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Note: HBA's SLI memory contains little-endian LW.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) Thus to access it from a little-endian host,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) memcpy_toio() and memcpy_fromio() can be used.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) However on a big-endian host, copy 4 bytes at a time,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) using writel() and readl().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)  *******************************************************************/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #include <asm/byteorder.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #ifdef __BIG_ENDIAN
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) lpfc_memcpy_to_slim(void __iomem *dest, void *src, unsigned int bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	uint32_t __iomem *dest32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	uint32_t *src32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	unsigned int four_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	dest32  = (uint32_t __iomem *) dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	src32  = (uint32_t *) src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 	/* write input bytes, 4 bytes at a time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	for (four_bytes = bytes /4; four_bytes > 0; four_bytes--) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 		writel( *src32, dest32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 		readl(dest32); /* flush */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 		dest32++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		src32++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	uint32_t *dest32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	uint32_t __iomem *src32;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	unsigned int four_bytes;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	dest32  = (uint32_t *) dest;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	src32  = (uint32_t __iomem *) src;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	/* read input bytes, 4 bytes at a time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	for (four_bytes = bytes /4; four_bytes > 0; four_bytes--) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 		*dest32 = readl( src32);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		dest32++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		src32++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) 	/* convert bytes in argument list to word count for copy function */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) 	__iowrite32_copy(dest, src, bytes / sizeof(uint32_t));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) static inline void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) 	/* actually returns 1 byte past dest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) 	memcpy_fromio( dest, src, bytes);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) #endif	/* __BIG_ENDIAN */