Deepak Kodihalli | 017e45c | 2017-07-12 01:06:30 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Mailbox Daemon LPC Helpers |
| 3 | * |
| 4 | * Copyright 2017 IBM |
| 5 | * |
| 6 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | * you may not use this file except in compliance with the License. |
| 8 | * You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, software |
| 13 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | * See the License for the specific language governing permissions and |
| 16 | * limitations under the License. |
| 17 | * |
| 18 | */ |
| 19 | |
Andrew Jeffery | 856c717 | 2018-08-08 16:28:50 +0930 | [diff] [blame] | 20 | extern "C" { |
Andrew Jeffery | cd18611 | 2018-08-08 10:47:55 +0930 | [diff] [blame] | 21 | #include "lpc.h" |
William A. Kennington III | d5f1d40 | 2018-10-11 13:55:04 -0700 | [diff] [blame] | 22 | #include "mboxd.h" |
Andrew Jeffery | 856c717 | 2018-08-08 16:28:50 +0930 | [diff] [blame] | 23 | } |
| 24 | |
Deepak Kodihalli | 017e45c | 2017-07-12 01:06:30 -0500 | [diff] [blame] | 25 | #include "mboxd_pnor_partition_table.h" |
| 26 | |
| 27 | /* |
Andrew Jeffery | 17971e4 | 2018-08-08 16:36:10 +0930 | [diff] [blame] | 28 | * lpc_reset() - Reset the lpc bus mapping |
Deepak Kodihalli | 017e45c | 2017-07-12 01:06:30 -0500 | [diff] [blame] | 29 | * @context: The mbox context pointer |
| 30 | * |
| 31 | * Return 0 on success otherwise negative error code |
| 32 | */ |
William A. Kennington III | d5f1d40 | 2018-10-11 13:55:04 -0700 | [diff] [blame] | 33 | int lpc_reset(struct mbox_context* context) |
Deepak Kodihalli | 017e45c | 2017-07-12 01:06:30 -0500 | [diff] [blame] | 34 | { |
Andrew Jeffery | dda8e38 | 2018-05-17 10:11:19 +0930 | [diff] [blame] | 35 | int rc; |
| 36 | |
Deepak Kodihalli | 88c7406 | 2017-07-25 15:29:56 -0500 | [diff] [blame] | 37 | destroy_vpnor(context); |
Andrew Jeffery | dda8e38 | 2018-05-17 10:11:19 +0930 | [diff] [blame] | 38 | |
| 39 | rc = init_vpnor(context); |
| 40 | if (rc < 0) |
| 41 | return rc; |
| 42 | |
| 43 | rc = vpnor_copy_bootloader_partition(context); |
| 44 | if (rc < 0) |
| 45 | return rc; |
| 46 | |
Andrew Jeffery | 17079d1 | 2018-08-08 16:35:09 +0930 | [diff] [blame] | 47 | return lpc_map_memory(context); |
Deepak Kodihalli | 017e45c | 2017-07-12 01:06:30 -0500 | [diff] [blame] | 48 | } |