30
30
typedef struct _i82371ab_state i82371ab_state ;
31
31
struct _i82371ab_state
32
32
{
33
- UINT32 regs [4 ][0x100 / 4 ];
33
+ UINT8 regs [4 ][0x100 ];
34
34
};
35
35
36
36
@@ -54,7 +54,10 @@ INLINE i82371ab_state *get_safe_token(device_t *device)
54
54
static UINT32 i82371ab_pci_isa_r (device_t * busdevice , device_t * device , int offset , UINT32 mem_mask )
55
55
{
56
56
i82371ab_state * i82371ab = get_safe_token (device );
57
- UINT32 result = i82371ab -> regs [0 ][offset ];
57
+ UINT32 result = i82371ab -> regs [0 ][offset ] |
58
+ i82371ab -> regs [0 ][offset + 1 ] << 8 |
59
+ i82371ab -> regs [0 ][offset + 2 ] << 16 |
60
+ i82371ab -> regs [0 ][offset + 3 ] << 24 ;
58
61
59
62
logerror ("i82371ab_pci_isa_r, offset = %02x, mem_mask = %08x\n" , offset , mem_mask );
60
63
@@ -63,29 +66,39 @@ static UINT32 i82371ab_pci_isa_r(device_t *busdevice, device_t *device, int offs
63
66
64
67
static void i82371ab_pci_isa_w (device_t * busdevice , device_t * device , int offset , UINT32 data , UINT32 mem_mask )
65
68
{
69
+ UINT32 cdata = 0 ;
70
+ int i ;
66
71
i82371ab_state * i82371ab = get_safe_token (device );
72
+ COMBINE_DATA (& cdata );
67
73
68
74
logerror ("i82371ab_pci_isa_w, offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
69
75
70
- switch ( offset )
76
+ for ( i = 0 ; i < 4 ; i ++ , offset ++ , cdata >>= 8 )
71
77
{
72
- case 0x04 :
73
- COMBINE_DATA (& i82371ab -> regs [0 ][offset ]);
74
-
75
- /* clear reserved bits */
76
- i82371ab -> regs [0 ][offset ] &= 0x00000005 ;
77
-
78
- /* set new status */
79
- i82371ab -> regs [0 ][offset ] |= 0x02800000 ;
80
-
81
- break ;
78
+ switch (offset )
79
+ {
80
+ case 0x04 :
81
+ /* clear reserved bits */
82
+ i82371ab -> regs [0 ][offset ] = cdata & 0x05 ;
83
+ break ;
84
+ case 0x06 :
85
+ /* set new status */
86
+ i82371ab -> regs [0 ][offset ] |= 0x80 ;
87
+ break ;
88
+ case 0x07 :
89
+ i82371ab -> regs [0 ][offset ] |= 0x02 ;
90
+ break ;
91
+ }
82
92
}
83
93
}
84
94
85
95
static UINT32 i82371ab_pci_ide_r (device_t * busdevice , device_t * device , int offset , UINT32 mem_mask )
86
96
{
87
97
i82371ab_state * i82371ab = get_safe_token (device );
88
- UINT32 result = i82371ab -> regs [1 ][offset ];
98
+ UINT32 result = i82371ab -> regs [1 ][offset ] |
99
+ i82371ab -> regs [1 ][offset + 1 ] << 8 |
100
+ i82371ab -> regs [1 ][offset + 2 ] << 16 |
101
+ i82371ab -> regs [1 ][offset + 3 ] << 24 ;
89
102
90
103
logerror ("i82371ab_pci_ide_r, offset = %02x, mem_mask = %08x\n" , offset , mem_mask );
91
104
@@ -94,29 +107,39 @@ static UINT32 i82371ab_pci_ide_r(device_t *busdevice, device_t *device, int offs
94
107
95
108
static void i82371ab_pci_ide_w (device_t * busdevice , device_t * device , int offset , UINT32 data , UINT32 mem_mask )
96
109
{
110
+ UINT32 cdata = 0 ;
111
+ int i ;
97
112
i82371ab_state * i82371ab = get_safe_token (device );
113
+ COMBINE_DATA (& cdata );
98
114
99
- logerror ("i82371ab_pci_ide_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
115
+ logerror ("i82371ab_pci_isa_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
100
116
101
- switch ( offset )
117
+ for ( i = 0 ; i < 4 ; i ++ , offset ++ , cdata >>= 8 )
102
118
{
103
- case 0x04 :
104
- COMBINE_DATA (& i82371ab -> regs [1 ][offset ]);
105
-
106
- /* clear reserved bits */
107
- i82371ab -> regs [1 ][offset ] &= 0x00000005 ;
108
-
109
- /* set new status */
110
- i82371ab -> regs [1 ][offset ] |= 0x02800000 ;
111
-
112
- break ;
119
+ switch (offset )
120
+ {
121
+ case 0x04 :
122
+ /* clear reserved bits */
123
+ i82371ab -> regs [1 ][offset ] = cdata & 0x05 ;
124
+ break ;
125
+ case 0x06 :
126
+ /* set new status */
127
+ i82371ab -> regs [1 ][offset ] |= 0x80 ;
128
+ break ;
129
+ case 0x07 :
130
+ i82371ab -> regs [1 ][offset ] |= 0x02 ;
131
+ break ;
132
+ }
113
133
}
114
134
}
115
135
116
136
static UINT32 i82371ab_pci_usb_r (device_t * busdevice , device_t * device , int offset , UINT32 mem_mask )
117
137
{
118
138
i82371ab_state * i82371ab = get_safe_token (device );
119
- UINT32 result = i82371ab -> regs [2 ][offset ];
139
+ UINT32 result = i82371ab -> regs [2 ][offset ] |
140
+ i82371ab -> regs [2 ][offset + 1 ] << 8 |
141
+ i82371ab -> regs [2 ][offset + 2 ] << 16 |
142
+ i82371ab -> regs [2 ][offset + 3 ] << 24 ;
120
143
121
144
logerror ("i82371ab_pci_usb_r, offset = %02x, mem_mask = %08x\n" , offset , mem_mask );
122
145
@@ -125,29 +148,39 @@ static UINT32 i82371ab_pci_usb_r(device_t *busdevice, device_t *device, int offs
125
148
126
149
static void i82371ab_pci_usb_w (device_t * busdevice , device_t * device , int offset , UINT32 data , UINT32 mem_mask )
127
150
{
151
+ UINT32 cdata = 0 ;
152
+ int i ;
128
153
i82371ab_state * i82371ab = get_safe_token (device );
154
+ COMBINE_DATA (& cdata );
129
155
130
- logerror ("i82371ab_pci_usb_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
156
+ logerror ("i82371ab_pci_isa_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
131
157
132
- switch ( offset )
158
+ for ( i = 0 ; i < 4 ; i ++ , offset ++ , cdata >>= 8 )
133
159
{
134
- case 0x04 :
135
- COMBINE_DATA (& i82371ab -> regs [2 ][offset ]);
136
-
137
- /* clear reserved bits */
138
- i82371ab -> regs [2 ][offset ] &= 0x00000005 ;
139
-
140
- /* set new status */
141
- i82371ab -> regs [2 ][offset ] |= 0x02800000 ;
142
-
143
- break ;
160
+ switch (offset )
161
+ {
162
+ case 0x04 :
163
+ /* clear reserved bits */
164
+ i82371ab -> regs [2 ][offset ] = cdata & 0x05 ;
165
+ break ;
166
+ case 0x06 :
167
+ /* set new status */
168
+ i82371ab -> regs [2 ][offset ] |= 0x80 ;
169
+ break ;
170
+ case 0x07 :
171
+ i82371ab -> regs [2 ][offset ] |= 0x02 ;
172
+ break ;
173
+ }
144
174
}
145
175
}
146
176
147
177
static UINT32 i82371ab_pci_acpi_r (device_t * busdevice , device_t * device , int offset , UINT32 mem_mask )
148
178
{
149
179
i82371ab_state * i82371ab = get_safe_token (device );
150
- UINT32 result = i82371ab -> regs [3 ][offset ];
180
+ UINT32 result = i82371ab -> regs [3 ][offset ] |
181
+ i82371ab -> regs [3 ][offset + 1 ] << 8 |
182
+ i82371ab -> regs [3 ][offset + 2 ] << 16 |
183
+ i82371ab -> regs [3 ][offset + 3 ] << 24 ;
151
184
152
185
logerror ("i82371ab_pci_acpi_r, offset = %02x, mem_mask = %08x\n" , offset , mem_mask );
153
186
@@ -156,22 +189,29 @@ static UINT32 i82371ab_pci_acpi_r(device_t *busdevice, device_t *device, int off
156
189
157
190
static void i82371ab_pci_acpi_w (device_t * busdevice , device_t * device , int offset , UINT32 data , UINT32 mem_mask )
158
191
{
192
+ UINT32 cdata = 0 ;
193
+ int i ;
159
194
i82371ab_state * i82371ab = get_safe_token (device );
195
+ COMBINE_DATA (& cdata );
160
196
161
- logerror ("i82371ab_pci_acpi_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
197
+ logerror ("i82371ab_pci_isa_w , offset = %02x, data = %08x, mem_mask = %08x\n" , offset , data , mem_mask );
162
198
163
- switch ( offset )
199
+ for ( i = 0 ; i < 4 ; i ++ , offset ++ , cdata >>= 8 )
164
200
{
165
- case 0x04 :
166
- COMBINE_DATA (& i82371ab -> regs [3 ][offset ]);
167
-
168
- /* clear reserved bits */
169
- i82371ab -> regs [3 ][offset ] &= 0x00000005 ;
170
-
171
- /* set new status */
172
- i82371ab -> regs [3 ][offset ] |= 0x02800000 ;
173
-
174
- break ;
201
+ switch (offset )
202
+ {
203
+ case 0x04 :
204
+ /* clear reserved bits */
205
+ i82371ab -> regs [3 ][offset ] = cdata & 0x05 ;
206
+ break ;
207
+ case 0x06 :
208
+ /* set new status */
209
+ i82371ab -> regs [3 ][offset ] |= 0x80 ;
210
+ break ;
211
+ case 0x07 :
212
+ i82371ab -> regs [3 ][offset ] |= 0x02 ;
213
+ break ;
214
+ }
175
215
}
176
216
}
177
217
@@ -217,30 +257,31 @@ static DEVICE_START( i82371ab )
217
257
static DEVICE_RESET ( i82371ab )
218
258
{
219
259
i82371ab_state * i82371ab = get_safe_token (device );
260
+ UINT32 (* regs32 )[64 ] = (UINT32 (* )[64 ])(i82371ab -> regs );
220
261
221
262
/* isa */
222
- i82371ab -> regs [0 ][0x00 ] = 0x71108086 ;
223
- i82371ab -> regs [0 ][0x04 ] = 0x00000000 ;
224
- i82371ab -> regs [0 ][0x08 ] = 0x06010000 ;
225
- i82371ab -> regs [0 ][0x0c ] = 0x00800000 ;
263
+ regs32 [0 ][0x00 ] = 0x71108086 ;
264
+ regs32 [0 ][0x04 ] = 0x00000000 ;
265
+ regs32 [0 ][0x08 ] = 0x06010000 ;
266
+ regs32 [0 ][0x0c ] = 0x00800000 ;
226
267
227
268
/* ide */
228
- i82371ab -> regs [1 ][0x00 ] = 0x71118086 ;
229
- i82371ab -> regs [1 ][0x04 ] = 0x02800000 ;
230
- i82371ab -> regs [1 ][0x08 ] = 0x01018000 ;
231
- i82371ab -> regs [1 ][0x0c ] = 0x00000000 ;
269
+ regs32 [1 ][0x00 ] = 0x71118086 ;
270
+ regs32 [1 ][0x04 ] = 0x02800000 ;
271
+ regs32 [1 ][0x08 ] = 0x01018000 ;
272
+ regs32 [1 ][0x0c ] = 0x00000000 ;
232
273
233
274
/* usb */
234
- i82371ab -> regs [2 ][0x00 ] = 0x71128086 ;
235
- i82371ab -> regs [2 ][0x04 ] = 0x02800000 ;
236
- i82371ab -> regs [2 ][0x08 ] = 0x0c030000 ;
237
- i82371ab -> regs [2 ][0x0c ] = 0x00000000 ;
275
+ regs32 [2 ][0x00 ] = 0x71128086 ;
276
+ regs32 [2 ][0x04 ] = 0x02800000 ;
277
+ regs32 [2 ][0x08 ] = 0x0c030000 ;
278
+ regs32 [2 ][0x0c ] = 0x00000000 ;
238
279
239
280
/* acpi */
240
- i82371ab -> regs [3 ][0x00 ] = 0x71138086 ;
241
- i82371ab -> regs [3 ][0x04 ] = 0x02800000 ;
242
- i82371ab -> regs [3 ][0x08 ] = 0x06800000 ;
243
- i82371ab -> regs [3 ][0x0c ] = 0x02800000 ;
281
+ regs32 [3 ][0x00 ] = 0x71138086 ;
282
+ regs32 [3 ][0x04 ] = 0x02800000 ;
283
+ regs32 [3 ][0x08 ] = 0x06800000 ;
284
+ regs32 [3 ][0x0c ] = 0x02800000 ;
244
285
}
245
286
246
287
0 commit comments