Subversion Repositories HelenOS-historic

Rev

Rev 853 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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