1 |
/* |
/* |
2 |
* Copyright (C) 2003-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2003-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: dev_dec5800.c,v 1.15 2005/02/22 06:26:10 debug Exp $ |
* $Id: dev_dec5800.c,v 1.18 2006/01/01 13:17:16 debug Exp $ |
29 |
* |
* |
30 |
* Emulation of devices found in a DECsystem 58x0, where x is the number |
* Emulation of devices found in a DECsystem 58x0, where x is the number |
31 |
* of CPUs in the system. (The CPU board is called KN5800 by Ultrix.) |
* of CPUs in the system. (The CPU board is called KN5800 by Ultrix.) |
73 |
/* |
/* |
74 |
* dev_dec5800_vectors_access(): |
* dev_dec5800_vectors_access(): |
75 |
*/ |
*/ |
76 |
int dev_dec5800_vectors_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(dec5800_vectors) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
77 |
{ |
{ |
78 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
79 |
struct dec5800_data *d = extra; |
struct dec5800_data *d = extra; |
80 |
|
|
81 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
82 |
|
idata = memory_readmax64(cpu, data, len); |
83 |
|
|
84 |
if (writeflag == MEM_READ) { |
if (writeflag == MEM_READ) { |
85 |
/* TODO */ |
/* TODO */ |
105 |
/* |
/* |
106 |
* dev_dec5800_access(): |
* dev_dec5800_access(): |
107 |
*/ |
*/ |
108 |
int dev_dec5800_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(dec5800) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
109 |
{ |
{ |
110 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
111 |
struct dec5800_data *d = extra; |
struct dec5800_data *d = extra; |
112 |
|
|
113 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
114 |
|
idata = memory_readmax64(cpu, data, len); |
115 |
|
|
116 |
/* Lowest 4 bits of csr contain cpu id: */ |
/* Lowest 4 bits of csr contain cpu id: */ |
117 |
d->csr = (d->csr & ~0xf) | (cpu->cpu_id & 0xf); |
d->csr = (d->csr & ~0xf) | (cpu->cpu_id & 0xf); |
167 |
memset(d, 0, sizeof(struct dec5800_data)); |
memset(d, 0, sizeof(struct dec5800_data)); |
168 |
|
|
169 |
memory_device_register(mem, "dec5800", baseaddr, |
memory_device_register(mem, "dec5800", baseaddr, |
170 |
DEV_DEC5800_LENGTH, dev_dec5800_access, d, MEM_DEFAULT, NULL); |
DEV_DEC5800_LENGTH, dev_dec5800_access, d, DM_DEFAULT, NULL); |
171 |
memory_device_register(mem, "dec5800_vectors", |
memory_device_register(mem, "dec5800_vectors", |
172 |
baseaddr + 0x30000000, 0x100, dev_dec5800_vectors_access, |
baseaddr + 0x30000000, 0x100, dev_dec5800_vectors_access, |
173 |
d, MEM_DEFAULT, NULL); |
d, DM_DEFAULT, NULL); |
174 |
machine_add_tickfunction(machine, dev_dec5800_tick, d, 14); |
machine_add_tickfunction(machine, dev_dec5800_tick, d, 14); |
175 |
|
|
176 |
return d; |
return d; |
190 |
/* |
/* |
191 |
* dev_decbi_access(): |
* dev_decbi_access(): |
192 |
*/ |
*/ |
193 |
int dev_decbi_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(decbi) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
194 |
{ |
{ |
195 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
196 |
int node_nr; |
int node_nr; |
197 |
struct decbi_data *d = extra; |
struct decbi_data *d = extra; |
198 |
|
|
199 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
200 |
|
idata = memory_readmax64(cpu, data, len); |
201 |
|
|
202 |
relative_addr += BI_NODESIZE; /* HACK */ |
relative_addr += BI_NODESIZE; /* HACK */ |
203 |
|
|
287 |
memset(d, 0, sizeof(struct decbi_data)); |
memset(d, 0, sizeof(struct decbi_data)); |
288 |
|
|
289 |
memory_device_register(mem, "decbi", baseaddr + 0x2000, |
memory_device_register(mem, "decbi", baseaddr + 0x2000, |
290 |
DEV_DECBI_LENGTH - 0x2000, dev_decbi_access, d, MEM_DEFAULT, NULL); |
DEV_DECBI_LENGTH - 0x2000, dev_decbi_access, d, DM_DEFAULT, NULL); |
291 |
} |
} |
292 |
|
|
293 |
|
|
306 |
/* |
/* |
307 |
* dev_deccca_access(): |
* dev_deccca_access(): |
308 |
*/ |
*/ |
309 |
int dev_deccca_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(deccca) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
310 |
{ |
{ |
311 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
312 |
/* struct deccca_data *d = extra; */ |
/* struct deccca_data *d = extra; */ |
313 |
|
|
314 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
315 |
|
idata = memory_readmax64(cpu, data, len); |
316 |
|
|
317 |
switch (relative_addr) { |
switch (relative_addr) { |
318 |
case 6: |
case 6: |
367 |
memset(d, 0, sizeof(struct deccca_data)); |
memset(d, 0, sizeof(struct deccca_data)); |
368 |
|
|
369 |
memory_device_register(mem, "deccca", baseaddr, DEV_DECCCA_LENGTH, |
memory_device_register(mem, "deccca", baseaddr, DEV_DECCCA_LENGTH, |
370 |
dev_deccca_access, d, MEM_DEFAULT, NULL); |
dev_deccca_access, d, DM_DEFAULT, NULL); |
371 |
} |
} |
372 |
|
|
373 |
|
|
388 |
/* |
/* |
389 |
* dev_decxmi_access(): |
* dev_decxmi_access(): |
390 |
*/ |
*/ |
391 |
int dev_decxmi_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(decxmi) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
392 |
{ |
{ |
393 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
394 |
int node_nr; |
int node_nr; |
395 |
struct decxmi_data *d = extra; |
struct decxmi_data *d = extra; |
396 |
|
|
397 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
398 |
|
idata = memory_readmax64(cpu, data, len); |
399 |
|
|
400 |
node_nr = relative_addr / XMI_NODESIZE; |
node_nr = relative_addr / XMI_NODESIZE; |
401 |
relative_addr &= (XMI_NODESIZE - 1); |
relative_addr &= (XMI_NODESIZE - 1); |
483 |
memset(d, 0, sizeof(struct decxmi_data)); |
memset(d, 0, sizeof(struct decxmi_data)); |
484 |
|
|
485 |
memory_device_register(mem, "decxmi", baseaddr, DEV_DECXMI_LENGTH, |
memory_device_register(mem, "decxmi", baseaddr, DEV_DECXMI_LENGTH, |
486 |
dev_decxmi_access, d, MEM_DEFAULT, NULL); |
dev_decxmi_access, d, DM_DEFAULT, NULL); |
487 |
} |
} |
488 |
|
|