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)  *	linux/arch/alpha/kernel/err_common.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *	Copyright (C) 2000 Jeff Wiedemeier (Compaq Computer Corporation)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	Error handling code supporting Alpha systems
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #include <linux/sched.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #include <asm/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <asm/hwrpb.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <asm/smp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <asm/err_common.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include "err_impl.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include "proto.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22)  * err_print_prefix -- error handling print routines should prefix
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23)  * all prints with this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) char *err_print_prefix = KERN_NOTICE;
^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)  * Generic
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) mchk_dump_mem(void *data, size_t length, char **annotation)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 	unsigned long *ldata = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	size_t i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 	for (i = 0; (i * sizeof(*ldata)) < length; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 		if (annotation && !annotation[i]) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 			annotation = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 		printk("%s    %08x: %016lx    %s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 		       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 		       (unsigned)(i * sizeof(*ldata)), ldata[i],
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 		       annotation ? annotation[i] : "");
^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) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) mchk_dump_logout_frame(struct el_common *mchk_header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	printk("%s  -- Frame Header --\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	         "    Frame Size:   %d (0x%x) bytes\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	         "    Flags:        %s%s\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	         "    MCHK Code:    0x%x\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 	         "    Frame Rev:    %d\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	         "    Proc Offset:  0x%08x\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	         "    Sys Offset:   0x%08x\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)   	         "  -- Processor Region --\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	       err_print_prefix, 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	       mchk_header->size, mchk_header->size,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	       mchk_header->retry ? "RETRY " : "", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)   	         mchk_header->err2 ? "SECOND_ERR " : "",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	       mchk_header->code,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	       mchk_header->frame_rev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	       mchk_header->proc_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	       mchk_header->sys_offset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	mchk_dump_mem((void *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		      ((unsigned long)mchk_header + mchk_header->proc_offset),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 		      mchk_header->sys_offset - mchk_header->proc_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 		      NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	printk("%s  -- System Region --\n", err_print_prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 	mchk_dump_mem((void *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 		      ((unsigned long)mchk_header + mchk_header->sys_offset),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 		      mchk_header->size - mchk_header->sys_offset,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		      NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	printk("%s  -- End of Frame --\n", err_print_prefix);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 
^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)  * Console Data Log
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) /* Data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) static struct el_subpacket_handler *subpacket_handler_list = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) static struct el_subpacket_annotation *subpacket_annotation_list = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) static struct el_subpacket *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) el_process_header_subpacket(struct el_subpacket *header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	union el_timestamp timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	char *name = "UNKNOWN EVENT";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	int packet_count = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	int length = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	if (header->class != EL_CLASS__HEADER) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		printk("%s** Unexpected header CLASS %d TYPE %d, aborting\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		       header->class, header->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 		return NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	switch(header->type) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	case EL_TYPE__HEADER__SYSTEM_ERROR_FRAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		name = "SYSTEM ERROR";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		length = header->by_type.sys_err.frame_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		packet_count = 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 			header->by_type.sys_err.frame_packet_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 		timestamp.as_int = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	case EL_TYPE__HEADER__SYSTEM_EVENT_FRAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 		name = "SYSTEM EVENT";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 		length = header->by_type.sys_event.frame_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		packet_count = 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			header->by_type.sys_event.frame_packet_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 		timestamp = header->by_type.sys_event.timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	case EL_TYPE__HEADER__HALT_FRAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 		name = "ERROR HALT";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 		length = header->by_type.err_halt.frame_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 		packet_count = 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 			header->by_type.err_halt.frame_packet_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		timestamp = header->by_type.err_halt.timestamp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	case EL_TYPE__HEADER__LOGOUT_FRAME:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 		name = "LOGOUT FRAME";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 		length = header->by_type.logout_header.frame_length;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 		packet_count = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 		timestamp.as_int = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	default: /* Unknown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 		printk("%s** Unknown header - CLASS %d TYPE %d, aborting\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 		       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		       header->class, header->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 		return NULL;		
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	printk("%s*** %s:\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	         "  CLASS %d, TYPE %d\n", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	       name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	       header->class, header->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	el_print_timestamp(&timestamp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	 * Process the subpackets
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	el_process_subpackets(header, packet_count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	/* return the next header */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	header = (struct el_subpacket *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 		((unsigned long)header + header->length + length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	return header;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) static struct el_subpacket *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) el_process_subpacket_reg(struct el_subpacket *header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct el_subpacket *next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	struct el_subpacket_handler *h = subpacket_handler_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	for (; h && h->class != header->class; h = h->next);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	if (h) next = h->handler(header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	return next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) el_print_timestamp(union el_timestamp *timestamp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	if (timestamp->as_int)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 		printk("%s  TIMESTAMP: %d/%d/%02d %d:%02d:%0d\n", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 		       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		       timestamp->b.month, timestamp->b.day,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 		       timestamp->b.year, timestamp->b.hour,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		       timestamp->b.minute, timestamp->b.second);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) void
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) el_process_subpackets(struct el_subpacket *header, int packet_count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	struct el_subpacket *subpacket;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	subpacket = (struct el_subpacket *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 		((unsigned long)header + header->length);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	for (i = 0; subpacket && i < packet_count; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		printk("%sPROCESSING SUBPACKET %d\n", err_print_prefix, i);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 		subpacket = el_process_subpacket(subpacket);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) struct el_subpacket *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) el_process_subpacket(struct el_subpacket *header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	struct el_subpacket *next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	switch(header->class) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	case EL_CLASS__TERMINATION:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		/* Termination packet, there are no more */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	case EL_CLASS__HEADER: 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 		next = el_process_header_subpacket(header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 		if (NULL == (next = el_process_subpacket_reg(header))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 			printk("%s** Unexpected header CLASS %d TYPE %d"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 			       " -- aborting.\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 			       err_print_prefix,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 			       header->class, header->type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	return next;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) void 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) el_annotate_subpacket(struct el_subpacket *header)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 	struct el_subpacket_annotation *a;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	char **annotation = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	for (a = subpacket_annotation_list; a; a = a->next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 		if (a->class == header->class &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 		    a->type == header->type &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 		    a->revision == header->revision) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 			/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 			 * We found the annotation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 			annotation = a->annotation;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 			printk("%s  %s\n", err_print_prefix, a->description);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 	mchk_dump_mem(header, header->length, annotation);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) static void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) cdl_process_console_data_log(int cpu, struct percpu_struct *pcpu)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 	struct el_subpacket *header = (struct el_subpacket *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 		(IDENT_ADDR | pcpu->console_data_log_pa);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 	printk("%s******* CONSOLE DATA LOG FOR CPU %d. *******\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	         "*** Error(s) were logged on a previous boot\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 	       err_print_prefix, cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) 	
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 	for (err = 0; header && (header->class != EL_CLASS__TERMINATION); err++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 		header = el_process_subpacket(header);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 	/* let the console know it's ok to clear the error(s) at restart */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 	pcpu->console_data_log_pa = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 	printk("%s*** %d total error(s) logged\n"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 	         "**** END OF CONSOLE DATA LOG FOR CPU %d ****\n", 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) 	       err_print_prefix, err, cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) void __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) cdl_check_console_data_log(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) 	struct percpu_struct *pcpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) 	unsigned long cpu;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 	for (cpu = 0; cpu < hwrpb->nr_processors; cpu++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		pcpu = (struct percpu_struct *)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 			((unsigned long)hwrpb + hwrpb->processor_offset 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 			 + cpu * hwrpb->processor_size);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) 		if (pcpu->console_data_log_pa)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 			cdl_process_console_data_log(cpu, pcpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) int __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) cdl_register_subpacket_annotation(struct el_subpacket_annotation *new)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) 	struct el_subpacket_annotation *a = subpacket_annotation_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 	if (a == NULL) subpacket_annotation_list = new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) 		for (; a->next != NULL; a = a->next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 			if ((a->class == new->class && a->type == new->type) ||
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 			    a == new) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) 				printk("Attempted to re-register "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) 				       "subpacket annotation\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) 				return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 		a->next = new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) 	new->next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) int __init
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302) cdl_register_subpacket_handler(struct el_subpacket_handler *new)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) 	struct el_subpacket_handler *h = subpacket_handler_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) 	if (h == NULL) subpacket_handler_list = new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) 		for (; h->next != NULL; h = h->next) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309) 			if (h->class == new->class || h == new) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) 				printk("Attempted to re-register "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) 				       "subpacket handler\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312) 				return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) 			}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) 		h->next = new;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) 	new->next = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)