summaryrefslogtreecommitdiff
path: root/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_log.h
blob: b9f269986a53e47abd9f8c8c85666589c7f5e063 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
 * 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
 * or http://www.opensolaris.org/os/licensing.
 * 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 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef _AMD_IOMMU_LOG_H
#define	_AMD_IOMMU_LOG_H

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/amd_iommu.h>

#ifdef _KERNEL

#define	EV2OFF(e)	((e) << 4)
#define	OFF2EV(o)	((o) >> 4)

typedef enum {
	AMD_IOMMU_EVENT_INVALID = 0,
	AMD_IOMMU_EVENT_DEVTAB_ILLEGAL_ENTRY = 1,
	AMD_IOMMU_EVENT_IO_PAGE_FAULT = 2,
	AMD_IOMMU_EVENT_DEVTAB_HW_ERROR = 3,
	AMD_IOMMU_EVENT_PGTABLE_HW_ERROR = 4,
	AMD_IOMMU_EVENT_CMDBUF_ILLEGAL_CMD = 5,
	AMD_IOMMU_EVENT_CMDBUF_HW_ERROR = 6,
	AMD_IOMMU_EVENT_IOTLB_INVAL_TO = 7,
	AMD_IOMMU_EVENT_DEVICE_ILLEGAL_REQ = 8
} amd_iommu_event_t;

/* Common to all events */
#define	AMD_IOMMU_EVENT_TYPE			(31 << 16 | 28)

/* Illegal device Table Entry Event bits */
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_TR		(24 << 16 | 24)
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_RZ		(23 << 16 | 23)
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_RW		(21 << 16 | 21)
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_INTR		(19 << 16 | 19)
#define	AMD_IOMMU_EVENT_DEVTAB_ILL_VADDR_LO	(31 << 16 | 2)

/* IO Page Fault event bits */
#define	AMD_IOMMU_EVENT_IO_PGFAULT_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_TR		(24 << 16 | 24)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_RZ		(23 << 16 | 23)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_PE		(22 << 16 | 22)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_RW		(21 << 16 | 21)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_PR		(20 << 16 | 20)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_INTR		(19 << 16 | 19)
#define	AMD_IOMMU_EVENT_IO_PGFAULT_DOMAINID	(15 << 16 | 0)


/* Device Table HW Error event bits */
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_TYPE	(26 << 16 | 25)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_TR		(24 << 16 | 24)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_RW		(21 << 16 | 21)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_INTR	(19 << 16 | 19)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_PHYSADDR_LO	(31 << 16 | 4)


/* Page Table HW Error event bits */
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_DEVTAB_HWERR_TYPE	(26 << 16 | 25)
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_TR	(24 << 16 | 24)
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_RW	(21 << 16 | 21)
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_INTR	(19 << 16 | 19)
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_DOMAINID  (15 << 16 | 0)
#define	AMD_IOMMU_EVENT_PGTABLE_HWERR_PHYSADDR_LO	(31 << 16 | 3)

/* Illegal Command Error event bits */
#define	AMD_IOMMU_EVENT_CMDBUF_ILLEGAL_CMD_PHYS_LO	(31 << 16 | 4)

/* Command Buffer HW Error event bits */
#define	AMD_IOMMU_EVENT_CMDBUF_HWERR_TYPE	(26 << 16 | 25)
#define	AMD_IOMMU_EVENT_CMDBUF_HWERR_PHYS_LO	(31 << 16 | 4)


/* IOTLB Invalidation TO event bits */
#define	AMD_IOMMU_EVENT_IOTLB_INVAL_TO_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_IOTLB_INVAL_TO_TYPE	(26 << 16 | 25)
#define	AMD_IOMMU_EVENT_IOTLB_INVAL_TO_PHYS_LO	(31 << 16 | 4)

/* Illegal Device request event bits */
#define	AMD_IOMMU_EVENT_DEVICE_ILLEGAL_REQ_DEVICEID	(15 << 16 | 0)
#define	AMD_IOMMU_EVENT_DEVICE_ILLEGAL_REQ_TYPE		(27 << 16 | 25)
#define	AMD_IOMMU_EVENT_DEVICE_ILLEGAL_REQ_TR		(24 << 16 | 24)

#endif /* _KERNEL */

#ifdef __cplusplus
}
#endif

#endif	/* _AMD_IOMMU_LOG_H */