1 |
/* |
/* |
2 |
* Copyright (C) 2004-2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2004-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_sgi_ip22.c,v 1.25 2005/10/26 14:37:04 debug Exp $ |
* $Id: dev_sgi_ip22.c,v 1.28 2006/03/04 12:38:48 debug Exp $ |
29 |
* |
* |
30 |
* SGI IP22 stuff. |
* SGI IP22 stuff. |
31 |
*/ |
*/ |
63 |
* |
* |
64 |
* The memory controller (?). |
* The memory controller (?). |
65 |
*/ |
*/ |
66 |
int dev_sgi_ip22_imc_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(sgi_ip22_imc) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
67 |
{ |
{ |
68 |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
69 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
167 |
* |
* |
168 |
* A so far unknown device, used by the IP22 prom during startup. |
* A so far unknown device, used by the IP22 prom during startup. |
169 |
*/ |
*/ |
170 |
int dev_sgi_ip22_unknown_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(sgi_ip22_unknown) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
171 |
{ |
{ |
172 |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
173 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
210 |
* |
* |
211 |
* A so far unknown device, used by the IP22 prom during startup. |
* A so far unknown device, used by the IP22 prom during startup. |
212 |
*/ |
*/ |
213 |
int dev_sgi_ip22_unknown2_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(sgi_ip22_unknown2) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
214 |
{ |
{ |
215 |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
216 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
247 |
/* |
/* |
248 |
* dev_sgi_ip22_sysid_access(): |
* dev_sgi_ip22_sysid_access(): |
249 |
*/ |
*/ |
250 |
int dev_sgi_ip22_sysid_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(sgi_ip22_sysid) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
251 |
{ |
{ |
252 |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
253 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
283 |
|
|
284 |
/* |
/* |
285 |
* dev_sgi_ip22_access(): |
* dev_sgi_ip22_access(): |
|
* |
|
|
* Returns 1 if ok, 0 on error. |
|
286 |
*/ |
*/ |
287 |
int dev_sgi_ip22_access(struct cpu *cpu, struct memory *mem, |
DEVICE_ACCESS(sgi_ip22) |
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
288 |
{ |
{ |
289 |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
struct sgi_ip22_data *d = (struct sgi_ip22_data *) extra; |
290 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
424 |
d->guiness_flag = guiness_flag; |
d->guiness_flag = guiness_flag; |
425 |
|
|
426 |
memory_device_register(mem, "sgi_ip22", baseaddr, DEV_SGI_IP22_LENGTH, |
memory_device_register(mem, "sgi_ip22", baseaddr, DEV_SGI_IP22_LENGTH, |
427 |
dev_sgi_ip22_access, (void *)d, MEM_DEFAULT, NULL); |
dev_sgi_ip22_access, (void *)d, DM_DEFAULT, NULL); |
428 |
memory_device_register(mem, "sgi_ip22_sysid", 0x1fbd9858, 0x8, |
memory_device_register(mem, "sgi_ip22_sysid", 0x1fbd9858, 0x8, |
429 |
dev_sgi_ip22_sysid_access, (void *)d, MEM_DEFAULT, NULL); |
dev_sgi_ip22_sysid_access, (void *)d, DM_DEFAULT, NULL); |
430 |
memory_device_register(mem, "sgi_ip22_imc", IP22_IMC_BASE, |
memory_device_register(mem, "sgi_ip22_imc", IP22_IMC_BASE, |
431 |
DEV_SGI_IP22_IMC_LENGTH, dev_sgi_ip22_imc_access, (void *)d, |
DEV_SGI_IP22_IMC_LENGTH, dev_sgi_ip22_imc_access, (void *)d, |
432 |
MEM_DEFAULT, NULL); |
DM_DEFAULT, NULL); |
433 |
memory_device_register(mem, "sgi_ip22_unknown", 0x1fa01000, 0x10, |
memory_device_register(mem, "sgi_ip22_unknown", 0x1fa01000, 0x10, |
434 |
dev_sgi_ip22_unknown_access, (void *)d, MEM_DEFAULT, NULL); |
dev_sgi_ip22_unknown_access, (void *)d, DM_DEFAULT, NULL); |
435 |
memory_device_register(mem, "sgi_ip22_unknown2", IP22_UNKNOWN2_BASE, |
memory_device_register(mem, "sgi_ip22_unknown2", IP22_UNKNOWN2_BASE, |
436 |
DEV_SGI_IP22_UNKNOWN2_LENGTH, dev_sgi_ip22_unknown2_access, |
DEV_SGI_IP22_UNKNOWN2_LENGTH, dev_sgi_ip22_unknown2_access, |
437 |
(void *)d, MEM_DEFAULT, NULL); |
(void *)d, DM_DEFAULT, NULL); |
438 |
|
|
439 |
machine_add_tickfunction(machine, dev_sgi_ip22_tick, d, |
machine_add_tickfunction(machine, dev_sgi_ip22_tick, d, |
440 |
SGI_IP22_TICK_SHIFT); |
SGI_IP22_TICK_SHIFT, 0.0); |
441 |
|
|
442 |
return d; |
return d; |
443 |
} |
} |