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) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) #include <asm/ebcdic.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) #include <asm/ipl.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) /* VM IPL PARM routines */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) size_t ipl_block_get_ascii_vmparm(char *dest, size_t size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) 				  const struct ipl_parameter_block *ipb)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 	size_t len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) 	char has_lowercase = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	len = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	if ((ipb->ccw.vm_flags & IPL_PB0_CCW_VM_FLAG_VP) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) 	    (ipb->ccw.vm_parm_len > 0)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 		len = min_t(size_t, size - 1, ipb->ccw.vm_parm_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 		memcpy(dest, ipb->ccw.vm_parm, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 		/* If at least one character is lowercase, we assume mixed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 		 * case; otherwise we convert everything to lowercase.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 		 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 		for (i = 0; i < len; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 			if ((dest[i] > 0x80 && dest[i] < 0x8a) || /* a-i */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 			    (dest[i] > 0x90 && dest[i] < 0x9a) || /* j-r */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 			    (dest[i] > 0xa1 && dest[i] < 0xaa)) { /* s-z */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 				has_lowercase = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		if (!has_lowercase)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 			EBC_TOLOWER(dest, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 		EBCASC(dest, len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	dest[len] = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	return len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) }