1 /* 2 * Copyright (C) 2020-2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 8 #ifndef _MMIO_DEV_H_ 9 #define _MMIO_DEV_H_ 10 11 #include "acrn_common.h" 12 13 struct mmio_dev { 14 char name[16]; 15 struct acrn_mmiodev dev; 16 }; 17 18 struct acpi_dev_pt_ops { 19 char hid[8]; 20 char modalias[32]; 21 int (*match)(char *); 22 int (*init)(char *, struct mmio_dev *); 23 void (*write_dsdt)(struct vmctx *); 24 /* TODO: We may add more fields when we support other ACPI dev pt */ 25 }; 26 27 #define DEFINE_ACPI_PT_DEV(x) DATA_SET(acpi_dev_pt_ops_set, x); 28 29 struct mmio_dev *get_mmiodev(char *name); 30 bool get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size); 31 int get_more_acpi_dev_info(char *hid, uint32_t instance, struct acpi_dev_pt_ops *ops); 32 void acpi_dev_write_dsdt(struct vmctx *ctx); 33 34 int create_pt_acpidev(char *arg); 35 int create_pt_mmiodev(char *arg); 36 37 int init_mmio_devs(struct vmctx *ctx); 38 void deinit_mmio_devs(struct vmctx *ctx); 39 40 int mmio_dev_alloc_gpa_resource32(uint32_t *addr, uint32_t size_in); 41 42 #define MMIO_DEV_BASE 0xF0000000U 43 #define MMIO_DEV_LIMIT 0xFE000000U 44 #endif /* _MMIO_DEV_H_ */ 45