Subversion Repositories HelenOS-historic

Rev

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

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