Subversion Repositories HelenOS-historic

Rev

Rev 853 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 853 Rev 1702
1
/*
1
/*
2
 * Copyright (C) 2005 Ondrej Palkovsky
2
 * Copyright (C) 2005 Ondrej Palkovsky
3
 * All rights reserved.
3
 * All rights reserved.
4
 *
4
 *
5
 * Redistribution and use in source and binary forms, with or without
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions
6
 * modification, are permitted provided that the following conditions
7
 * are met:
7
 * are met:
8
 *
8
 *
9
 * - Redistributions of source code must retain the above copyright
9
 * - Redistributions of source code must retain the above copyright
10
 *   notice, this list of conditions and the following disclaimer.
10
 *   notice, this list of conditions and the following disclaimer.
11
 * - Redistributions in binary form must reproduce the above copyright
11
 * - Redistributions in binary form must reproduce the above copyright
12
 *   notice, this list of conditions and the following disclaimer in the
12
 *   notice, this list of conditions and the following disclaimer in the
13
 *   documentation and/or other materials provided with the distribution.
13
 *   documentation and/or other materials provided with the distribution.
14
 * - The name of the author may not be used to endorse or promote products
14
 * - The name of the author may not be used to endorse or promote products
15
 *   derived from this software without specific prior written permission.
15
 *   derived from this software without specific prior written permission.
16
 *
16
 *
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
27
 */
28
 
28
 
-
 
29
 /** @addtogroup mips32
-
 
30
 * @{
-
 
31
 */
-
 
32
/** @file
-
 
33
 */
-
 
34
 
29
#ifndef __mips32_ARC_H__
35
#ifndef __mips32_ARC_H__
30
#define __mips32_ARC_H__
36
#define __mips32_ARC_H__
31
 
37
 
32
#include <arch/types.h>
38
#include <arch/types.h>
33
#include <console/chardev.h>
39
#include <console/chardev.h>
34
 
40
 
35
#define ARC_BASE_ADDR 0x1000;
41
#define ARC_BASE_ADDR 0x1000;
36
#define ARC_MAGIC 0x53435241
42
#define ARC_MAGIC 0x53435241
37
/* Frame size used by ARC */
43
/* Frame size used by ARC */
38
#define ARC_FRAME 4096
44
#define ARC_FRAME 4096
39
 
45
 
40
typedef enum {
46
typedef enum {
41
    CmResourceTypeNull = 0,
47
    CmResourceTypeNull = 0,
42
    CmResourceTypePort,
48
    CmResourceTypePort,
43
    CmResourceTypeInterrupt,
49
    CmResourceTypeInterrupt,
44
    CmResourceTypeMemory,
50
    CmResourceTypeMemory,
45
    CmResourceTypeDma,
51
    CmResourceTypeDma,
46
    CmResourceTypeDeviceSpecific,
52
    CmResourceTypeDeviceSpecific,
47
    CmResourceTypeVendor,
53
    CmResourceTypeVendor,
48
    CmResourceTypeProductName,
54
    CmResourceTypeProductName,
49
    CmResourceTypeSerialNumber
55
    CmResourceTypeSerialNumber
50
}cm_resource_type;
56
}cm_resource_type;
51
 
57
 
52
typedef struct {
58
typedef struct {
53
    __u8 type;
59
    __u8 type;
54
    __u8 sharedisposition;
60
    __u8 sharedisposition;
55
    __u16 flags;
61
    __u16 flags;
56
    union {
62
    union {
57
        struct {
63
        struct {
58
            long long start; /* 64-bit phys address */
64
            long long start; /* 64-bit phys address */
59
            unsigned long length;
65
            unsigned long length;
60
        }port;
66
        }port;
61
        struct {
67
        struct {
62
            unsigned long level;
68
            unsigned long level;
63
            unsigned long vector;
69
            unsigned long vector;
64
            unsigned long reserved1;
70
            unsigned long reserved1;
65
        }interrupt;
71
        }interrupt;
66
        struct {
72
        struct {
67
            long long start; /* 64-bit phys address */
73
            long long start; /* 64-bit phys address */
68
            unsigned long length;
74
            unsigned long length;
69
        }memory;
75
        }memory;
70
    }u;
76
    }u;
71
}__attribute__ ((packed)) cm_resource_descriptor;
77
}__attribute__ ((packed)) cm_resource_descriptor;
72
 
