1
/* Copyright 2013-2014 IBM Corp.
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
7
* http://www.apache.org/licenses/LICENSE-2.0
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
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
17
#define pr_fmt(fmt) "CHIPTOD: " fmt
23
/* Response status for fsp command 0xE6, s/c 0x06 (Enable/Disable Topology) */
24
#define FSP_STATUS_TOPO_IN_USE 0xb8 /* topology is in use */
26
static bool fsp_chiptod_update_topology(uint32_t cmd_sub_mod,
30
enum chiptod_topology topo;
34
switch (cmd_sub_mod) {
35
case FSP_CMD_TOPO_ENABLE_DISABLE:
37
* Action Values: 0x00 = Disable, 0x01 = Enable
38
* Topology Values: 0x00 = Primary, 0x01 = Secondary
40
action = !!msg->data.bytes[2];
41
topo = msg->data.bytes[3];
42
prlog(PR_DEBUG, "Topology update event:\n");
43
prlog(PR_DEBUG, " Action = %s, Topology = %s\n",
44
action ? "Enable" : "Disable",
45
topo ? "Secondary" : "Primary");
47
if (!chiptod_adjust_topology(topo, action))
48
status = FSP_STATUS_TOPO_IN_USE;
52
resp = fsp_mkmsg(FSP_RSP_TOPO_ENABLE_DISABLE | status, 0);
54
prerror("Response allocation failed\n");
57
if (fsp_queue_msg(resp, fsp_freemsg)) {
59
prerror("Failed to queue response msg\n");
63
prlog(PR_DEBUG, "Unhandled sub cmd: %06x\n", cmd_sub_mod);
69
static struct fsp_client fsp_chiptod_client = {
70
.message = fsp_chiptod_update_topology,
73
void fsp_chiptod_init(void)
75
/* Register for Class E6 (HW maintanance) */
76
fsp_register_client(&fsp_chiptod_client, FSP_MCLASS_HW_MAINT);