forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 cde9070d9970eef1f7ec2360586c802a16230ad8
kernel/arch/powerpc/platforms/powernv/opal-prd.c
....@@ -1,17 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * OPAL Runtime Diagnostics interface driver
34 * Supported on POWERNV platform
45 *
56 * Copyright IBM Corporation 2015
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License version 2 as
9
- * published by the Free Software Foundation.
10
- *
11
- * This program is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU General Public License for more details.
157 */
168
179 #define pr_fmt(fmt) "opal-prd: " fmt
....@@ -32,7 +24,7 @@
3224 #include <linux/uaccess.h>
3325
3426
35
-/**
27
+/*
3628 * The msg member must be at the end of the struct, as it's followed by the
3729 * message data.
3830 */
....@@ -350,7 +342,7 @@
350342 int msg_size, item_size;
351343 unsigned long flags;
352344
353
- if (msg_type != OPAL_MSG_PRD)
345
+ if (msg_type != OPAL_MSG_PRD && msg_type != OPAL_MSG_PRD2)
354346 return 0;
355347
356348 /* Calculate total size of the message and item we need to store. The
....@@ -380,6 +372,12 @@
380372 .priority = 0,
381373 };
382374
375
+static struct notifier_block opal_prd_event_nb2 = {
376
+ .notifier_call = opal_prd_msg_notifier,
377
+ .next = NULL,
378
+ .priority = 0,
379
+};
380
+
383381 static int opal_prd_probe(struct platform_device *pdev)
384382 {
385383 int rc;
....@@ -401,11 +399,20 @@
401399 return rc;
402400 }
403401
402
+ rc = opal_message_notifier_register(OPAL_MSG_PRD2, &opal_prd_event_nb2);
403
+ if (rc) {
404
+ pr_err("Couldn't register PRD2 event notifier\n");
405
+ opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb);
406
+ return rc;
407
+ }
408
+
404409 rc = misc_register(&opal_prd_dev);
405410 if (rc) {
406411 pr_err("failed to register miscdev\n");
407412 opal_message_notifier_unregister(OPAL_MSG_PRD,
408413 &opal_prd_event_nb);
414
+ opal_message_notifier_unregister(OPAL_MSG_PRD2,
415
+ &opal_prd_event_nb2);
409416 return rc;
410417 }
411418
....@@ -416,6 +423,7 @@
416423 {
417424 misc_deregister(&opal_prd_dev);
418425 opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb);
426
+ opal_message_notifier_unregister(OPAL_MSG_PRD2, &opal_prd_event_nb2);
419427 return 0;
420428 }
421429