78
 
73
typedef struct {
79
typedef struct {
74
    __u16 version;
80
    __u16 version;
75
    __u16 revision;
81
    __u16 revision;
76
    unsigned long count;
82
    unsigned long count;
77
    cm_resource_descriptor descr[1];
83
    cm_resource_descriptor descr[1];
78
}__attribute__ ((packed)) cm_resource_list;
84
}__attribute__ ((packed)) cm_resource_list;
79
 
85
 
80
typedef enum {
86
typedef enum {
81
    SystemClass = 0,
87
    SystemClass = 0,
82
    ProcessorClass,
88
    ProcessorClass,
83
    CacheClass,
89
    CacheClass,
84
    AdapterClass,
90
    AdapterClass,
85
    ControllerClass,
91
    ControllerClass,
86
    PeripheralClass,
92
    PeripheralClass,
87
    MemoryClass
93
    MemoryClass
88
} arc_component_class;
94
} arc_component_class;
89
 
95
 
90
typedef enum {
96
typedef enum {
91
    ARC_type = 0,
97
    ARC_type = 0,
92
    CPU_type,
98
    CPU_type,
93
    FPU_type,
99
    FPU_type,
94
    PrimaryICache,
100
    PrimaryICache,
95
    PrimaryDCache,
101
    PrimaryDCache,
96
    SecondaryICache,
102
    SecondaryICache,
97
    SecondaryDCache,
103
    SecondaryDCache,
98
    SecondaryCache,
104
    SecondaryCache,
99
    Memory, /* Not in NT PROM */
105
    Memory, /* Not in NT PROM */
100
    EISAAdapter,
106
    EISAAdapter,
101
    TCAdapter,
107
    TCAdapter,
102
    SCSIAdapter,
108
    SCSIAdapter,
103
    DTIAdapter,
109
    DTIAdapter,
104
    MultiFunctionAdapter,
110
    MultiFunctionAdapter,
105
    DiskController,
111
    DiskController,
106
    TapeController,
112
    TapeController,
107
    CDROMController,
113
    CDROMController,
108
    WORMController,
114
    WORMController,
109
    SerialController,
115
    SerialController,
110
    NetworkController,
116
    NetworkController,
111
    DisplayController,
117
    DisplayController,
112
    ParallelController,
118
    ParallelController,
113
    PointerController,
119
    PointerController,
114
    KeyboardController,
120
    KeyboardController,
115
    AudioController,
121
    AudioController,
116
    OtherController,
122
    OtherController,
117
    DiskPeripheral,
123
    DiskPeripheral,
118
    FloppyDiskPeripheral,
124
    FloppyDiskPeripheral,
119
    TapePeripheral,
125
    TapePeripheral,
120
    ModemPeripheral,
126
    ModemPeripheral,
121
    MonitorPeripheral,
127
    MonitorPeripheral,
122
    PrinterPeripheral,
128
    PrinterPeripheral,
123
    PointerPeripheral,
129
    PointerPeripheral,
124
    KeyboardPeripheral,
130
    KeyboardPeripheral,
125
    TerminalPeripheral,
131
    TerminalPeripheral,
126
    LinePeripheral,
132
    LinePeripheral,
127
    NetworkPeripheral,
133
    NetworkPeripheral,
128
    OtherPeripheral,
134
    OtherPeripheral,
129
    XTalkAdapter,
135
    XTalkAdapter,
130
    PCIAdapter,
136
    PCIAdapter,
131
    GIOAdapter,
137
    GIOAdapter,
132
    TPUAdapter,
138
    TPUAdapter,
133
    Anonymous
139
    Anonymous
134
}arc_component_type;
140
}arc_component_type;
135
 
141
 
