src/mess/machine/i82371ab.c
| r6968 | r6969 | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | /***************************************************************************
|
| 22 | CONSTANTS
|
| 23 | ***************************************************************************/
|
| 24 | |
| 25 | |
| 26 | /***************************************************************************
|
| 22 | 27 | TYPE DEFINITIONS
|
| 23 | 28 | ***************************************************************************/
|
| 24 | 29 | |
| 25 | 30 | typedef struct _i82371ab_state i82371ab_state;
|
| 26 | 31 | struct _i82371ab_state
|
| 27 | 32 | {
|
| 28 | | UINT32 dummy;
|
| 33 | UINT32 regs[4][0x100/4];
|
| 29 | 34 | };
|
| 30 | 35 | |
| 31 | 36 | |
| r6968 | r6969 | |
| 47 | 52 | PCI INTERFACE
|
| 48 | 53 | ***************************************************************************/
|
| 49 | 54 | |
| 50 | | UINT32 i82371ab_pci_read(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 mem_mask)
|
| 55 | static UINT32 i82371ab_pci_isa_r(const device_config *busdevice, const device_config *device, int offset, UINT32 mem_mask)
|
| 51 | 56 | {
|
| 52 | | UINT32 result = 0;
|
| 57 | i82371ab_state *i82371ab = get_safe_token(device);
|
| 58 | UINT32 result = i82371ab->regs[0][offset];
|
| 53 | 59 | |
| 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);
|
| 55 | 61 | |
| 56 | | if (function != 0)
|
| 57 | | return 0;
|
| 62 | return result;
|
| 63 | }
|
| 58 | 64 | |
| 65 | void 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 | |
| 59 | 71 | switch (offset)
|
| 60 | 72 | {
|
| 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 | |
| 63 | 82 | break;
|
| 83 | }
|
| 84 | }
|
| 85 | |
| 86 | static 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 | |
| 96 | void 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 | {
|
| 64 | 104 | 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 | |
| 66 | 113 | break;
|
| 67 | | case 0x08:
|
| 68 | | result = 0x06010000;
|
| 114 | }
|
| 115 | }
|
| 116 | |
| 117 | static 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 | |
| 127 | void 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 | |
| 69 | 144 | break;
|
| 70 | | case 0x0c:
|
| 71 | | result = 0x00800000;
|
| 72 | | break;
|
| 73 | 145 | }
|
| 146 | }
|
| 74 | 147 | |
| 148 | static 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 | |
| 75 | 155 | return result;
|
| 76 | 156 | }
|
| 77 | 157 | |
| 158 | void 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 | |
| 179 | UINT32 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 | |
| 78 | 194 | void i82371ab_pci_write(const device_config *busdevice, const device_config *device, int function, int offset, UINT32 data, UINT32 mem_mask)
|
| 79 | 195 | {
|
| 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 | }
|
| 81 | 203 | }
|
| 82 | 204 | |
| 83 | 205 | |
| r6968 | r6969 | |
| 89 | 211 | {
|
| 90 | 212 | i82371ab_state *i82371ab = get_safe_token(device);
|
| 91 | 213 | |
| 92 | | i82371ab->dummy = 0;
|
| 93 | | |
| 94 | 214 | /* setup save states */
|
| 215 | state_save_register_device_item_2d_array(device, 0, i82371ab->regs);
|
| 95 | 216 | }
|
| 96 | 217 | |
| 97 | 218 | static DEVICE_RESET( i82371ab )
|
| 98 | 219 | {
|
| 99 | 220 | i82371ab_state *i82371ab = get_safe_token(device);
|
| 100 | 221 | |
| 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;
|
| 102 | 245 | }
|
| 103 | 246 | |
| 104 | 247 | |