| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * OPAL Runtime Diagnostics interface driver |
|---|
| 3 | 4 | * Supported on POWERNV platform |
|---|
| 4 | 5 | * |
|---|
| 5 | 6 | * 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. |
|---|
| 15 | 7 | */ |
|---|
| 16 | 8 | |
|---|
| 17 | 9 | #define pr_fmt(fmt) "opal-prd: " fmt |
|---|
| .. | .. |
|---|
| 32 | 24 | #include <linux/uaccess.h> |
|---|
| 33 | 25 | |
|---|
| 34 | 26 | |
|---|
| 35 | | -/** |
|---|
| 27 | +/* |
|---|
| 36 | 28 | * The msg member must be at the end of the struct, as it's followed by the |
|---|
| 37 | 29 | * message data. |
|---|
| 38 | 30 | */ |
|---|
| .. | .. |
|---|
| 350 | 342 | int msg_size, item_size; |
|---|
| 351 | 343 | unsigned long flags; |
|---|
| 352 | 344 | |
|---|
| 353 | | - if (msg_type != OPAL_MSG_PRD) |
|---|
| 345 | + if (msg_type != OPAL_MSG_PRD && msg_type != OPAL_MSG_PRD2) |
|---|
| 354 | 346 | return 0; |
|---|
| 355 | 347 | |
|---|
| 356 | 348 | /* Calculate total size of the message and item we need to store. The |
|---|
| .. | .. |
|---|
| 380 | 372 | .priority = 0, |
|---|
| 381 | 373 | }; |
|---|
| 382 | 374 | |
|---|
| 375 | +static struct notifier_block opal_prd_event_nb2 = { |
|---|
| 376 | + .notifier_call = opal_prd_msg_notifier, |
|---|
| 377 | + .next = NULL, |
|---|
| 378 | + .priority = 0, |
|---|
| 379 | +}; |
|---|
| 380 | + |
|---|
| 383 | 381 | static int opal_prd_probe(struct platform_device *pdev) |
|---|
| 384 | 382 | { |
|---|
| 385 | 383 | int rc; |
|---|
| .. | .. |
|---|
| 401 | 399 | return rc; |
|---|
| 402 | 400 | } |
|---|
| 403 | 401 | |
|---|
| 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 | + |
|---|
| 404 | 409 | rc = misc_register(&opal_prd_dev); |
|---|
| 405 | 410 | if (rc) { |
|---|
| 406 | 411 | pr_err("failed to register miscdev\n"); |
|---|
| 407 | 412 | opal_message_notifier_unregister(OPAL_MSG_PRD, |
|---|
| 408 | 413 | &opal_prd_event_nb); |
|---|
| 414 | + opal_message_notifier_unregister(OPAL_MSG_PRD2, |
|---|
| 415 | + &opal_prd_event_nb2); |
|---|
| 409 | 416 | return rc; |
|---|
| 410 | 417 | } |
|---|
| 411 | 418 | |
|---|
| .. | .. |
|---|
| 416 | 423 | { |
|---|
| 417 | 424 | misc_deregister(&opal_prd_dev); |
|---|
| 418 | 425 | opal_message_notifier_unregister(OPAL_MSG_PRD, &opal_prd_event_nb); |
|---|
| 426 | + opal_message_notifier_unregister(OPAL_MSG_PRD2, &opal_prd_event_nb2); |
|---|
| 419 | 427 | return 0; |
|---|
| 420 | 428 | } |
|---|
| 421 | 429 | |
|---|