136
typedef enum {
142
typedef enum {
137
    Failed = 1,
143
    Failed = 1,
138
    ReadOnly = 2,
144
    ReadOnly = 2,
139
    Removable = 4,
145
    Removable = 4,
140
    ConsoleIn = 8,
146
    ConsoleIn = 8,
141
    ConsoleOut = 16,
147
    ConsoleOut = 16,
142
    Input = 32,
148
    Input = 32,
143
    Output = 64
149
    Output = 64
144
}arc_component_flags;
150
}arc_component_flags;
145
 
151
 
146
typedef struct  {
152
typedef struct  {
147
    arc_component_class class;
153
    arc_component_class class;
148
    arc_component_type type;
154
    arc_component_type type;
149
    arc_component_flags flags;
155
    arc_component_flags flags;
150
    __u16 revision;
156
    __u16 revision;
151
    __u16 version;
157
    __u16 version;
152
    __u32 key;
158
    __u32 key;
153
    __u32 affinitymask;
159
    __u32 affinitymask;
154
    __u32 configdatasize;
160
    __u32 configdatasize;
155
    __u32 identifier_len;
161
    __u32 identifier_len;
156
    char *identifier;
162
    char *identifier;
157
} __attribute__ ((packed)) arc_component;
163
} __attribute__ ((packed)) arc_component;
158
 
164
 
159
typedef struct {
165
typedef struct {
160
    __u16 year;
166
    __u16 year;
161
    __u16 month;
167
    __u16 month;
162
    __u16 day;
168
    __u16 day;
163
    __u16 hour;
169
    __u16 hour;
164
    __u16 minutes;
170
    __u16 minutes;
165
    __u16 seconds;
171
    __u16 seconds;
166
    __u16 mseconds;
172
    __u16 mseconds;
167
} __attribute__ ((packed)) arc_timeinfo;
173
} __attribute__ ((packed)) arc_timeinfo;
168
 
174
 
169
/* This is the SGI block structure, WinNT has it different */
175
/* This is the SGI block structure, WinNT has it different */
170
typedef enum {
176
typedef enum {
171
    ExceptionBlock,
177
    ExceptionBlock,
172
    SystemParameterBlock,
178
    SystemParameterBlock,
173
    FreeContiguous,
179
    FreeContiguous,
174
    FreeMemory,
180
    FreeMemory,
175
    BadMemory,
181
    BadMemory,
176
    LoadedProgram,
182
    LoadedProgram,
177
    FirmwareTemporary,
183
    FirmwareTemporary,
178
    FirmwarePermanent
184
    FirmwarePermanent
179
}arc_memorytype_t;
185
}arc_memorytype_t;
180
 
186
 
181
typedef struct  {
187
typedef struct  {
182
    arc_memorytype_t type;
188
    arc_memorytype_t type;
183
    __u32 basepage;  /* *4096 = baseaddr */
189
    __u32 basepage;  /* *4096 = baseaddr */
184
    __u32 basecount;
190
    __u32 basecount;
185
}arc_memdescriptor_t;
191
}arc_memdescriptor_t;
186
 
192
 
187
typedef struct {
193
typedef struct {
188
    char vendorid[8];
194
    char vendorid[8];
189
    char prodid[8];
195
    char prodid[8];
190
}arc_sysid_t;
196
}arc_sysid_t;
191
 
197
 
192
typedef struct {
198
typedef struct {
193
    long (*load)(void); /* ... */
199
    long (*load)(void); /* ... */
194
    long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
200
    long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
195
               char **envp);
201
               char **envp);
196
    long (*execute)(char *path,__u32 argc,char **argv,char **envp);
202
    long (*execute)(char *path,__u32 argc,char **argv,char **envp);
197
    void (*halt)(void);
203
    void (*halt)(void);
198
    void (*powerdown)(void);
204
    void (*powerdown)(void);
199
    void (*restart)(void);
205
    void (*restart)(void);
200
    void (*reboot)(void);
206
    void (*reboot)(void);
201
    void (*enterinteractivemode)(void);
207
    void (*enterinteractivemode)(void);
202
    long (*reserved)(void);
208
    long (*reserved)(void);
203
/* 10 */   
209
/* 10 */   
204
    arc_component * (*getpeer)(arc_component *c);
210
    arc_component * (*getpeer)(arc_component *c);
205
    arc_component * (*getchild)(arc_component *c);
211
    arc_component * (*getchild)(arc_component *c);
