Subversion Repositories HelenOS-historic

Rev

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

Rev 606 Rev 853
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
#ifndef __mips32_ARC_H__
29
#ifndef __mips32_ARC_H__
30
#define __mips32_ARC_H__
30
#define __mips32_ARC_H__
31
 
31
 
32
#include <arch/types.h>
32
#include <arch/types.h>
33
#include <console/chardev.h>
33
#include <console/chardev.h>
34
 
34
 
35
#define ARC_BASE_ADDR 0x1000;
35
#define ARC_BASE_ADDR 0x1000;
36
#define ARC_MAGIC 0x53435241
36
#define ARC_MAGIC 0x53435241
37
/* Frame size used by ARC */
37
/* Frame size used by ARC */
38
#define ARC_FRAME 4096
38
#define ARC_FRAME 4096
39
 
39
 
40
typedef enum {
40
typedef enum {
-
 
41
    CmResourceTypeNull = 0,
-
 
42
    CmResourceTypePort,
-
 
43
    CmResourceTypeInterrupt,
-
 
44
    CmResourceTypeMemory,
-
 
45
    CmResourceTypeDma,
-
 
46
    CmResourceTypeDeviceSpecific,
-
 
47
    CmResourceTypeVendor,
-
 
48
    CmResourceTypeProductName,
-
 
49
    CmResourceTypeSerialNumber
-
 
50
}cm_resource_type;
-
 
51
 
-
 
52
typedef struct {
-
 
53
    __u8 type;
-
 
54
    __u8 sharedisposition;
-
 
55
    __u16 flags;
-
 
56
    union {
-
 
57
        struct {
-
 
58
            long long start; /* 64-bit phys address */
-
 
59
            unsigned long length;
-
 
60
        }port;
-
 
61
        struct {
-
 
62
            unsigned long level;
-
 
63
            unsigned long vector;
-
 
64
            unsigned long reserved1;
-
 
65
        }interrupt;
-
 
66
        struct {
-
 
67
            long long start; /* 64-bit phys address */
-
 
68
            unsigned long length;
-
 
69
        }memory;
-
 
70
    }u;
-
 
71
}__attribute__ ((packed)) cm_resource_descriptor;
-
 
72
 
-
 
73
typedef struct {
-
 
74
    __u16 version;
-
 
75
    __u16 revision;
-
 
76
    unsigned long count;
-
 
77
    cm_resource_descriptor descr[1];
-
 
78
}__attribute__ ((packed)) cm_resource_list;
-
 
79
 
-
 
80
typedef enum {
41
    SystemClass = 0,
81
    SystemClass = 0,
42
    ProcessorClass,
82
    ProcessorClass,
43
    CacheClass,
83
    CacheClass,
44
    AdapterClass,
84
    AdapterClass,
45
    ControllerClass,
85
    ControllerClass,
46
    PeripheralClass,
86
    PeripheralClass,
47
    MemoryClass
87
    MemoryClass
48
} arc_component_class;
88
} arc_component_class;
49
 
89
 
50
typedef enum {
90
typedef enum {
51
    ARC_type = 0,
91
    ARC_type = 0,
52
    CPU_type,
92
    CPU_type,
53
    FPU_type,
93
    FPU_type,
54
    PrimaryICache,
94
    PrimaryICache,
55
    PrimaryDCache,
95
    PrimaryDCache,
56
    SecondaryICache,
96
    SecondaryICache,
57
    SecondaryDCache,
97
    SecondaryDCache,
58
    SecondaryCache,
98
    SecondaryCache,
59
    Memory, /* Not in NT PROM */
99
    Memory, /* Not in NT PROM */
60
    EISAAdapter,
100
    EISAAdapter,
61
    TCAdapter,
101
    TCAdapter,
62
    SCSIAdapter,
102
    SCSIAdapter,
63
    DTIAdapter,
103
    DTIAdapter,
64
    MultiFunctionAdapter,
104
    MultiFunctionAdapter,
65
    DiskController,
105
    DiskController,
66
    TapeController,
106
    TapeController,
67
    CDROMController,
107
    CDROMController,
68
    WORMController,
108
    WORMController,
69
    SerialController,
109
    SerialController,
70
    NetworkController,
110
    NetworkController,
71
    DisplayController,
111
    DisplayController,
72
    ParallelController,
112
    ParallelController,
73
    PointerController,
113
    PointerController,
74
    KeyboardController,
114
    KeyboardController,
75
    AudioController,
115
    AudioController,
76
    OtherController,
116
    OtherController,
77
    DiskPeripheral,
117
    DiskPeripheral,
78
    FloppyDiskPeripheral,
118
    FloppyDiskPeripheral,
79
    TapePeripheral,
119
    TapePeripheral,
80
    ModemPeripheral,
120
    ModemPeripheral,
81
    MonitorPeripheral,
121
    MonitorPeripheral,
82
    PrinterPeripheral,
122
    PrinterPeripheral,
83
    PointerPeripheral,
123
    PointerPeripheral,
84
    KeyboardPeripheral,
124
    KeyboardPeripheral,
85
    TerminalPeripheral,
125
    TerminalPeripheral,
86
    LinePeripheral,
126
    LinePeripheral,
87
    NetworkPeripheral,
127
    NetworkPeripheral,
88
    OtherPeripheral,
128
    OtherPeripheral,
89
    XTalkAdapter,
129
    XTalkAdapter,
90
    PCIAdapter,
130
    PCIAdapter,
91
    GIOAdapter,
131
    GIOAdapter,
92
    TPUAdapter,
132
    TPUAdapter,
93
    Anonymous
133
    Anonymous
94
}arc_component_type;
134
}arc_component_type;
95
 
