Subversion Repositories HelenOS-historic

Rev

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

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