206
    arc_component * (*getparent)(arc_component *c);
212
    arc_component * (*getparent)(arc_component *c);
207
    long (*getconfigurationdata)(void *configdata, arc_component *c);
213
    long (*getconfigurationdata)(void *configdata, arc_component *c);
208
    long (*addchild)(arc_component *c, arc_component *template,
214
    long (*addchild)(arc_component *c, arc_component *template,
209
             void *configdata);
215
             void *configdata);
210
    long (*deletecomponet)(arc_component *current);
216
    long (*deletecomponet)(arc_component *current);
211
    long (*getcomponent)(char *path);
217
    long (*getcomponent)(char *path);
212
    long (*saveconfiguration)(void);
218
    long (*saveconfiguration)(void);
213
    arc_sysid_t (*getsystemid)(void);
219
    arc_sysid_t (*getsystemid)(void);
214
    arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
220
    arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
215
/* 20 */
221
/* 20 */
216
    long (*reserved2)(void);
222
    long (*reserved2)(void);
217
    arc_timeinfo * (*gettime)(void);
223
    arc_timeinfo * (*gettime)(void);
218
    __u32 (*getrelativetime)(void);
224
    __u32 (*getrelativetime)(void);
219
    long (*getdirectoryentry)();
225
    long (*getdirectoryentry)();
220
    long (*open)(void); /* ... */
226
    long (*open)(void); /* ... */
221
    long (*close)(__u32 fileid);
227
    long (*close)(__u32 fileid);
222
    long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
228
    long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
223
    long (*getreadstatus)(__u32 fileid);
229
    long (*getreadstatus)(__u32 fileid);
224
    long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
230
    long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
225
    long (*seek)(void); /* ... */
231
    long (*seek)(void); /* ... */
226
/* 30 */
232
/* 30 */
227
    long (*mount)(void); /* ... */
233
    long (*mount)(void); /* ... */
228
    char * (*getenvironmentvariable)(char *name);
234
    char * (*getenvironmentvariable)(char *name);
229
    char * (*setenvironmentvariable)(char *name, char *value);
235
    char * (*setenvironmentvariable)(char *name, char *value);
230
    long (*getfileinformation)(void); /* ... */
236
    long (*getfileinformation)(void); /* ... */
231
    long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
237
    long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
232
    void (*flushallcaches)(void);
238
    void (*flushallcaches)(void);
233
    long (*testunicodecharacter)(void); /* ... */
239
    long (*testunicodecharacter)(void); /* ... */
234
    long (*getdisplaystatus)(void); /* ... */
240
    long (*getdisplaystatus)(void); /* ... */
235
} arc_func_vector_t;
241
} arc_func_vector_t;
236
 
242
 
237
typedef struct {
243
typedef struct {
238
    __u32 signature;
244
    __u32 signature;
239
    __u32 length;
245
    __u32 length;
240
    __u16 version;
246
    __u16 version;
241
    __u16 revision;
247
    __u16 revision;
242
    void *restartblock;
248
    void *restartblock;
243
    void *debugblock;
249
    void *debugblock;
244
    void *gevector;
250
    void *gevector;
245
    void *utlbmissvector;
251
    void *utlbmissvector;
246
    __u32 firmwarevectorlen;
252
    __u32 firmwarevectorlen;
247
    arc_func_vector_t *firmwarevector;
253
    arc_func_vector_t *firmwarevector;
248
    __u32 privvectorlen;
254
    __u32 privvectorlen;
249
    void *privvector;
255
    void *privvector;
250
    __u32 adaptercount;
256
    __u32 adaptercount;
251
}__attribute__ ((packed)) arc_sbp;
257
}__attribute__ ((packed)) arc_sbp;
252
 
258
 
253
extern int arc_init(void);
259
extern int arc_init(void);
254
extern int arc_enabled(void);
260
extern int arc_enabled(void);
255
void arc_frame_init(void);
261
void arc_frame_init(void);
256
void arc_console(void);
262
void arc_console(void);
257
 
263
 
258
#endif
264
#endif
-
 
265
 
-
 
266
 /** @}
-
 
267
 */
-
 
268
 
259
 
269