iommulib.h revision cd21e7c548ae2a3b5e522244bf798f2a6b4ba02d
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2012 Garrett D'Amore <garrett@damore.org>. All rights reserved.
*/
#ifndef _SYS_IOMMULIB_H
#define _SYS_IOMMULIB_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/ddi_impldefs.h>
#ifdef _KERNEL
typedef enum {
INVALID_VENDOR = 0,
typedef enum {
IOMMU_OPS_VERSION_1 = 1,
IOMMU_OPS_VERSION_2 = 2,
#define IOMMU_OPS_VERSION IOMMU_OPS_VERSION_3
typedef struct iommulib_ops {
char *ilops_id;
void *ilops_data;
/*
* Fake pointer value to indicate that a device will not use an IOMMU
* for DMA (it's either set up for passthrough or uses a unity mapping).
*/
#define IOMMU_HANDLE_UNUSED (void *)-1
/*
* IOMMU_UNITIALIZED() is true if it has not been determined whether
* a device uses an IOMMU for DMA or not. After it has been determined,
* the USED and UNUSED macros may be used to see if an IOMMU is being
* used or not.
*
* IOMMU_USED() is true if a device uses an IOMMU for DMA
*
* IOMMU_UNUSED() is true if a device does not use an IOMMU for DMA
*/
#define IOMMU_USED(dip) \
#define IOMMU_UNUSED(dip) \
#define IOMMU_UNITIALIZED(dip) \
typedef enum {
typedef struct iommulib_nexops {
char *nops_id;
void *nops_data;
/*
* struct iommu_dip_private
* private iommu structure hook on dev_info
*/
typedef struct iommu_private {
/* pci seg, bus, dev, func */
int idp_seg;
int idp_bus;
int idp_devfn;
/* ppb information */
int idp_bbp_type;
int idp_sec;
int idp_sub;
/* identifier for special devices */
/* domain ptr */
void *idp_intel_domain;
#define INTEL_IOMMU_PRIVATE(i) (dmar_domain_state_t *)(i)
typedef struct gfx_entry {
int g_ref;
} gfx_entry_t;
/*
* Interfaces for nexus drivers - typically rootnex
*/
/*
* Interfaces for IOMMU drivers provided by IOMMULIB
*/
/* Interfaces for IOMMU drivers provided by NEXUS drivers (typically rootnex) */
/*
* For SMBIOS access from IOMMU drivers
*/
extern smbios_hdl_t *iommulib_smbios;
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_IOMMULIB_H */