summaryrefslogtreecommitdiffstats
path: root/arch/ia64/sn/io/sgi_io_sim.c
blob: 41ce62d5126fc7ff2342bc9ef7132811aabb514d (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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
/* $Id$
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
 * Copyright (C) 2000 by Colin Ngam
 */

#include <linux/types.h>
#include <asm/sn/sgi.h>
#include <asm/sn/agent.h>
#include <asm/sn/klconfig.h>
#include <asm/sn/module.h>
#include <asm/sn/nic.h>
#include <asm/sn/sn_private.h>
#include <asm/sn/synergy.h>

cnodeid_t nasid_to_compact_node[MAX_NASIDS];
nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
cnodeid_t cpuid_to_compact_node[MAXCPUS];
cpuid_t         master_procid = 0;
int maxnodes;
char arg_maxnodes[4];

nodepda_t       *Nodepdaindr[MAX_COMPACT_NODES];
nodepda_t        *nodepda;
subnode_pda_t    *subnodepda;

synergy_da_t	*Synergy_da_indr[MAX_COMPACT_NODES * 2];

extern void init_all_devices(void);


/*
 * Return non-zero if the given variable was specified
 */
int
is_specified(char *s)
{
        return (strlen(s) != 0);
}


void pciba_init(void)
{
	FIXME("pciba_init : no-op\n");
}

void xbmon_init(void)
{
	FIXME("xbmon_init : no-op\n");

}

void pciiox_init(void)
{
	FIXME("pciiox_init : no-op\n");

}

void usrpci_init(void)
{
	FIXME("usrpci_init : no-op\n");

}

void ioc3_init(void)
{
	FIXME("ioc3_init : no-op\n");

}

void initialize_io(void)
{

	init_all_devices();
}

/*
 * Routines provided by ml/SN/promif.c.
 */
static __psunsigned_t master_bridge_base = (__psunsigned_t)NULL;
static nasid_t console_nasid;
static char console_wid;
static char console_pcislot;

void
set_master_bridge_base(void)
{

#ifdef SIMULATED_KLGRAPH
	printk("set_master_bridge_base: SIMULATED_KLGRAPH FIXME hardwired master.\n");
	console_nasid = 0;
	console_wid = 0x8;
	console_pcislot = 0x2;
#else
        console_nasid = KL_CONFIG_CH_CONS_INFO(master_nasid)->nasid;
        console_wid = WIDGETID_GET(KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base);
        console_pcislot = KL_CONFIG_CH_CONS_INFO(master_nasid)->npci;
#endif /* SIMULATED_KLGRAPH */

        master_bridge_base = (__psunsigned_t)NODE_SWIN_BASE(console_nasid,
                                                            console_wid);
}

int
check_nasid_equiv(nasid_t nasida, nasid_t nasidb)
{
        if ((nasida == nasidb) ||
            (nasida == NODEPDA(NASID_TO_COMPACT_NODEID(nasidb))->xbow_peer))
                return 1;
        else
                return 0;
}

int
is_master_nasid_widget(nasid_t test_nasid, xwidgetnum_t test_wid)
{

        /*
         * If the widget numbers are different, we're not the master.
         */
        if (test_wid != (xwidgetnum_t)console_wid)
                return 0;

        /*
         * If the NASIDs are the same or equivalent, we're the master.
         */
        if (check_nasid_equiv(test_nasid, console_nasid)) {
                return 1;
        } else {
                return 0;
        }
}

cnodeid_t
nasid_to_compact_nodeid(nasid_t nasid)
{
        ASSERT(nasid >= 0 && nasid < MAX_NASIDS);
        return nasid_to_compact_node[nasid];
}

nasid_t
compact_to_nasid_nodeid(cnodeid_t cnode)
{
        ASSERT(cnode >= 0 && cnode <= MAX_COMPACT_NODES);
        ASSERT(compact_to_nasid_node[cnode] >= 0);
        return compact_to_nasid_node[cnode];
}

/*
 * Routines provided by ml/SN/nvram.c
 */
void
nvram_baseinit(void)
{
	FIXME("nvram_baseinit : no-op\n");

}