135
 
96
typedef enum {
136
typedef enum {
97
    Failed = 1,
137
    Failed = 1,
98
    ReadOnly = 2,
138
    ReadOnly = 2,
99
    Removable = 4,
139
    Removable = 4,
100
    ConsoleIn = 8,
140
    ConsoleIn = 8,
101
    ConsoleOut = 16,
141
    ConsoleOut = 16,
102
    Input = 32,
142
    Input = 32,
103
    Output = 64
143
    Output = 64
104
}arc_component_flags;
144
}arc_component_flags;
105
 
145
 
106
typedef struct  {
146
typedef struct  {
107
    arc_component_class class;
147
    arc_component_class class;
108
    arc_component_type type;
148
    arc_component_type type;
109
    arc_component_flags flags;
149
    arc_component_flags flags;
110
    __u16 revision;
150
    __u16 revision;
111
    __u16 version;
151
    __u16 version;
112
    __u32 key;
152
    __u32 key;
113
    __u32 affinitymask;
153
    __u32 affinitymask;
114
    __u32 configdatasize;
154
    __u32 configdatasize;
115
    __u32 identifier_len;
155
    __u32 identifier_len;
116
    char *identifier;
156
    char *identifier;
117
} __attribute__ ((packed)) arc_component;
157
} __attribute__ ((packed)) arc_component;
118
 
158
 
119
typedef struct {
159
typedef struct {
120
    __u16 year;
160
    __u16 year;
121
    __u16 month;
161
    __u16 month;
122
    __u16 day;
162
    __u16 day;
123
    __u16 hour;
163
    __u16 hour;
124
    __u16 minutes;
164
    __u16 minutes;
125
    __u16 seconds;
165
    __u16 seconds;
126
    __u16 mseconds;
166
    __u16 mseconds;
127
} __attribute__ ((packed)) arc_timeinfo;
167
} __attribute__ ((packed)) arc_timeinfo;
128
 
168
 
129
/* This is the SGI block structure, WinNT has it different */
169
/* This is the SGI block structure, WinNT has it different */
130
typedef enum {
170
typedef enum {
131
    ExceptionBlock,
171
    ExceptionBlock,
132
    SystemParameterBlock,
172
    SystemParameterBlock,
133
    FreeContiguous,
173
    FreeContiguous,
134
    FreeMemory,
174
    FreeMemory,
135
    BadMemory,
175
    BadMemory,
136
    LoadedProgram,
176
    LoadedProgram,
137
    FirmwareTemporary,
177
    FirmwareTemporary,
138
    FirmwarePermanent
178
    FirmwarePermanent
139
}arc_memorytype_t;
179
}arc_memorytype_t;
140
 
180
 
141
typedef struct  {
181
typedef struct  {
142
    arc_memorytype_t type;
182
    arc_memorytype_t type;
143
    __u32 basepage;  /* *4096 = baseaddr */
183
    __u32 basepage;  /* *4096 = baseaddr */
144
    __u32 basecount;
184
    __u32 basecount;
145
}arc_memdescriptor_t;
185
}arc_memdescriptor_t;
146
 
186
 
147
typedef struct {
187
typedef struct {
148
    char vendorid[8];
188
    char vendorid[8];
149
    char prodid[8];
189
    char prodid[8];
150
}arc_sysid_t;
190
}arc_sysid_t;
151
 
191
 
