blob: 78477a3871b42ba4470127df942771ba0130bf4b [file] [log] [blame]
Jose Marinhofc0b2b62019-06-06 11:18:45 +01001/*
2 * Copyright 2019 The Hafnium Authors.
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
Jose Marinho75509b42019-04-09 09:34:59 +010019#include "hf/addr.h"
20#include "hf/vm.h"
21
22#include "vmapi/hf/spci.h"
23
Jose Marinhofc0b2b62019-06-06 11:18:45 +010024#define SPCI_VERSION_MAJOR 0x0
25#define SPCI_VERSION_MINOR 0x9
26
27#define SPCI_VERSION_MAJOR_OFFSET 16
Jose Marinho75509b42019-04-09 09:34:59 +010028
29struct spci_mem_transitions {
30 int orig_from_mode;
31 int orig_to_mode;
32 int from_mode;
33 int to_mode;
34};
35
36spci_return_t spci_msg_handle_architected_message(
37 struct vm_locked to_locked, struct vm_locked from_locked,
38 const struct spci_architected_message_header
39 *architected_message_replica,
40 struct spci_message *from_msg_replica, struct spci_message *to_msg);
41
42bool spci_msg_check_transition(struct vm *to, struct vm *from,
43 enum spci_memory_share share,
44 int *orig_from_mode, ipaddr_t begin,
45 ipaddr_t end, uint32_t memory_to_attributes,
46 int *from_mode, int *to_mode);