1 /* 2 * QEMU PowerMac CUDA device support 3 * 4 * Copyright (c) 2004-2007 Fabrice Bellard 5 * Copyright (c) 2007 Jocelyn Mayer 6 * 7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * of this software and associated documentation files (the "Software"), to deal 9 * in the Software without restriction, including without limitation the rights 10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 * copies of the Software, and to permit persons to whom the Software is 12 * furnished to do so, subject to the following conditions: 13 * 14 * The above copyright notice and this permission notice shall be included in 15 * all copies or substantial portions of the Software. 16 * 17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 * THE SOFTWARE. 24 */ 25 26 #include "qemu/osdep.h" 27 #include "qemu-common.h" 28 #include "hw/ppc/mac.h" 29 #include "hw/qdev-properties.h" 30 #include "migration/vmstate.h" 31 #include "hw/input/adb.h" 32 #include "hw/misc/mos6522.h" 33 #include "hw/misc/macio/cuda.h" 34 #include "qapi/error.h" 35 #include "qemu/timer.h" 36 #include "sysemu/runstate.h" 37 #include "qapi/error.h" 38 #include "qemu/cutils.h" 39 #include "qemu/log.h" 40 #include "qemu/module.h" 41 #include "trace.h" 42 43 /* Bits in B data register: all active low */ 44 #define TREQ 0x08 /* Transfer request (input) */ 45 #define TACK 0x10 /* Transfer acknowledge (output) */ 46 #define TIP 0x20 /* Transfer in progress (output) */ 47 48 /* commands (1st byte) */ 49 #define ADB_PACKET 0 50 #define CUDA_PACKET 1 51 #define ERROR_PACKET 2 52 #define TIMER_PACKET 3 53 #define POWER_PACKET 4 54 #define MACIIC_PACKET 5 55 #define PMU_PACKET 6 56 57 #define CUDA_TIMER_FREQ (4700000 / 6) 58 59 /* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */ 60 #define RTC_OFFSET 2082844800 61 62 static void cuda_receive_packet_from_host(CUDAState *s, 63 const uint8_t *data, int len); 64 65 /* MacOS uses timer 1 for calibration on startup, so we use 66 * the timebase frequency and cuda_get_counter_value() with 67 * cuda_get_load_time() to steer MacOS to calculate calibrate its timers 68 * correctly for both TCG and KVM (see commit b981289c49 "PPC: Cuda: Use cuda 69 * timer to expose tbfreq to guest" for more information) */ 70 71 static uint64_t cuda_get_counter_value(MOS6522State *s, MOS6522Timer *ti) 72 { 73 MOS6522CUDAState *mcs = container_of(s, MOS6522CUDAState, parent_obj); 74 CUDAState *cs = container_of(mcs, CUDAState, mos6522_cuda); 75 76 /* Reverse of the tb calculation algorithm that Mac OS X uses on bootup */ 77 uint64_t tb_diff = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 78 cs->tb_frequency, NANOSECONDS_PER_SECOND) - 79 ti->load_time; 80 81 return (tb_diff * 0xBF401675E5DULL) / (cs->tb_frequency << 24); 82 } 83 84 static uint64_t cuda_get_load_time(MOS6522State *s, MOS6522Timer *ti) 85 { 86 MOS6522CUDAState *mcs = container_of(s, MOS6522CUDAState, parent_obj); 87 CUDAState *cs = container_of(mcs, CUDAState, mos6522_cuda); 88 89 uint64_t load_time = muldiv64(qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL), 90 cs->tb_frequency, NANOSECONDS_PER_SECOND); 91 return load_time; 92 } 93 94 static void cuda_set_sr_int(void *opaque) 95 { 96 CUDAState *s = opaque; 97 MOS6522CUDAState *mcs = &s->mos6522_cuda; 98 MOS6522State *ms = MOS6522(mcs); 99 MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); 100 101 mdc->set_sr_int(ms); 102 } 103 104 static void cuda_delay_set_sr_int(CUDAState *s) 105 { 106 int64_t expire; 107 108 trace_cuda_delay_set_sr_int(); 109 110 expire = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + s->sr_delay_ns; 111 timer_mod(s->sr_delay_timer, expire); 112 } 113 114 /* NOTE: TIP and TREQ are negated */ 115 static void cuda_update(CUDAState *s) 116 { 117 MOS6522CUDAState *mcs = &s->mos6522_cuda; 118 MOS6522State *ms = MOS6522(mcs); 119 int packet_received, len; 120 121 packet_received = 0; 122 if (!(ms->b & TIP)) { 123 /* transfer requested from host */ 124 125 if (ms->acr & SR_OUT) { 126 /* data output */ 127 if ((ms->b & (TACK | TIP)) != (s->last_b & (TACK | TIP))) { 128 if (s->data_out_index < sizeof(s->data_out)) { 129 trace_cuda_data_send(ms->sr); 130 s->data_out[s->data_out_index++] = ms->sr; 131 cuda_delay_set_sr_int(s); 132 } 133 } 134 } else { 135 if (s->data_in_index < s->data_in_size) { 136 /* data input */ 137 if ((ms->b & (TACK | TIP)) != (s->last_b & (TACK | TIP))) { 138 ms->sr = s->data_in[s->data_in_index++]; 139 trace_cuda_data_recv(ms->sr); 140 /* indicate end of transfer */ 141 if (s->data_in_index >= s->data_in_size) { 142 ms->b = (ms->b | TREQ); 143 } 144 cuda_delay_set_sr_int(s); 145 } 146 } 147 } 148 } else { 149 /* no transfer requested: handle sync case */ 150 if ((s->last_b & TIP) && (ms->b & TACK) != (s->last_b & TACK)) { 151 /* update TREQ state each time TACK change state */ 152 if (ms->b & TACK) { 153 ms->b = (ms->b | TREQ); 154 } else { 155 ms->b = (ms->b & ~TREQ); 156 } 157 cuda_delay_set_sr_int(s); 158 } else { 159 if (!(s->last_b & TIP)) { 160 /* handle end of host to cuda transfer */ 161 packet_received = (s->data_out_index > 0); 162 /* always an IRQ at the end of transfer */ 163 cuda_delay_set_sr_int(s); 164 } 165 /* signal if there is data to read */ 166 if (s->data_in_index < s->data_in_size) { 167 ms->b = (ms->b & ~TREQ); 168 } 169 } 170 } 171 172 s->last_acr = ms->acr; 173 s->last_b = ms->b; 174 175 /* NOTE: cuda_receive_packet_from_host() can call cuda_update() 176 recursively */ 177 if (packet_received) { 178 len = s->data_out_index; 179 s->data_out_index = 0; 180 cuda_receive_packet_from_host(s, s->data_out, len); 181 } 182 } 183 184 static void cuda_send_packet_to_host(CUDAState *s, 185 const uint8_t *data, int len) 186 { 187 int i; 188 189 trace_cuda_packet_send(len); 190 for (i = 0; i < len; i++) { 191 trace_cuda_packet_send_data(i, data[i]); 192 } 193 194 memcpy(s->data_in, data, len); 195 s->data_in_size = len; 196 s->data_in_index = 0; 197 cuda_update(s); 198 cuda_delay_set_sr_int(s); 199 } 200 201 static void cuda_adb_poll(void *opaque) 202 { 203 CUDAState *s = opaque; 204 uint8_t obuf[ADB_MAX_OUT_LEN + 2]; 205 int olen; 206 207 olen = adb_poll(&s->adb_bus, obuf + 2, s->adb_poll_mask); 208 if (olen > 0) { 209 obuf[0] = ADB_PACKET; 210 obuf[1] = 0x40; /* polled data */ 211 cuda_send_packet_to_host(s, obuf, olen + 2); 212 } 213 timer_mod(s->adb_poll_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 214 (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); 215 } 216 217 /* description of commands */ 218 typedef struct CudaCommand { 219 uint8_t command; 220 const char *name; 221 bool (*handler)(CUDAState *s, 222 const uint8_t *in_args, int in_len, 223 uint8_t *out_args, int *out_len); 224 } CudaCommand; 225 226 static bool cuda_cmd_autopoll(CUDAState *s, 227 const uint8_t *in_data, int in_len, 228 uint8_t *out_data, int *out_len) 229 { 230 int autopoll; 231 232 if (in_len != 1) { 233 return false; 234 } 235 236 autopoll = (in_data[0] != 0); 237 if (autopoll != s->autopoll) { 238 s->autopoll = autopoll; 239 if (autopoll) { 240 timer_mod(s->adb_poll_timer, 241 qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 242 (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); 243 } else { 244 timer_del(s->adb_poll_timer); 245 } 246 } 247 return true; 248 } 249 250 static bool cuda_cmd_set_autorate(CUDAState *s, 251 const uint8_t *in_data, int in_len, 252 uint8_t *out_data, int *out_len) 253 { 254 if (in_len != 1) { 255 return false; 256 } 257 258 /* we don't want a period of 0 ms */ 259 /* FIXME: check what real hardware does */ 260 if (in_data[0] == 0) { 261 return false; 262 } 263 264 s->autopoll_rate_ms = in_data[0]; 265 if (s->autopoll) { 266 timer_mod(s->adb_poll_timer, 267 qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + 268 (NANOSECONDS_PER_SECOND / (1000 / s->autopoll_rate_ms))); 269 } 270 return true; 271 } 272 273 static bool cuda_cmd_set_device_list(CUDAState *s, 274 const uint8_t *in_data, int in_len, 275 uint8_t *out_data, int *out_len) 276 { 277 if (in_len != 2) { 278 return false; 279 } 280 281 s->adb_poll_mask = (((uint16_t)in_data[0]) << 8) | in_data[1]; 282 return true; 283 } 284 285 static bool cuda_cmd_powerdown(CUDAState *s, 286 const uint8_t *in_data, int in_len, 287 uint8_t *out_data, int *out_len) 288 { 289 if (in_len != 0) { 290 return false; 291 } 292 293 qemu_system_shutdown_request(SHUTDOWN_CAUSE_GUEST_SHUTDOWN); 294 return true; 295 } 296 297 static bool cuda_cmd_reset_system(CUDAState *s, 298 const uint8_t *in_data, int in_len, 299 uint8_t *out_data, int *out_len) 300 { 301 if (in_len != 0) { 302 return false; 303 } 304 305 qemu_system_reset_request(SHUTDOWN_CAUSE_GUEST_RESET); 306 return true; 307 } 308 309 static bool cuda_cmd_set_file_server_flag(CUDAState *s, 310 const uint8_t *in_data, int in_len, 311 uint8_t *out_data, int *out_len) 312 { 313 if (in_len != 1) { 314 return false; 315 } 316 317 qemu_log_mask(LOG_UNIMP, 318 "CUDA: unimplemented command FILE_SERVER_FLAG %d\n", 319 in_data[0]); 320 return true; 321 } 322 323 static bool cuda_cmd_set_power_message(CUDAState *s, 324 const uint8_t *in_data, int in_len, 325 uint8_t *out_data, int *out_len) 326 { 327 if (in_len != 1) { 328 return false; 329 } 330 331 qemu_log_mask(LOG_UNIMP, 332 "CUDA: unimplemented command SET_POWER_MESSAGE %d\n", 333 in_data[0]); 334 return true; 335 } 336 337 static bool cuda_cmd_get_time(CUDAState *s, 338 const uint8_t *in_data, int in_len, 339 uint8_t *out_data, int *out_len) 340 { 341 uint32_t ti; 342 343 if (in_len != 0) { 344 return false; 345 } 346 347 ti = s->tick_offset + (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) 348 / NANOSECONDS_PER_SECOND); 349 out_data[0] = ti >> 24; 350 out_data[1] = ti >> 16; 351 out_data[2] = ti >> 8; 352 out_data[3] = ti; 353 *out_len = 4; 354 return true; 355 } 356 357 static bool cuda_cmd_set_time(CUDAState *s, 358 const uint8_t *in_data, int in_len, 359 uint8_t *out_data, int *out_len) 360 { 361 uint32_t ti; 362 363 if (in_len != 4) { 364 return false; 365 } 366 367 ti = (((uint32_t)in_data[0]) << 24) + (((uint32_t)in_data[1]) << 16) 368 + (((uint32_t)in_data[2]) << 8) + in_data[3]; 369 s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) 370 / NANOSECONDS_PER_SECOND); 371 return true; 372 } 373 374 static const CudaCommand handlers[] = { 375 { CUDA_AUTOPOLL, "AUTOPOLL", cuda_cmd_autopoll }, 376 { CUDA_SET_AUTO_RATE, "SET_AUTO_RATE", cuda_cmd_set_autorate }, 377 { CUDA_SET_DEVICE_LIST, "SET_DEVICE_LIST", cuda_cmd_set_device_list }, 378 { CUDA_POWERDOWN, "POWERDOWN", cuda_cmd_powerdown }, 379 { CUDA_RESET_SYSTEM, "RESET_SYSTEM", cuda_cmd_reset_system }, 380 { CUDA_FILE_SERVER_FLAG, "FILE_SERVER_FLAG", 381 cuda_cmd_set_file_server_flag }, 382 { CUDA_SET_POWER_MESSAGES, "SET_POWER_MESSAGES", 383 cuda_cmd_set_power_message }, 384 { CUDA_GET_TIME, "GET_TIME", cuda_cmd_get_time }, 385 { CUDA_SET_TIME, "SET_TIME", cuda_cmd_set_time }, 386 }; 387 388 static void cuda_receive_packet(CUDAState *s, 389 const uint8_t *data, int len) 390 { 391 uint8_t obuf[16] = { CUDA_PACKET, 0, data[0] }; 392 int i, out_len = 0; 393 394 for (i = 0; i < ARRAY_SIZE(handlers); i++) { 395 const CudaCommand *desc = &handlers[i]; 396 if (desc->command == data[0]) { 397 trace_cuda_receive_packet_cmd(desc->name); 398 out_len = 0; 399 if (desc->handler(s, data + 1, len - 1, obuf + 3, &out_len)) { 400 cuda_send_packet_to_host(s, obuf, 3 + out_len); 401 } else { 402 qemu_log_mask(LOG_GUEST_ERROR, 403 "CUDA: %s: wrong parameters %d\n", 404 desc->name, len); 405 obuf[0] = ERROR_PACKET; 406 obuf[1] = 0x5; /* bad parameters */ 407 obuf[2] = CUDA_PACKET; 408 obuf[3] = data[0]; 409 cuda_send_packet_to_host(s, obuf, 4); 410 } 411 return; 412 } 413 } 414 415 qemu_log_mask(LOG_GUEST_ERROR, "CUDA: unknown command 0x%02x\n", data[0]); 416 obuf[0] = ERROR_PACKET; 417 obuf[1] = 0x2; /* unknown command */ 418 obuf[2] = CUDA_PACKET; 419 obuf[3] = data[0]; 420 cuda_send_packet_to_host(s, obuf, 4); 421 } 422 423 static void cuda_receive_packet_from_host(CUDAState *s, 424 const uint8_t *data, int len) 425 { 426 int i; 427 428 trace_cuda_packet_receive(len); 429 for (i = 0; i < len; i++) { 430 trace_cuda_packet_receive_data(i, data[i]); 431 } 432 433 switch(data[0]) { 434 case ADB_PACKET: 435 { 436 uint8_t obuf[ADB_MAX_OUT_LEN + 3]; 437 int olen; 438 olen = adb_request(&s->adb_bus, obuf + 2, data + 1, len - 1); 439 if (olen > 0) { 440 obuf[0] = ADB_PACKET; 441 obuf[1] = 0x00; 442 cuda_send_packet_to_host(s, obuf, olen + 2); 443 } else { 444 /* error */ 445 obuf[0] = ADB_PACKET; 446 obuf[1] = -olen; 447 obuf[2] = data[1]; 448 olen = 0; 449 cuda_send_packet_to_host(s, obuf, olen + 3); 450 } 451 } 452 break; 453 case CUDA_PACKET: 454 cuda_receive_packet(s, data + 1, len - 1); 455 break; 456 } 457 } 458 459 static uint64_t mos6522_cuda_read(void *opaque, hwaddr addr, unsigned size) 460 { 461 CUDAState *s = opaque; 462 MOS6522CUDAState *mcs = &s->mos6522_cuda; 463 MOS6522State *ms = MOS6522(mcs); 464 465 addr = (addr >> 9) & 0xf; 466 return mos6522_read(ms, addr, size); 467 } 468 469 static void mos6522_cuda_write(void *opaque, hwaddr addr, uint64_t val, 470 unsigned size) 471 { 472 CUDAState *s = opaque; 473 MOS6522CUDAState *mcs = &s->mos6522_cuda; 474 MOS6522State *ms = MOS6522(mcs); 475 476 addr = (addr >> 9) & 0xf; 477 mos6522_write(ms, addr, val, size); 478 } 479 480 static const MemoryRegionOps mos6522_cuda_ops = { 481 .read = mos6522_cuda_read, 482 .write = mos6522_cuda_write, 483 .endianness = DEVICE_BIG_ENDIAN, 484 .valid = { 485 .min_access_size = 1, 486 .max_access_size = 1, 487 }, 488 }; 489 490 static const VMStateDescription vmstate_cuda = { 491 .name = "cuda", 492 .version_id = 5, 493 .minimum_version_id = 5, 494 .fields = (VMStateField[]) { 495 VMSTATE_STRUCT(mos6522_cuda.parent_obj, CUDAState, 0, vmstate_mos6522, 496 MOS6522State), 497 VMSTATE_UINT8(last_b, CUDAState), 498 VMSTATE_UINT8(last_acr, CUDAState), 499 VMSTATE_INT32(data_in_size, CUDAState), 500 VMSTATE_INT32(data_in_index, CUDAState), 501 VMSTATE_INT32(data_out_index, CUDAState), 502 VMSTATE_UINT8(autopoll, CUDAState), 503 VMSTATE_UINT8(autopoll_rate_ms, CUDAState), 504 VMSTATE_UINT16(adb_poll_mask, CUDAState), 505 VMSTATE_BUFFER(data_in, CUDAState), 506 VMSTATE_BUFFER(data_out, CUDAState), 507 VMSTATE_UINT32(tick_offset, CUDAState), 508 VMSTATE_TIMER_PTR(adb_poll_timer, CUDAState), 509 VMSTATE_TIMER_PTR(sr_delay_timer, CUDAState), 510 VMSTATE_END_OF_LIST() 511 } 512 }; 513 514 static void cuda_reset(DeviceState *dev) 515 { 516 CUDAState *s = CUDA(dev); 517 518 s->data_in_size = 0; 519 s->data_in_index = 0; 520 s->data_out_index = 0; 521 s->autopoll = 0; 522 } 523 524 static void cuda_realize(DeviceState *dev, Error **errp) 525 { 526 CUDAState *s = CUDA(dev); 527 Error *err = NULL; 528 SysBusDevice *sbd; 529 struct tm tm; 530 531 sysbus_realize(SYS_BUS_DEVICE(&s->mos6522_cuda), &err); 532 if (err) { 533 error_propagate(errp, err); 534 return; 535 } 536 537 /* Pass IRQ from 6522 */ 538 sbd = SYS_BUS_DEVICE(s); 539 sysbus_pass_irq(sbd, SYS_BUS_DEVICE(&s->mos6522_cuda)); 540 541 qemu_get_timedate(&tm, 0); 542 s->tick_offset = (uint32_t)mktimegm(&tm) + RTC_OFFSET; 543 544 s->sr_delay_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_set_sr_int, s); 545 s->sr_delay_ns = 20 * SCALE_US; 546 547 s->adb_poll_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, cuda_adb_poll, s); 548 s->adb_poll_mask = 0xffff; 549 s->autopoll_rate_ms = 20; 550 } 551 552 static void cuda_init(Object *obj) 553 { 554 CUDAState *s = CUDA(obj); 555 SysBusDevice *sbd = SYS_BUS_DEVICE(obj); 556 557 object_initialize_child(obj, "mos6522-cuda", &s->mos6522_cuda, 558 TYPE_MOS6522_CUDA); 559 560 memory_region_init_io(&s->mem, obj, &mos6522_cuda_ops, s, "cuda", 0x2000); 561 sysbus_init_mmio(sbd, &s->mem); 562 563 qbus_create_inplace(&s->adb_bus, sizeof(s->adb_bus), TYPE_ADB_BUS, 564 DEVICE(obj), "adb.0"); 565 } 566 567 static Property cuda_properties[] = { 568 DEFINE_PROP_UINT64("timebase-frequency", CUDAState, tb_frequency, 0), 569 DEFINE_PROP_END_OF_LIST() 570 }; 571 572 static void cuda_class_init(ObjectClass *oc, void *data) 573 { 574 DeviceClass *dc = DEVICE_CLASS(oc); 575 576 dc->realize = cuda_realize; 577 dc->reset = cuda_reset; 578 dc->vmsd = &vmstate_cuda; 579 device_class_set_props(dc, cuda_properties); 580 set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); 581 } 582 583 static const TypeInfo cuda_type_info = { 584 .name = TYPE_CUDA, 585 .parent = TYPE_SYS_BUS_DEVICE, 586 .instance_size = sizeof(CUDAState), 587 .instance_init = cuda_init, 588 .class_init = cuda_class_init, 589 }; 590 591 static void mos6522_cuda_portB_write(MOS6522State *s) 592 { 593 MOS6522CUDAState *mcs = container_of(s, MOS6522CUDAState, parent_obj); 594 CUDAState *cs = container_of(mcs, CUDAState, mos6522_cuda); 595 596 cuda_update(cs); 597 } 598 599 static void mos6522_cuda_reset(DeviceState *dev) 600 { 601 MOS6522State *ms = MOS6522(dev); 602 MOS6522DeviceClass *mdc = MOS6522_DEVICE_GET_CLASS(ms); 603 604 mdc->parent_reset(dev); 605 606 ms->timers[0].frequency = CUDA_TIMER_FREQ; 607 ms->timers[1].frequency = (SCALE_US * 6000) / 4700; 608 } 609 610 static void mos6522_cuda_class_init(ObjectClass *oc, void *data) 611 { 612 DeviceClass *dc = DEVICE_CLASS(oc); 613 MOS6522DeviceClass *mdc = MOS6522_DEVICE_CLASS(oc); 614 615 dc->reset = mos6522_cuda_reset; 616 mdc->portB_write = mos6522_cuda_portB_write; 617 mdc->get_timer1_counter_value = cuda_get_counter_value; 618 mdc->get_timer2_counter_value = cuda_get_counter_value; 619 mdc->get_timer1_load_time = cuda_get_load_time; 620 mdc->get_timer2_load_time = cuda_get_load_time; 621 } 622 623 static const TypeInfo mos6522_cuda_type_info = { 624 .name = TYPE_MOS6522_CUDA, 625 .parent = TYPE_MOS6522, 626 .instance_size = sizeof(MOS6522CUDAState), 627 .class_init = mos6522_cuda_class_init, 628 }; 629 630 static void cuda_register_types(void) 631 { 632 type_register_static(&mos6522_cuda_type_info); 633 type_register_static(&cuda_type_info); 634 } 635 636 type_init(cuda_register_types) 637