1 |
/* |
/* |
2 |
* Copyright (C) 2004-2006 Anders Gavare. All rights reserved. |
* Copyright (C) 2004-2007 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_ip19.c,v 1.17 2006/02/09 20:02:59 debug Exp $ |
* $Id: dev_sgi_ip19.c,v 1.19 2007/06/15 19:57:34 debug Exp $ |
29 |
* |
* |
30 |
* SGI IP19 (and IP25) stuff. The stuff in here is mostly guesswork. |
* COMMENT: SGI IP19 (and IP25) stuff |
31 |
|
* |
32 |
|
* NOTE/TODO: The stuff in here is mostly guesswork. |
33 |
*/ |
*/ |
34 |
|
|
35 |
#include <stdio.h> |
#include <stdio.h> |
50 |
}; |
}; |
51 |
|
|
52 |
|
|
|
/* |
|
|
* dev_sgi_ip19_access(): |
|
|
*/ |
|
53 |
DEVICE_ACCESS(sgi_ip19) |
DEVICE_ACCESS(sgi_ip19) |
54 |
{ |
{ |
55 |
struct sgi_ip19_data *d = (struct sgi_ip19_data *) extra; |
struct sgi_ip19_data *d = extra; |
56 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
57 |
int regnr; |
int regnr; |
58 |
|
|
62 |
regnr = relative_addr / sizeof(uint32_t); |
regnr = relative_addr / sizeof(uint32_t); |
63 |
|
|
64 |
switch (relative_addr) { |
switch (relative_addr) { |
65 |
|
|
66 |
case 0x08: /* cpu id */ |
case 0x08: /* cpu id */ |
67 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
68 |
debug("[ sgi_ip19: unimplemented write to address " |
debug("[ sgi_ip19: unimplemented write to address " |
72 |
odata = cpu->cpu_id; /* ? TODO */ |
odata = cpu->cpu_id; /* ? TODO */ |
73 |
} |
} |
74 |
break; |
break; |
75 |
|
|
76 |
case 0x200: /* cpu available mask? */ |
case 0x200: /* cpu available mask? */ |
77 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
78 |
debug("[ sgi_ip19: unimplemented write to address " |
debug("[ sgi_ip19: unimplemented write to address " |
83 |
odata = ((1 << cpu->machine->ncpus) - 1) << 16; |
odata = ((1 << cpu->machine->ncpus) - 1) << 16; |
84 |
} |
} |
85 |
break; |
break; |
86 |
|
|
87 |
case 0x20000: /* cycle counter or clock */ |
case 0x20000: /* cycle counter or clock */ |
88 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
89 |
debug("[ sgi_ip19: unimplemented write to address " |
debug("[ sgi_ip19: unimplemented write to address " |
95 |
} |
} |
96 |
|
|
97 |
break; |
break; |
98 |
|
|
99 |
default: |
default: |
100 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
101 |
debug("[ sgi_ip19: unimplemented write to address " |
debug("[ sgi_ip19: unimplemented write to address " |
116 |
|
|
117 |
DEVINIT(sgi_ip19) |
DEVINIT(sgi_ip19) |
118 |
{ |
{ |
119 |
struct sgi_ip19_data *d = malloc(sizeof(struct sgi_ip19_data)); |
struct sgi_ip19_data *d; |
120 |
if (d == NULL) { |
|
121 |
fprintf(stderr, "out of memory\n"); |
CHECK_ALLOCATION(d = malloc(sizeof(struct sgi_ip19_data))); |
|
exit(1); |
|
|
} |
|
122 |
memset(d, 0, sizeof(struct sgi_ip19_data)); |
memset(d, 0, sizeof(struct sgi_ip19_data)); |
123 |
|
|
124 |
memory_device_register(devinit->machine->memory, devinit->name, |
memory_device_register(devinit->machine->memory, devinit->name, |