Previous 15994 Revisions Next

r6969 Thursday 7th January, 2010 at 14:45:36 UTC by Dirk Best
[I82371AB] Add some meat, devices are now detected by the bios
[src/mess/machine]i82371ab.c

src/mess/machine/i82371ab.c
r6968r6969
1919 
2020 
2121/***************************************************************************
22    CONSTANTS
23***************************************************************************/
24 
25 
26/***************************************************************************
2227    TYPE DEFINITIONS
2328***************************************************************************/
2429 
2530typedef struct _i82371ab_state i82371ab_state;
2631struct _i82371ab_state
2732{
28   UINT32 dummy;
33   UINT32 regs[4][0x100/4];
2934};
3035 
3136 
r6968r6969
4752    PCI INTERFACE
4853***************************************************************************/
4954 
50UINT32 i82371ab_pci_read(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 mem_mask)
55static UINT32 i82371ab_pci_isa_r(const device_config *busdevice, const device_config *device, int offset, UINT32 mem_mask)
5156{
52   UINT32 result = 0;
57   i82371ab_state *i82371ab = get_safe_token(device);
58   UINT32 result = i82371ab->regs[0][offset];
5359 
54   logerror("i82371ab_pci r function = %d, offset = %02x\n", function, offset);
60   logerror("i82371ab_pci_isa_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask);
5561 
56   if (function != 0)
57      return 0;
62   return result;
63}
5864 
65void i82371ab_pci_isa_w(const device_config *busdevice, const device_config *device, int offset, UINT32 data, UINT32 mem_mask)
66{
67   i82371ab_state *i82371ab = get_safe_token(device);
68 
69   logerror("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask);
70 
5971   switch (offset)
6072   {
61   case 0x00:
62      result = 0x71108086;
73   case 0x04:
74      COMBINE_DATA(&i82371ab->regs[0][offset]);
75 
76      /* clear reserved bits */
77      i82371ab->regs[0][offset] &= 0x00000005;
78 
79      /* set new status */
80      i82371ab->regs[0][offset] |= 0x02800000;
81 
6382      break;
83   }
84}
85 
86static UINT32 i82371ab_pci_ide_r(const device_config *busdevice, const device_config *device, int offset, UINT32 mem_mask)
87{
88   i82371ab_state *i82371ab = get_safe_token(device);
89   UINT32 result = i82371ab->regs[1][offset];
90 
91   logerror("i82371ab_pci_ide_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask);
92 
93   return result;
94}
95 
96void i82371ab_pci_ide_w(const device_config *busdevice, const device_config *device, int offset, UINT32 data, UINT32 mem_mask)
97{
98   i82371ab_state *i82371ab = get_safe_token(device);
99 
100   logerror("i82371ab_pci_ide_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask);
101 
102   switch (offset)
103   {
64104   case 0x04:
65      result = 0x00000000;
105      COMBINE_DATA(&i82371ab->regs[1][offset]);
106 
107      /* clear reserved bits */
108      i82371ab->regs[1][offset] &= 0x00000005;
109 
110      /* set new status */
111      i82371ab->regs[1][offset] |= 0x02800000;
112 
66113      break;
67   case 0x08:
68      result = 0x06010000;
114   }
115}
116 
117static UINT32 i82371ab_pci_usb_r(const device_config *busdevice, const device_config *device, int offset, UINT32 mem_mask)
118{
119   i82371ab_state *i82371ab = get_safe_token(device);
120   UINT32 result = i82371ab->regs[2][offset];
121 
122   logerror("i82371ab_pci_usb_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask);
123 
124   return result;
125}
126 
127void i82371ab_pci_usb_w(const device_config *busdevice, const device_config *device, int offset, UINT32 data, UINT32 mem_mask)
128{
129   i82371ab_state *i82371ab = get_safe_token(device);
130 
131   logerror("i82371ab_pci_usb_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask);
132 
133   switch (offset)
134   {
135   case 0x04:
136      COMBINE_DATA(&i82371ab->regs[2][offset]);
137 
138      /* clear reserved bits */
139      i82371ab->regs[2][offset] &= 0x00000005;
140 
141      /* set new status */
142      i82371ab->regs[2][offset] |= 0x02800000;
143 
69144      break;
70   case 0x0c:
71      result = 0x00800000;
72      break;
73145   }
146}
74147 
148static UINT32 i82371ab_pci_acpi_r(const device_config *busdevice, const device_config *device, int offset, UINT32 mem_mask)
149{
150   i82371ab_state *i82371ab = get_safe_token(device);
151   UINT32 result = i82371ab->regs[3][offset];
152 
153   logerror("i82371ab_pci_acpi_r, offset = %02x, mem_mask = %08x\n", offset, mem_mask);
154 
75155   return result;
76156}
77157 
158void i82371ab_pci_acpi_w(const device_config *busdevice, const device_config *device, int offset, UINT32 data, UINT32 mem_mask)
159{
160   i82371ab_state *i82371ab = get_safe_token(device);
161 
162   logerror("i82371ab_pci_acpi_w, offset = %02x, data = %08x, mem_mask = %08x\n", offset, data, mem_mask);
163 
164   switch (offset)
165   {
166   case 0x04:
167      COMBINE_DATA(&i82371ab->regs[3][offset]);
168 
169      /* clear reserved bits */
170      i82371ab->regs[3][offset] &= 0x00000005;
171 
172      /* set new status */
173      i82371ab->regs[3][offset] |= 0x02800000;
174 
175      break;
176   }
177}
178 
179UINT32 i82371ab_pci_read(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 mem_mask)
180{
181   switch (function)
182   {
183   case 0: return i82371ab_pci_isa_r(busdevice, device, offset, mem_mask);
184   case 1: return i82371ab_pci_ide_r(busdevice, device, offset, mem_mask);
185   case 2: return i82371ab_pci_usb_r(busdevice, device, offset, mem_mask);
186   case 3: return i82371ab_pci_acpi_r(busdevice, device, offset, mem_mask);
187   }
188 
189   logerror("i82371ab_pci_read: read from undefined function %d\n", function);
190 
191   return 0;
192}
193 
78194void i82371ab_pci_write(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 data, UINT32 mem_mask)
79195{
80   logerror("i82371ab_pci w function = %d, offset = %02x\n", function, offset);
196   switch (function)
197   {
198   case 0: i82371ab_pci_isa_w(busdevice, device, offset, data, mem_mask); break;
199   case 1: i82371ab_pci_ide_w(busdevice, device, offset, data, mem_mask); break;
200   case 2: i82371ab_pci_usb_w(busdevice, device, offset, data, mem_mask); break;
201   case 3: i82371ab_pci_acpi_w(busdevice, device, offset, data, mem_mask); break;
202   }
81203}
82204 
83205 
r6968r6969
89211{
90212   i82371ab_state *i82371ab = get_safe_token(device);
91213 
92   i82371ab->dummy = 0;
93 
94214   /* setup save states */
215   state_save_register_device_item_2d_array(device, 0, i82371ab->regs);
95216}
96217 
97218static DEVICE_RESET( i82371ab )
98219{
99220   i82371ab_state *i82371ab = get_safe_token(device);
100221 
101   i82371ab->dummy = 0;
222   /* isa */
223   i82371ab->regs[0][0x00] = 0x71108086;
224   i82371ab->regs[0][0x04] = 0x00000000;
225   i82371ab->regs[0][0x08] = 0x06010000;
226   i82371ab->regs[0][0x0c] = 0x00800000;
227 
228   /* ide */
229   i82371ab->regs[1][0x00] = 0x71118086;
230   i82371ab->regs[1][0x04] = 0x02800000;
231   i82371ab->regs[1][0x08] = 0x01018000;
232   i82371ab->regs[1][0x0c] = 0x00000000;
233 
234   /* usb */
235   i82371ab->regs[2][0x00] = 0x71128086;
236   i82371ab->regs[2][0x04] = 0x02800000;
237   i82371ab->regs[2][0x08] = 0x0c030000;
238   i82371ab->regs[2][0x0c] = 0x00000000;
239 
240   /* acpi */
241   i82371ab->regs[3][0x00] = 0x71138086;
242   i82371ab->regs[3][0x04] = 0x02800000;
243   i82371ab->regs[3][0x08] = 0x06800000;
244   i82371ab->regs[3][0x0c] = 0x02800000;
102245}
103246 
104247 

Previous 15994 Revisions Next


© 1998-2018 The MESS Team