Subversion Repositories HelenOS-historic

Rev

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

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