1 /* Copyright 2013-2014 IBM Corp.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * 	http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 /*
18  * Code for handling FSP_MCLASS_DIAG messages (cmd 0xee)
19  * Receiving a high level ack timeout is likely indicative of a firmware bug
20  */
21 #include <skiboot.h>
22 #include <fsp.h>
23 #include <lock.h>
24 #include <processor.h>
25 #include <timebase.h>
26 #include <opal.h>
27 #include <fsp-sysparam.h>
28 
29 static bool fsp_diag_msg(u32 cmd_sub_mod, struct fsp_msg *msg)
30 {
31 
32 	if (cmd_sub_mod == FSP_RSP_DIAG_LINK_ERROR) {
33 		printf("FIXME: Unhandled FSP_MCLASS_DIAG Link Error Report\n");
34 		return false;
35 	}
36 
37 	if (cmd_sub_mod != FSP_RSP_DIAG_ACK_TIMEOUT) {
38 		printf("BUG: Unhandled subcommand: 0x%x (New FSP spec?)\n",
39 		       cmd_sub_mod);
40 		return false;
41 	}
42 
43 	printf("BUG: High Level ACK timeout (FSP_MCLASS_DIAG) for 0x%x\n",
44 	       msg->data.words[0] & 0xffff0000);
45 
46 	return true;
47 }
48 
49 static struct fsp_client fsp_diag = {
50 	.message = fsp_diag_msg,
51 };
52 
53 /* This is called at boot time */
54 void fsp_init_diag(void)
55 {
56 	/* Register for the diag event */
57 	fsp_register_client(&fsp_diag, FSP_MCLASS_DIAG);
58 }
59