aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/gcc/Make-lang.in.in
blob: 6f6fd88720ab266e861f2c841ec64b94fb41c1ed (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
117
118
119
generated by cgit v1.2.3 (git 2.25.1) at 2025-11-11 18:56:09 +0000
 


{ color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */
.highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */
.highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */
.highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */
.highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */
.highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */
.highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */
.highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */
.highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */
.highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */
.highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */
.highlight .vc { color: #336699 } /* Name.Variable.Class */
.highlight .vg { color: #dd7700 } /* Name.Variable.Global */
.highlight .vi { color: #3333bb } /* Name.Variable.Instance */
.highlight .vm { color: #336699 } /* Name.Variable.Magic */
.highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * Copyright (C) IBM Corp. 2005
 *
 * Authors: Jimi Xenidis <jimix@watson.ibm.com>
 */

#undef DEBUG

#include <xen/config.h>
#include <xen/types.h>
#include <xen/sched.h>
#include <xen/init.h>
#include <xen/mm.h>
#include <asm/current.h>
#include <asm/papr.h>
#include <asm/hcalls.h>
#include <public/xen.h>
#include "tce.h"
#include "iommu.h"

#ifdef DEBUG
#define DBG(fmt...) printk(fmt)
#else
#define DBG(fmt...)
#endif

struct iommu_funcs {
    int (*iommu_put)(ulong, union tce);
};

/* individual host bridges */
static struct iommu_funcs iommu_phbs[16];
static u32 iommu_phbs_num = ARRAY_SIZE(iommu_phbs);

int iommu_put(u32 buid, ulong ioba, union tce tce)
{
    struct vcpu *v = get_current();
    struct domain *d = v->domain;

    if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put != NULL) {
        ulong gmfn;
        ulong mfn;
        int mtype;

        gmfn = tce.tce_bits.tce_rpn;

        
        mfn = pfn2mfn(d, gmfn, &mtype);
        if (mfn != INVALID_MFN) {
            switch (mtype) {
            case PFN_TYPE_RMA:
            case PFN_TYPE_LOGICAL:
                break;
            case PFN_TYPE_FOREIGN:
                DBG("%s: assigning to Foriegn page: "
                    "gmfn: 0x%lx mfn: 0x%lx\n",  __func__, gmfn, mfn);
                break;
            default:
                printk("%s: unsupported type[%d]: gmfn: 0x%lx mfn: 0x%lx\n",
                       __func__, mtype, gmfn, mfn);
                return -1;
            break;
            }
            DBG("%s: ioba=0x%lx gmfn=0x%lx mfn=0x%lx\n", __func__,
                ioba, gmfn, mfn);
            tce.tce_bits.tce_rpn = mfn;
            return iommu_phbs[buid].iommu_put(ioba, tce);
        }
    }
    return -1;
}

int iommu_register(u32 buid, int (*put)(ulong ioba, union tce ltce))
{

    if (buid < iommu_phbs_num && iommu_phbs[buid].iommu_put == NULL) {
        iommu_phbs[0].iommu_put = put;
        return 0;
    }
    panic("bad IOMMU registration\n");
    return -1;
}