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)  *  linux/arch/m68k/tools/amiga/dmesg.c -- Retrieve the kernel messages stored
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  *					   in Chip RAM with the kernel command
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *					   line option `debug=mem'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *  © Copyright 1996 by Geert Uytterhoeven <geert@linux-m68k.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9)  *  Usage:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11)  *	dmesg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)  *	dmesg <CHIPMEM_END>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15)  *  This file is subject to the terms and conditions of the GNU General Public
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)  *  License.  See the file COPYING in the main directory of the Linux
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)  *  distribution for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <stdio.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <stdlib.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #define CHIPMEM_START	0x00000000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) #define CHIPMEM_END	0x00200000	/* overridden by argv[1] */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define SAVEKMSG_MAGIC1	0x53415645	/* 'SAVE' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define SAVEKMSG_MAGIC2	0x4B4D5347	/* 'KMSG' */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) struct savekmsg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)     u_long magic1;	/* SAVEKMSG_MAGIC1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)     u_long magic2;	/* SAVEKMSG_MAGIC2 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35)     u_long magicptr;	/* address of magic1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)     u_long size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37)     char data[];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) int main(int argc, char *argv[])
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43)     u_long start = CHIPMEM_START, end = CHIPMEM_END, p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)     int found = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45)     struct savekmsg *m = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47)     if (argc >= 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	end = strtoul(argv[1], NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49)     printf("Searching for SAVEKMSG magic...\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)     for (p = start; p <= end-sizeof(struct savekmsg); p += 4) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	m = (struct savekmsg *)p;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	if ((m->magic1 == SAVEKMSG_MAGIC1) && (m->magic2 == SAVEKMSG_MAGIC2) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	    (m->magicptr == p)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	    found = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 	    break;
^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)     if (!found)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	printf("Not found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)     else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	printf("Found %ld bytes at 0x%08lx\n", m->size, (u_long)&m->data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	puts(">>>>>>>>>>>>>>>>>>>>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	fflush(stdout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	write(1, &m->data, m->size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	fflush(stdout);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	puts("<<<<<<<<<<<<<<<<<<<<");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)     }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68)     return(0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) }