152
typedef struct {
192
typedef struct {
153
    long (*load)(void); /* ... */
193
    long (*load)(void); /* ... */
154
    long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
194
    long (*invoke)(__u32 eaddr,__u32 saddr,__u32 argc,char **argv,
155
               char **envp);
195
               char **envp);
156
    long (*execute)(char *path,__u32 argc,char **argv,char **envp);
196
    long (*execute)(char *path,__u32 argc,char **argv,char **envp);
157
    void (*halt)(void);
197
    void (*halt)(void);
158
    void (*powerdown)(void);
198
    void (*powerdown)(void);
159
    void (*restart)(void);
199
    void (*restart)(void);
160
    void (*reboot)(void);
200
    void (*reboot)(void);
161
    void (*enterinteractivemode)(void);
201
    void (*enterinteractivemode)(void);
162
    long (*reserved)(void);
202
    long (*reserved)(void);
163
/* 10 */   
203
/* 10 */   
164
    arc_component * (*getpeer)(arc_component *c);
204
    arc_component * (*getpeer)(arc_component *c);
165
    arc_component * (*getchild)(arc_component *c);
205
    arc_component * (*getchild)(arc_component *c);
166
    arc_component * (*getparent)(arc_component *c);
206
    arc_component * (*getparent)(arc_component *c);
167
    long (*getconfigurationdata)(void *configdata, arc_component *c);
207
    long (*getconfigurationdata)(void *configdata, arc_component *c);
168
    long (*addchild)(arc_component *c, arc_component *template,
208
    long (*addchild)(arc_component *c, arc_component *template,
169
             void *configdata);
209
             void *configdata);
170
    long (*deletecomponet)(arc_component *current);
210
    long (*deletecomponet)(arc_component *current);
171
    long (*getcomponent)(char *path);
211
    long (*getcomponent)(char *path);
172
    long (*saveconfiguration)(void);
212
    long (*saveconfiguration)(void);
173
    arc_sysid_t (*getsystemid)(void);
213
    arc_sysid_t (*getsystemid)(void);
174
    arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
214
    arc_memdescriptor_t * (*getmemorydescriptor)(arc_memdescriptor_t *cur);
175
/* 20 */
215
/* 20 */
176
    long (*reserved2)(void);
216
    long (*reserved2)(void);
177
    arc_timeinfo * (*gettime)(void);
217
    arc_timeinfo * (*gettime)(void);
178
    __u32 (*getrelativetime)(void);
218
    __u32 (*getrelativetime)(void);
179
    long (*getdirectoryentry)();
219
    long (*getdirectoryentry)();
180
    long (*open)(void); /* ... */
220
    long (*open)(void); /* ... */
181
    long (*close)(__u32 fileid);
221
    long (*close)(__u32 fileid);
182
    long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
222
    long (*read)(__u32 fileid,void *buf,__u32 n,__u32 *cnt);
183
    long (*getreadstatus)(__u32 fileid);
223
    long (*getreadstatus)(__u32 fileid);
184
    long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
224
    long (*write)(__u32 fileid, void *buf,__u32 n,__u32 *cnt);
185
    long (*seek)(void); /* ... */
225
    long (*seek)(void); /* ... */
186
/* 30 */
226
/* 30 */
187
    long (*mount)(void); /* ... */
227
    long (*mount)(void); /* ... */
188
    char * (*getenvironmentvariable)(char *name);
228
    char * (*getenvironmentvariable)(char *name);
189
    char * (*setenvironmentvariable)(char *name, char *value);
229
    char * (*setenvironmentvariable)(char *name, char *value);
190
    long (*getfileinformation)(void); /* ... */
230
    long (*getfileinformation)(void); /* ... */
191
    long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
231
    long (*setfileinformation)(__u32 fileid,__u32 attflags,__u32 attmask);
192
    void (*flushallcaches)(void);
232
    void (*flushallcaches)(void);
193
    long (*testunicodecharacter)(void); /* ... */
233
    long (*testunicodecharacter)(void); /* ... */
194
    long (*getdisplaystatus)(void); /* ... */
234
    long (*getdisplaystatus)(void); /* ... */
195
} arc_func_vector_t;
235
} arc_func_vector_t;
196
 
236
 
197
typedef struct {
237
typedef struct {
198
    __u32 signature;
238
    __u32 signature;
199
    __u32 length;
239
    __u32 length;
200
    __u16 version;
240
    __u16 version;
201
    __u16 revision;
241
    __u16 revision;
202
    void *restartblock;
242
    void *restartblock;
203
    void *debugblock;
243
    void *debugblock;
204
    void *gevector;
244
    void *gevector;
205
    void *utlbmissvector;
245
    void *utlbmissvector;
206
    __u32 firmwarevectorlen;
246
    __u32 firmwarevectorlen;
207
    arc_func_vector_t *firmwarevector;
247
    arc_func_vector_t *firmwarevector;
208
    __u32 privvectorlen;
248
    __u32 privvectorlen;
209
    void *privvector;
249
    void *privvector;
210
    __u32 adaptercount;
250
    __u32 adaptercount;
211
}__attribute__ ((packed)) arc_sbp;
251
}__attribute__ ((packed)) arc_sbp;
212
 
252
 
213
extern int arc_init(void);
253
extern int arc_init(void);
214
extern void arc_print_memory_map(void);
-
 
215
extern int arc_enabled(void);
254
extern int arc_enabled(void);
216
extern void arc_print_devices(void);
-
 
217
void arc_frame_init(void);
255
void arc_frame_init(void);
218
void arc_console(void);
256
void arc_console(void);
219
 
257
 
220
#endif
258
#endif
221
 
259