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) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * Copyright (C) 1999, 2000 Ralf Baechle (ralf@gnu.org)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/kernel_stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/param.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/timex.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <asm/sn/klconfig.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <asm/sn/arch.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <asm/sn/gda.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) klinfo_t *find_component(lboard_t *brd, klinfo_t *kli, unsigned char struct_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	int index, j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	if (kli == (klinfo_t *)NULL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 		index = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 		for (j = 0; j < KLCF_NUM_COMPS(brd); j++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 			if (kli == KLCF_COMP(brd, j))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 				break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 		index = j;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 		if (index == KLCF_NUM_COMPS(brd)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 			printk("find_component: Bad pointer: 0x%p\n", kli);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 			return (klinfo_t *)NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		index++;		/* next component */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	for (; index < KLCF_NUM_COMPS(brd); index++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 		kli = KLCF_COMP(brd, index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		if (KLCF_COMP_TYPE(kli) == struct_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 			return kli;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	/* Didn't find it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	return (klinfo_t *)NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	return find_component(brd, (klinfo_t *)NULL, struct_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) lboard_t *find_lboard(lboard_t *start, unsigned char brd_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	/* Search all boards stored on this node. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	while (start) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		if (start->brd_type == brd_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			return start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		start = KLCF_NEXT(start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	/* Didn't find it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	return (lboard_t *)NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	/* Search all boards stored on this node. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	while (start) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		if (KLCLASS(start->brd_type) == KLCLASS(brd_type))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 			return start;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 		start = KLCF_NEXT(start);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 	/* Didn't find it. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	return (lboard_t *)NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) }