Andrew Scull | 6d2db33 | 2018-10-10 15:28:17 +0100 | [diff] [blame] | 1 | /* |
Andrew Walbran | 692b325 | 2019-03-07 15:51:31 +0000 | [diff] [blame] | 2 | * Copyright 2018 The Hafnium Authors. |
Andrew Scull | 6d2db33 | 2018-10-10 15:28:17 +0100 | [diff] [blame] | 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * https://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #pragma once |
| 18 | |
Andrew Walbran | 9553492 | 2019-06-19 11:32:54 +0100 | [diff] [blame] | 19 | #include "hf/spci.h" |
Andrew Scull | 6d2db33 | 2018-10-10 15:28:17 +0100 | [diff] [blame] | 20 | #include "hf/types.h" |
| 21 | |
Andrew Walbran | f0c314d | 2019-10-02 14:24:26 +0100 | [diff] [blame] | 22 | /* Keep macro alignment */ |
| 23 | /* clang-format off */ |
| 24 | |
| 25 | /* TODO: Define constants below according to spec. */ |
| 26 | #define HF_VM_GET_COUNT 0xff01 |
| 27 | #define HF_VCPU_GET_COUNT 0xff02 |
| 28 | #define HF_VM_CONFIGURE 0xff03 |
| 29 | #define HF_MAILBOX_CLEAR 0xff04 |
| 30 | #define HF_MAILBOX_WRITABLE_GET 0xff05 |
| 31 | #define HF_MAILBOX_WAITER_GET 0xff06 |
| 32 | #define HF_INTERRUPT_ENABLE 0xff07 |
| 33 | #define HF_INTERRUPT_GET 0xff08 |
| 34 | #define HF_INTERRUPT_INJECT 0xff09 |
| 35 | #define HF_SHARE_MEMORY 0xff0a |
| 36 | |
| 37 | /* Custom SPCI-like calls returned from SPCI_RUN. */ |
| 38 | #define HF_SPCI_RUN_WAIT_FOR_INTERRUPT 0xff0b |
| 39 | #define HF_SPCI_RUN_WAKE_UP 0xff0c |
| 40 | |
| 41 | /* This matches what Trusty and its ATF module currently use. */ |
| 42 | #define HF_DEBUG_LOG 0xbd000000 |
| 43 | |
| 44 | /* clang-format on */ |
| 45 | |
Andrew Scull | 6386f25 | 2018-12-06 13:29:10 +0000 | [diff] [blame] | 46 | enum hf_share { |
| 47 | /** |
| 48 | * Relinquish ownership and access to the memory and pass them to the |
| 49 | * recipient. |
| 50 | */ |
| 51 | HF_MEMORY_GIVE, |
| 52 | |
| 53 | /** |
| 54 | * Retain ownership of the memory but relinquish access to the |
| 55 | * recipient. |
| 56 | */ |
| 57 | HF_MEMORY_LEND, |
| 58 | |
| 59 | /** |
| 60 | * Retain ownership and access but additionally allow access to the |
| 61 | * recipient. |
| 62 | */ |
| 63 | HF_MEMORY_SHARE, |
| 64 | }; |