/[gxemul]/trunk/src/devices/dev_sandpoint.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_sandpoint.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/src/devices/dev_pmppc.c revision 42 by dpavlin, Mon Oct 8 16:22:32 2007 UTC trunk/src/devices/dev_sandpoint.c revision 49 by dpavlin, Wed Oct 10 23:31:09 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_pmppc.c,v 1.9 2007/06/15 19:57:33 debug Exp $   *  $Id: dev_sandpoint.c,v 1.9 2007/06/15 19:57:33 debug Exp $
29   *     *  
30   *  COMMENT: Artesyn PM/PPC motherboard registers   *  COMMENT: Artesyn PM/PPC motherboard registers
31   *   *
32   *  NOTE/TODO: Only enough to boot NetBSD/pmppc has been implemented.   *  NOTE/TODO: Only enough to boot NetBSD/sandpoint has been implemented.
33   */   */
34    
35  #include <stdio.h>  #include <stdio.h>
# Line 42  Line 42 
42  #include "memory.h"  #include "memory.h"
43  #include "misc.h"  #include "misc.h"
44    
45  #include "pmppc.h"  #include "sandpoint.h"
46    
47    
48  struct pmppc_data {  struct sandpoint_data {
49          uint8_t         config0;          uint8_t         config0;
50          uint8_t         config1;          uint8_t         config1;
51    
# Line 53  struct pmppc_data { Line 53  struct pmppc_data {
53  };  };
54    
55    
56  DEVICE_ACCESS(pmppc_board)  DEVICE_ACCESS(sandpoint_board)
57  {  {
58          struct pmppc_data *d = extra;          struct sandpoint_data *d = extra;
59          uint64_t idata = 0, odata = 0;          uint64_t idata = 0, odata = 0;
60    
61          if (writeflag == MEM_WRITE)          if (writeflag == MEM_WRITE)
62                  idata = memory_readmax64(cpu, data, len);                  idata = memory_readmax64(cpu, data, len);
63    
64          relative_addr += PMPPC_CONFIG0;          relative_addr += SANDPOINT_CONFIG0;
65    
66          switch (relative_addr) {          switch (relative_addr) {
67    
68          case PMPPC_CONFIG0:          case SANDPOINT_CONFIG0:
69                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
70                          odata = d->config0;                          odata = d->config0;
71                  } else {                  } else {
72                          debug("[ pmppc: UNIMPLEMENTED write to PMPPC_CONFIG0:"                          debug("[ sandpoint: UNIMPLEMENTED write to SANDPOINT_CONFIG0:"
73                              " 0x%02x ]\n", (int)idata);                              " 0x%02x ]\n", (int)idata);
74                  }                  }
75                  break;                  break;
76    
77          case PMPPC_CONFIG1:          case SANDPOINT_CONFIG1:
78                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
79                          odata = d->config1;                          odata = d->config1;
80                  } else {                  } else {
81                          debug("[ pmppc: UNIMPLEMENTED write to PMPPC_CONFIG1:"                          debug("[ sandpoint: UNIMPLEMENTED write to SANDPOINT_CONFIG1:"
82                              " 0x%02x ]\n", (int)idata);                              " 0x%02x ]\n", (int)idata);
83                  }                  }
84                  break;                  break;
85    
86          case PMPPC_RESET:          case SANDPOINT_RESET:
87                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
88                          odata = d->reset_reg;                          odata = d->reset_reg;
89                  } else {                  } else {
90                          if (d->reset_reg == PMPPC_RESET_SEQ_STEP1 &&                          if (d->reset_reg == SANDPOINT_RESET_SEQ_STEP1 &&
91                              idata == PMPPC_RESET_SEQ_STEP2) {                              idata == SANDPOINT_RESET_SEQ_STEP2) {
92                                  cpu->running = 0;                                  cpu->running = 0;
93                                  cpu->machine->                                  cpu->machine->
94                                      exit_without_entering_debugger = 1;                                      exit_without_entering_debugger = 1;
# Line 99  DEVICE_ACCESS(pmppc_board) Line 99  DEVICE_ACCESS(pmppc_board)
99    
100          default:          default:
101                  if (writeflag==MEM_READ) {                  if (writeflag==MEM_READ) {
102                          debug("[ pmppc: UNIMPLEMENTED read from 0x%08lx ]\n",                          debug("[ sandpoint: UNIMPLEMENTED read from 0x%08lx ]\n",
103                              (long)relative_addr);                              (long)relative_addr);
104                  } else {                  } else {
105                          debug("[ pmppc: UNIMPLEMENTED write to  0x%08lx:"                          debug("[ sandpoint: UNIMPLEMENTED write to  0x%08lx:"
106                              " 0x%02x ]\n", (long)relative_addr, (int)idata);                              " 0x%02x ]\n", (long)relative_addr, (int)idata);
107                  }                  }
108          }          }
# Line 114  DEVICE_ACCESS(pmppc_board) Line 114  DEVICE_ACCESS(pmppc_board)
114  }  }
115    
116    
117  DEVINIT(pmppc)  DEVINIT(sandpoint)
118  {  {
119          struct pmppc_data *d;          struct sandpoint_data *d;
120          struct memory *mem = devinit->machine->memory;          struct memory *mem = devinit->machine->memory;
121    
122          CHECK_ALLOCATION(d = malloc(sizeof(struct pmppc_data)));          CHECK_ALLOCATION(d = malloc(sizeof(struct sandpoint_data)));
123          memset(d, 0, sizeof(struct pmppc_data));          memset(d, 0, sizeof(struct sandpoint_data));
124    
125          /*          /*
126           *  Based on how NetBSD/pmppc's pmppc_setup() works:           *  Based on how NetBSD/sandpoint's sandpoint_setup() works:
127           *           *
128           *  config0:           *  config0:
129           *      bit 7           Is monarch (?).           *      bit 7           Is monarch (?).
# Line 157  DEVINIT(pmppc) Line 157  DEVINIT(pmppc)
157                  exit(1);                  exit(1);
158          }          }
159    
160          memory_device_register(mem, "pmppc_board",          memory_device_register(mem, "sandpoint_board",
161              PMPPC_CONFIG0, 0x10, dev_pmppc_board_access, d, DM_DEFAULT, NULL);              SANDPOINT_CONFIG0, 0x10, dev_sandpoint_board_access, d, DM_DEFAULT, NULL);
162    
163          return 1;          return 1;
164  }  }

Legend:
Removed from v.42  
changed lines
  Added in v.49

  ViewVC Help
Powered by ViewVC 1.1.26