dm: Refine ACPI device passthrough framework

This patch refines the ACPI device passthrough framework by defining a
generic framework. Note that when user gives an HID by "--acpidev_pt
<HID>", the pt logic will go through all registered ops to see if
there's a match.

v4 -> v5:
parse_pt_acpidev/parse_pt_mmiodev -> create_pt_acpidev/create_pt_mmiodev
    (there were already "init_xxx" function present, so rename to
    create_xxx)
"super user" -> "superuser"
multiple API renames

Tracked-On: #6686
Signed-off-by: Yifan Liu <yifan1.liu@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Yifan Liu
2021-10-15 14:25:34 +08:00
committed by wenlingz
parent e0bb4c800d
commit ad5eb6e23d
5 changed files with 176 additions and 36 deletions

View File

@@ -8,8 +8,31 @@
#ifndef _MMIO_DEV_H_
#define _MMIO_DEV_H_
int parse_pt_acpidev(char *arg);
int parse_pt_mmiodev(char *arg);
#include "acrn_common.h"
struct mmio_dev {
char name[16];
struct acrn_mmiodev dev;
};
struct acpi_dev_pt_ops {
char hid[8];
char modalias[32];
int (*match)(char *);
int (*init)(char *, struct mmio_dev *);
void (*write_dsdt)(struct vmctx *);
/* TODO: We may add more fields when we support other ACPI dev pt */
};
#define DEFINE_ACPI_PT_DEV(x) DATA_SET(acpi_dev_pt_ops_set, x);
struct mmio_dev *get_mmiodev(char *name);
int get_mmio_hpa_resource(char *name, uint64_t *res_start, uint64_t *res_size);
int get_more_acpi_dev_info(char *hid, uint32_t instance, struct acpi_dev_pt_ops *ops);
void acpi_dev_write_dsdt(struct vmctx *ctx);
int create_pt_acpidev(char *arg);
int create_pt_mmiodev(char *arg);
int init_mmio_devs(struct vmctx *ctx);
void deinit_mmio_devs(struct vmctx *ctx);