1 |
/* |
/* |
2 |
* Copyright (C) 2004-2005 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_ip20.c,v 1.10 2005/02/22 05:52:58 debug Exp $ |
* $Id: dev_sgi_ip20.c,v 1.15 2007/06/15 19:57:34 debug Exp $ |
29 |
* |
* |
30 |
* SGI IP20 stuff. |
* COMMENT: SGI IP20 stuff |
31 |
|
* |
32 |
|
* TODO. |
33 |
*/ |
*/ |
34 |
|
|
35 |
#include <stdio.h> |
#include <stdio.h> |
44 |
extern int quiet_mode; |
extern int quiet_mode; |
45 |
|
|
46 |
|
|
47 |
/* |
DEVICE_ACCESS(sgi_ip20) |
|
* dev_sgi_ip20_access(): |
|
|
*/ |
|
|
int dev_sgi_ip20_access(struct cpu *cpu, struct memory *mem, |
|
|
uint64_t relative_addr, unsigned char *data, size_t len, |
|
|
int writeflag, void *extra) |
|
48 |
{ |
{ |
49 |
/* struct sgi_ip20_data *d = (struct sgi_ip20_data *) extra; */ |
/* struct sgi_ip20_data *d = extra; */ |
50 |
uint64_t idata = 0, odata = 0; |
uint64_t idata = 0, odata = 0; |
51 |
|
|
52 |
idata = memory_readmax64(cpu, data, len); |
if (writeflag == MEM_WRITE) |
53 |
|
idata = memory_readmax64(cpu, data, len); |
54 |
|
|
55 |
switch (relative_addr) { |
switch (relative_addr) { |
56 |
|
|
57 |
case 0x38: |
case 0x38: |
58 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
59 |
debug("[ sgi_ip20: write to address 0x%x, " |
debug("[ sgi_ip20: write to address 0x%x, " |
75 |
(int)relative_addr, (int)odata); |
(int)relative_addr, (int)odata); |
76 |
} |
} |
77 |
break; |
break; |
78 |
|
|
79 |
default: |
default: |
80 |
if (writeflag == MEM_WRITE) { |
if (writeflag == MEM_WRITE) { |
81 |
debug("[ sgi_ip20: unimplemented write to address " |
debug("[ sgi_ip20: unimplemented write to address " |
94 |
} |
} |
95 |
|
|
96 |
|
|
|
/* |
|
|
* dev_sgi_ip20_init(): |
|
|
*/ |
|
97 |
struct sgi_ip20_data *dev_sgi_ip20_init(struct cpu *cpu, struct memory *mem, |
struct sgi_ip20_data *dev_sgi_ip20_init(struct cpu *cpu, struct memory *mem, |
98 |
uint64_t baseaddr) |
uint64_t baseaddr) |
99 |
{ |
{ |
100 |
struct sgi_ip20_data *d = malloc(sizeof(struct sgi_ip20_data)); |
struct sgi_ip20_data *d; |
101 |
if (d == NULL) { |
|
102 |
fprintf(stderr, "out of memory\n"); |
CHECK_ALLOCATION(d = malloc(sizeof(struct sgi_ip20_data))); |
|
exit(1); |
|
|
} |
|
103 |
memset(d, 0, sizeof(struct sgi_ip20_data)); |
memset(d, 0, sizeof(struct sgi_ip20_data)); |
104 |
|
|
105 |
/* |
/* |
108 |
*/ |
*/ |
109 |
memory_device_register(mem, "sgi_ip20_int", baseaddr, |
memory_device_register(mem, "sgi_ip20_int", baseaddr, |
110 |
DEV_SGI_IP20_LENGTH, dev_sgi_ip20_access, (void *)d, |
DEV_SGI_IP20_LENGTH, dev_sgi_ip20_access, (void *)d, |
111 |
MEM_DEFAULT, NULL); |
DM_DEFAULT, NULL); |
112 |
|
|
113 |
return d; |
return d; |
114 |
} |
} |