summaryrefslogtreecommitdiffstats
path: root/hw/fsp/fsp-sysparam.c
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2015-04-06 14:03:01 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-05-07 17:42:34 +1000
commit3288c187c2b3e82ff78f54cd6887dc2f95d7bbe9 (patch)
tree44f5ef8f3889e5e575ca3461e55d69c7fc0b8755 /hw/fsp/fsp-sysparam.c
parentbfa6a82a1e54d575c745eecf6baec03e825282cf (diff)
downloadtalos-skiboot-3288c187c2b3e82ff78f54cd6887dc2f95d7bbe9.tar.gz
talos-skiboot-3288c187c2b3e82ff78f54cd6887dc2f95d7bbe9.zip
FSP/SYSPARAM: Introduce update notify system parameter notifier
FSP sends update system parameter notification asynchronously. Presently no one is using this notification. We just ACK this notification. This patch adds notifier chain so that if someone (like LED) is interested in this notification, they can register and get notification. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/fsp/fsp-sysparam.c')
-rw-r--r--hw/fsp/fsp-sysparam.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/hw/fsp/fsp-sysparam.c b/hw/fsp/fsp-sysparam.c
index a59c329e..2dbf05c6 100644
--- a/hw/fsp/fsp-sysparam.c
+++ b/hw/fsp/fsp-sysparam.c
@@ -346,6 +346,52 @@ static int64_t fsp_opal_set_param(uint64_t async_token, uint32_t param_id,
return OPAL_ASYNC_COMPLETION;
}
+struct sysparam_notify_entry {
+ struct list_node link;
+ sysparam_update_notify notify;
+};
+
+static LIST_HEAD(sysparam_update_notifiers);
+
+/* Add client to notifier chain */
+void sysparam_add_update_notifier(sysparam_update_notify notify)
+{
+ struct sysparam_notify_entry *entry;
+
+ entry = zalloc(sizeof(struct sysparam_notify_entry));
+ assert(entry);
+
+ entry->notify = notify;
+ list_add_tail(&sysparam_update_notifiers, &entry->link);
+}
+
+/* Remove client from notifier chain */
+void sysparam_del_update_notifier(sysparam_update_notify notify)
+{
+ struct sysparam_notify_entry *entry;
+
+ list_for_each(&sysparam_update_notifiers, entry, link) {
+ if (entry->notify == notify) {
+ list_del(&entry->link);
+ free(entry);
+ return;
+ }
+ }
+}
+
+/* Update notification chain */
+static void sysparam_run_update_notifier(struct fsp_msg *msg)
+{
+ bool ret;
+ struct sysparam_notify_entry *entry;
+
+ list_for_each(&sysparam_update_notifiers, entry, link) {
+ ret = entry->notify(msg);
+ if (ret == true)
+ break;
+ }
+}
+
static bool fsp_sysparam_msg(u32 cmd_sub_mod, struct fsp_msg *msg)
{
struct fsp_msg *rsp;
@@ -356,6 +402,9 @@ static bool fsp_sysparam_msg(u32 cmd_sub_mod, struct fsp_msg *msg)
case FSP_CMD_SP_SPARM_UPD_1:
printf("FSP: Got sysparam update, param ID 0x%x\n",
msg->data.words[0]);
+
+ sysparam_run_update_notifier(msg);
+
rsp = fsp_mkmsg((cmd_sub_mod & 0xffff00) | 0x008000, 0);
if (rsp)
rc = fsp_queue_msg(rsp, fsp_freemsg);
OpenPOWER on IntegriCloud