trunk/src/emu/machine/pci.c
| r242247 | r242248 | |
| 4 | 4 | const device_type PCI_BRIDGE = &device_creator<pci_bridge_device>; |
| 5 | 5 | |
| 6 | 6 | DEVICE_ADDRESS_MAP_START(config_map, 32, pci_device) |
| 7 | | AM_RANGE(0x00, 0x03) AM_READ16 (vendor_r, 0x0000ffff) |
| 8 | | AM_RANGE(0x00, 0x03) AM_READ16 (device_r, 0xffff0000) |
| 9 | | AM_RANGE(0x04, 0x07) AM_READWRITE16(command_r, command_w, 0x0000ffff) |
| 10 | | AM_RANGE(0x04, 0x07) AM_READ16 (status_r, 0xffff0000) |
| 7 | AM_RANGE(0x00, 0x03) AM_READ16 (vendor_r, 0x0000ffff) |
| 8 | AM_RANGE(0x00, 0x03) AM_READ16 (device_r, 0xffff0000) |
| 9 | AM_RANGE(0x04, 0x07) AM_READWRITE16(command_r, command_w, 0x0000ffff) |
| 10 | AM_RANGE(0x04, 0x07) AM_READ16 (status_r, 0xffff0000) |
| 11 | 11 | AM_RANGE(0x08, 0x0b) AM_READ (class_rev_r) |
| 12 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (cache_line_size_r, 0x000000ff) |
| 13 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (latency_timer_r, 0x0000ff00) |
| 14 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (header_type_r, 0x00ff0000) |
| 15 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (bist_r, 0xff000000) |
| 16 | | AM_RANGE(0x10, 0x27) AM_READWRITE (address_base_r, address_base_w) |
| 12 | AM_RANGE(0x0c, 0x0f) AM_READ8 (cache_line_size_r, 0x000000ff) |
| 13 | AM_RANGE(0x0c, 0x0f) AM_READ8 (latency_timer_r, 0x0000ff00) |
| 14 | AM_RANGE(0x0c, 0x0f) AM_READ8 (header_type_r, 0x00ff0000) |
| 15 | AM_RANGE(0x0c, 0x0f) AM_READ8 (bist_r, 0xff000000) |
| 16 | AM_RANGE(0x10, 0x27) AM_READWRITE (address_base_r, address_base_w) |
| 17 | 17 | |
| 18 | | AM_RANGE(0x2c, 0x2f) AM_READ16 (subvendor_r, 0x0000ffff) |
| 19 | | AM_RANGE(0x2c, 0x2f) AM_READ16 (subsystem_r, 0xffff0000) |
| 18 | AM_RANGE(0x2c, 0x2f) AM_READ16 (subvendor_r, 0x0000ffff) |
| 19 | AM_RANGE(0x2c, 0x2f) AM_READ16 (subsystem_r, 0xffff0000) |
| 20 | 20 | AM_RANGE(0x2c, 0x2f) AM_WRITENOP |
| 21 | 21 | |
| 22 | | AM_RANGE(0x34, 0x37) AM_READ8 (capptr_r, 0x000000ff) |
| 22 | AM_RANGE(0x34, 0x37) AM_READ8 (capptr_r, 0x000000ff) |
| 23 | 23 | ADDRESS_MAP_END |
| 24 | 24 | |
| 25 | | DEVICE_ADDRESS_MAP_START(config_map, 32, pci_bridge_device) |
| 26 | | AM_RANGE(0x00, 0x03) AM_READ16 (vendor_r, 0x0000ffff) |
| 27 | | AM_RANGE(0x00, 0x03) AM_READ16 (device_r, 0xffff0000) |
| 28 | | AM_RANGE(0x04, 0x07) AM_READWRITE16(command_r, command_w, 0x0000ffff) |
| 29 | | AM_RANGE(0x04, 0x07) AM_READ16 (status_r, 0xffff0000) |
| 30 | | AM_RANGE(0x08, 0x0b) AM_READ (class_rev_r) |
| 31 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (cache_line_size_r, 0x000000ff) |
| 32 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (latency_timer_r, 0x0000ff00) |
| 33 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (header_type_r, 0x00ff0000) |
| 34 | | AM_RANGE(0x0c, 0x0f) AM_READ8 (bist_r, 0xff000000) |
| 35 | | AM_RANGE(0x10, 0x17) AM_READWRITE (b_address_base_r, b_address_base_w) |
| 36 | | AM_RANGE(0x18, 0x1b) AM_READWRITE8 (primary_bus_r, primary_bus_w, 0x000000ff) |
| 37 | | AM_RANGE(0x18, 0x1b) AM_READWRITE8 (secondary_bus_r, secondary_bus_w, 0x0000ff00) |
| 38 | | AM_RANGE(0x18, 0x1b) AM_READWRITE8 (subordinate_bus_r, subordinate_bus_w, 0x00ff0000) |
| 39 | | AM_RANGE(0x18, 0x1b) AM_READWRITE8 (secondary_latency_r, secondary_latency_w, 0xff000000) |
| 40 | | AM_RANGE(0x1c, 0x1f) AM_READWRITE8 (iobase_r, iobase_w, 0x000000ff) |
| 41 | | AM_RANGE(0x1c, 0x1f) AM_READWRITE8 (iolimit_r, iolimit_w, 0x0000ff00) |
| 42 | | AM_RANGE(0x1c, 0x1f) AM_READWRITE16(secondary_status_r, secondary_status_w, 0xffff0000) |
| 43 | | AM_RANGE(0x20, 0x23) AM_READWRITE16(memory_base_r, memory_base_w, 0x0000ffff) |
| 44 | | AM_RANGE(0x20, 0x23) AM_READWRITE16(memory_limit_r, memory_limit_w, 0xffff0000) |
| 45 | | AM_RANGE(0x24, 0x27) AM_READWRITE16(prefetch_base_r, prefetch_base_w, 0x0000ffff) |
| 46 | | AM_RANGE(0x24, 0x27) AM_READWRITE16(prefetch_limit_r, prefetch_limit_w, 0xffff0000) |
| 47 | | AM_RANGE(0x28, 0x2b) AM_READWRITE (prefetch_baseu_r, prefetch_baseu_w) |
| 48 | | AM_RANGE(0x2c, 0x2f) AM_READWRITE (prefetch_limitu_r, prefetch_limitu_w) |
| 49 | | AM_RANGE(0x30, 0x33) AM_READWRITE16(iobaseu_r, iobaseu_w, 0x0000ffff) |
| 50 | | AM_RANGE(0x30, 0x33) AM_READWRITE16(iolimitu_r, iolimitu_w, 0xffff0000) |
| 51 | | AM_RANGE(0x34, 0x37) AM_READ8 (capptr_r, 0x000000ff) |
| 52 | | AM_RANGE(0x38, 0x3b) AM_READWRITE (expansion_base_r, expansion_base_w) |
| 53 | | AM_RANGE(0x3c, 0x3f) AM_READWRITE8 (interrupt_line_r, interrupt_line_w, 0x000000ff) |
| 54 | | AM_RANGE(0x3c, 0x3f) AM_READWRITE8 (interrupt_pin_r, interrupt_pin_w, 0x0000ff00) |
| 55 | | AM_RANGE(0x3c, 0x3f) AM_READWRITE16(bridge_control_r, bridge_control_w, 0xffff0000) |
| 56 | | ADDRESS_MAP_END |
| 57 | | |
| 58 | 25 | pci_device::pci_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 59 | 26 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source) |
| 60 | 27 | { |
| r242247 | r242248 | |
| 394 | 361 | void pci_bridge_device::device_reset() |
| 395 | 362 | { |
| 396 | 363 | pci_device::device_reset(); |
| 397 | | |
| 398 | | bridge_control = 0x0000; |
| 399 | | primary_bus = 0x00; |
| 400 | | secondary_bus = 0x00; |
| 401 | | subordinate_bus = 0x00; |
| 402 | 364 | regenerate_config_mapping(); |
| 403 | 365 | } |
| 404 | 366 | |
| r242247 | r242248 | |
| 409 | 371 | all_devices[i]->reset_all_mappings(); |
| 410 | 372 | } |
| 411 | 373 | |
| 374 | |
| 412 | 375 | void pci_bridge_device::map_device(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space, |
| 413 | 376 | UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space) |
| 414 | 377 | { |
| r242247 | r242248 | |
| 431 | 394 | sub_devices[i]->map_config(i, config_space); |
| 432 | 395 | } |
| 433 | 396 | |
| 434 | | UINT32 pci_bridge_device::do_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 435 | | { |
| 436 | | if(sub_devices[device]) { |
| 437 | | UINT32 data = space(AS_PROGRAM).read_dword((device << 12) | reg, mem_mask); |
| 438 | | logerror("%s: config_read %02x:%02x.%x:%02x %08x @ %08x\n", tag(), bus, device >> 3, device & 7, reg, data, mem_mask); |
| 439 | | return data; |
| 440 | | } else |
| 441 | | return 0xffffffff; |
| 442 | | } |
| 443 | 397 | |
| 444 | | UINT32 pci_bridge_device::propagate_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 445 | | { |
| 446 | | UINT32 data = 0xffffffff; |
| 447 | | for(int i=0; i != all_bridges.count(); i++) |
| 448 | | data &= all_bridges[i]->config_read(bus, device, reg, mem_mask); |
| 449 | | return data; |
| 450 | | } |
| 451 | | |
| 452 | | UINT32 pci_bridge_device::config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 453 | | { |
| 454 | | if(bus == secondary_bus) |
| 455 | | return do_config_read(bus, device, reg, mem_mask); |
| 456 | | |
| 457 | | if(bus > secondary_bus && bus <= subordinate_bus) |
| 458 | | return propagate_config_read(bus, device, reg, mem_mask); |
| 459 | | |
| 460 | | return 0xffffffff; |
| 461 | | } |
| 462 | | |
| 463 | | void pci_bridge_device::do_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 464 | | { |
| 465 | | if(sub_devices[device]) { |
| 466 | | space(AS_PROGRAM).write_dword((device << 12) | reg, data, mem_mask); |
| 467 | | logerror("%s: config_write %02x:%02x.%x:%02x %08x @ %08x\n", tag(), bus, device >> 3, device & 7, reg, data, mem_mask); |
| 468 | | } |
| 469 | | } |
| 470 | | |
| 471 | | void pci_bridge_device::propagate_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 472 | | { |
| 473 | | for(int i=0; i != all_bridges.count(); i++) |
| 474 | | all_bridges[i]->config_write(bus, device, reg, data, mem_mask); |
| 475 | | } |
| 476 | | |
| 477 | | void pci_bridge_device::config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 478 | | { |
| 479 | | if(bus == secondary_bus) |
| 480 | | do_config_write(bus, device, reg, data, mem_mask); |
| 481 | | |
| 482 | | else if(bus > secondary_bus && bus <= subordinate_bus) |
| 483 | | propagate_config_write(bus, device, reg, data, mem_mask); |
| 484 | | } |
| 485 | | |
| 486 | | READ32_MEMBER (pci_bridge_device::b_address_base_r) |
| 487 | | { |
| 488 | | logerror("%s: b_address_base_r %d\n", tag(), offset); |
| 489 | | return 0xffffffff; |
| 490 | | } |
| 491 | | |
| 492 | | WRITE32_MEMBER(pci_bridge_device::b_address_base_w) |
| 493 | | { |
| 494 | | logerror("%s: b_address_base_w %d, %08x\n", tag(), offset, data); |
| 495 | | } |
| 496 | | |
| 497 | | READ8_MEMBER (pci_bridge_device::primary_bus_r) |
| 498 | | { |
| 499 | | logerror("%s: primary_bus_r\n", tag()); |
| 500 | | return primary_bus; |
| 501 | | } |
| 502 | | |
| 503 | | WRITE8_MEMBER (pci_bridge_device::primary_bus_w) |
| 504 | | { |
| 505 | | primary_bus = data; |
| 506 | | logerror("%s: primary_bus_w %02x\n", tag(), data); |
| 507 | | } |
| 508 | | |
| 509 | | READ8_MEMBER (pci_bridge_device::secondary_bus_r) |
| 510 | | { |
| 511 | | logerror("%s: secondary_bus_r\n", tag()); |
| 512 | | return secondary_bus; |
| 513 | | } |
| 514 | | |
| 515 | | WRITE8_MEMBER (pci_bridge_device::secondary_bus_w) |
| 516 | | { |
| 517 | | secondary_bus = data; |
| 518 | | logerror("%s: secondary_bus_w %02x\n", tag(), data); |
| 519 | | } |
| 520 | | |
| 521 | | READ8_MEMBER (pci_bridge_device::subordinate_bus_r) |
| 522 | | { |
| 523 | | logerror("%s: subordinate_bus_r\n", tag()); |
| 524 | | return subordinate_bus; |
| 525 | | } |
| 526 | | |
| 527 | | WRITE8_MEMBER (pci_bridge_device::subordinate_bus_w) |
| 528 | | { |
| 529 | | subordinate_bus = data; |
| 530 | | logerror("%s: subordinate_bus_w %02x\n", tag(), data); |
| 531 | | } |
| 532 | | |
| 533 | | READ8_MEMBER (pci_bridge_device::secondary_latency_r) |
| 534 | | { |
| 535 | | logerror("%s: secondary_latency_r\n", tag()); |
| 536 | | return 0xff; |
| 537 | | } |
| 538 | | |
| 539 | | WRITE8_MEMBER (pci_bridge_device::secondary_latency_w) |
| 540 | | { |
| 541 | | logerror("%s: secondary_latency_w %02x\n", tag(), data); |
| 542 | | } |
| 543 | | |
| 544 | | READ8_MEMBER (pci_bridge_device::iobase_r) |
| 545 | | { |
| 546 | | logerror("%s: iobase_r\n", tag()); |
| 547 | | return 0xff; |
| 548 | | } |
| 549 | | |
| 550 | | WRITE8_MEMBER (pci_bridge_device::iobase_w) |
| 551 | | { |
| 552 | | logerror("%s: iobase_w %02x\n", tag(), data); |
| 553 | | } |
| 554 | | |
| 555 | | READ8_MEMBER (pci_bridge_device::iolimit_r) |
| 556 | | { |
| 557 | | logerror("%s: iolimit_r\n", tag()); |
| 558 | | return 0xff; |
| 559 | | } |
| 560 | | |
| 561 | | WRITE8_MEMBER (pci_bridge_device::iolimit_w) |
| 562 | | { |
| 563 | | logerror("%s: iolimit_w %02x\n", tag(), data); |
| 564 | | } |
| 565 | | |
| 566 | | READ16_MEMBER (pci_bridge_device::secondary_status_r) |
| 567 | | { |
| 568 | | logerror("%s: secondary_status_r\n", tag()); |
| 569 | | return 0xffff; |
| 570 | | } |
| 571 | | |
| 572 | | WRITE16_MEMBER(pci_bridge_device::secondary_status_w) |
| 573 | | { |
| 574 | | logerror("%s: secondary_status_w %04x\n", tag(), data); |
| 575 | | } |
| 576 | | |
| 577 | | READ16_MEMBER (pci_bridge_device::memory_base_r) |
| 578 | | { |
| 579 | | logerror("%s: memory_base_r\n", tag()); |
| 580 | | return 0xffff; |
| 581 | | } |
| 582 | | |
| 583 | | WRITE16_MEMBER(pci_bridge_device::memory_base_w) |
| 584 | | { |
| 585 | | logerror("%s: memory_base_w %04x\n", tag(), data); |
| 586 | | } |
| 587 | | |
| 588 | | READ16_MEMBER (pci_bridge_device::memory_limit_r) |
| 589 | | { |
| 590 | | logerror("%s: memory_limit_r\n", tag()); |
| 591 | | return 0xffff; |
| 592 | | } |
| 593 | | |
| 594 | | WRITE16_MEMBER(pci_bridge_device::memory_limit_w) |
| 595 | | { |
| 596 | | logerror("%s: memory_limit_w %04x\n", tag(), data); |
| 597 | | } |
| 598 | | |
| 599 | | READ16_MEMBER (pci_bridge_device::prefetch_base_r) |
| 600 | | { |
| 601 | | logerror("%s: prefetch_base_r\n", tag()); |
| 602 | | return 0xffff; |
| 603 | | } |
| 604 | | |
| 605 | | WRITE16_MEMBER(pci_bridge_device::prefetch_base_w) |
| 606 | | { |
| 607 | | logerror("%s: prefetch_base_w %04x\n", tag(), data); |
| 608 | | } |
| 609 | | |
| 610 | | READ16_MEMBER (pci_bridge_device::prefetch_limit_r) |
| 611 | | { |
| 612 | | logerror("%s: prefetch_limit_r\n", tag()); |
| 613 | | return 0xffff; |
| 614 | | } |
| 615 | | |
| 616 | | WRITE16_MEMBER(pci_bridge_device::prefetch_limit_w) |
| 617 | | { |
| 618 | | logerror("%s: prefetch_limit_w %04x\n", tag(), data); |
| 619 | | } |
| 620 | | |
| 621 | | READ32_MEMBER (pci_bridge_device::prefetch_baseu_r) |
| 622 | | { |
| 623 | | logerror("%s: prefetch_baseu_r\n", tag()); |
| 624 | | return 0xffffffff; |
| 625 | | } |
| 626 | | |
| 627 | | WRITE32_MEMBER(pci_bridge_device::prefetch_baseu_w) |
| 628 | | { |
| 629 | | logerror("%s: prefetch_baseu_w %08x\n", tag(), data); |
| 630 | | } |
| 631 | | |
| 632 | | READ32_MEMBER (pci_bridge_device::prefetch_limitu_r) |
| 633 | | { |
| 634 | | logerror("%s: prefetch_limitu_r\n", tag()); |
| 635 | | return 0xffffffff; |
| 636 | | } |
| 637 | | |
| 638 | | WRITE32_MEMBER(pci_bridge_device::prefetch_limitu_w) |
| 639 | | { |
| 640 | | logerror("%s: prefetch_limitu_w %08x\n", tag(), data); |
| 641 | | } |
| 642 | | |
| 643 | | READ16_MEMBER (pci_bridge_device::iobaseu_r) |
| 644 | | { |
| 645 | | logerror("%s: iobaseu_r\n", tag()); |
| 646 | | return 0xffff; |
| 647 | | } |
| 648 | | |
| 649 | | WRITE16_MEMBER(pci_bridge_device::iobaseu_w) |
| 650 | | { |
| 651 | | logerror("%s: iobaseu_w %04x\n", tag(), data); |
| 652 | | } |
| 653 | | |
| 654 | | READ16_MEMBER (pci_bridge_device::iolimitu_r) |
| 655 | | { |
| 656 | | logerror("%s: iolimitu_r\n", tag()); |
| 657 | | return 0xffff; |
| 658 | | } |
| 659 | | |
| 660 | | WRITE16_MEMBER(pci_bridge_device::iolimitu_w) |
| 661 | | { |
| 662 | | logerror("%s: iolimitu_w %04x\n", tag(), data); |
| 663 | | } |
| 664 | | |
| 665 | | READ32_MEMBER (pci_bridge_device::expansion_base_r) |
| 666 | | { |
| 667 | | logerror("%s: expansion_base_r\n", tag()); |
| 668 | | return 0xffffffff; |
| 669 | | } |
| 670 | | |
| 671 | | WRITE32_MEMBER(pci_bridge_device::expansion_base_w) |
| 672 | | { |
| 673 | | logerror("%s: expansion_base_w %08x\n", tag(), data); |
| 674 | | } |
| 675 | | |
| 676 | | READ8_MEMBER (pci_bridge_device::interrupt_line_r) |
| 677 | | { |
| 678 | | logerror("%s: interrupt_line_r\n", tag()); |
| 679 | | return 0xff; |
| 680 | | } |
| 681 | | |
| 682 | | WRITE8_MEMBER (pci_bridge_device::interrupt_line_w) |
| 683 | | { |
| 684 | | logerror("%s: interrupt_line_w %02x\n", tag(), data); |
| 685 | | } |
| 686 | | |
| 687 | | READ8_MEMBER (pci_bridge_device::interrupt_pin_r) |
| 688 | | { |
| 689 | | logerror("%s: interrupt_pin_r\n", tag()); |
| 690 | | return 0xff; |
| 691 | | } |
| 692 | | |
| 693 | | WRITE8_MEMBER (pci_bridge_device::interrupt_pin_w) |
| 694 | | { |
| 695 | | logerror("%s: interrupt_pin_w %02x\n", tag(), data); |
| 696 | | } |
| 697 | | |
| 698 | | READ16_MEMBER (pci_bridge_device::bridge_control_r) |
| 699 | | { |
| 700 | | logerror("%s: bridge_control_r\n", tag()); |
| 701 | | return bridge_control; |
| 702 | | } |
| 703 | | |
| 704 | | WRITE16_MEMBER(pci_bridge_device::bridge_control_w) |
| 705 | | { |
| 706 | | COMBINE_DATA(&bridge_control); |
| 707 | | logerror("%s: bridge_control_w %04x\n", tag(), bridge_control); |
| 708 | | } |
| 709 | | |
| 710 | | |
| 711 | 398 | agp_bridge_device::agp_bridge_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) |
| 712 | 399 | : pci_bridge_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 713 | 400 | { |
| r242247 | r242248 | |
| 786 | 473 | |
| 787 | 474 | READ32_MEMBER(pci_host_device::config_data_r) |
| 788 | 475 | { |
| 789 | | return config_address & 0x80000000 ? root_config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff; |
| 476 | return config_address & 0x80000000 ? config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff; |
| 790 | 477 | } |
| 791 | 478 | |
| 792 | 479 | WRITE32_MEMBER(pci_host_device::config_data_w) |
| 793 | 480 | { |
| 794 | 481 | if(config_address & 0x80000000) |
| 795 | | root_config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); |
| 482 | config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); |
| 796 | 483 | } |
| 797 | 484 | |
| 798 | | UINT32 pci_host_device::root_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 485 | UINT32 pci_host_device::config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 799 | 486 | { |
| 800 | | if(bus == 0x00) |
| 801 | | return do_config_read(bus, device, reg, mem_mask); |
| 487 | UINT32 data = 0xffffffff; |
| 488 | if(!bus) { |
| 489 | if(sub_devices[device]) { |
| 490 | data = space(AS_PROGRAM).read_dword((device << 12) | reg, mem_mask); |
| 491 | logerror("config_read %02x:%02x.%x:%02x %08x @ %08x\n", bus, device >> 3, device & 7, reg, data, mem_mask); |
| 492 | } |
| 493 | } else |
| 494 | abort(); |
| 802 | 495 | |
| 803 | | return propagate_config_read(bus, device, reg, mem_mask); |
| 496 | return data; |
| 804 | 497 | } |
| 805 | 498 | |
| 806 | | void pci_host_device::root_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 499 | void pci_host_device::config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 807 | 500 | { |
| 808 | | if(bus == 0x00) |
| 809 | | do_config_write(bus, device, reg, data, mem_mask); |
| 810 | | |
| 811 | | else |
| 812 | | propagate_config_write(bus, device, reg, data, mem_mask); |
| 501 | if(!bus) { |
| 502 | if(sub_devices[device]) { |
| 503 | space(AS_PROGRAM).write_dword((device << 12) | reg, data, mem_mask); |
| 504 | logerror("config_write %02x:%02x.%x:%02x %08x @ %08x\n", bus, device >> 3, device & 7, reg, data, mem_mask); |
| 505 | } |
| 506 | } else |
| 507 | abort(); |
| 813 | 508 | } |
| 814 | 509 | |
| 815 | 510 | |
trunk/src/emu/machine/pci.h
| r242247 | r242248 | |
| 139 | 139 | |
| 140 | 140 | virtual DECLARE_READ8_MEMBER(header_type_r); |
| 141 | 141 | |
| 142 | | virtual DECLARE_ADDRESS_MAP(config_map, 32); |
| 143 | | |
| 144 | | DECLARE_READ32_MEMBER (b_address_base_r); |
| 145 | | DECLARE_WRITE32_MEMBER(b_address_base_w); |
| 146 | | DECLARE_READ8_MEMBER (primary_bus_r); |
| 147 | | DECLARE_WRITE8_MEMBER (primary_bus_w); |
| 148 | | DECLARE_READ8_MEMBER (secondary_bus_r); |
| 149 | | DECLARE_WRITE8_MEMBER (secondary_bus_w); |
| 150 | | DECLARE_READ8_MEMBER (subordinate_bus_r); |
| 151 | | DECLARE_WRITE8_MEMBER (subordinate_bus_w); |
| 152 | | DECLARE_READ8_MEMBER (secondary_latency_r); |
| 153 | | DECLARE_WRITE8_MEMBER (secondary_latency_w); |
| 154 | | DECLARE_READ8_MEMBER (iobase_r); |
| 155 | | DECLARE_WRITE8_MEMBER (iobase_w); |
| 156 | | DECLARE_READ8_MEMBER (iolimit_r); |
| 157 | | DECLARE_WRITE8_MEMBER (iolimit_w); |
| 158 | | DECLARE_READ16_MEMBER (secondary_status_r); |
| 159 | | DECLARE_WRITE16_MEMBER(secondary_status_w); |
| 160 | | DECLARE_READ16_MEMBER (memory_base_r); |
| 161 | | DECLARE_WRITE16_MEMBER(memory_base_w); |
| 162 | | DECLARE_READ16_MEMBER (memory_limit_r); |
| 163 | | DECLARE_WRITE16_MEMBER(memory_limit_w); |
| 164 | | DECLARE_READ16_MEMBER (prefetch_base_r); |
| 165 | | DECLARE_WRITE16_MEMBER(prefetch_base_w); |
| 166 | | DECLARE_READ16_MEMBER (prefetch_limit_r); |
| 167 | | DECLARE_WRITE16_MEMBER(prefetch_limit_w); |
| 168 | | DECLARE_READ32_MEMBER (prefetch_baseu_r); |
| 169 | | DECLARE_WRITE32_MEMBER(prefetch_baseu_w); |
| 170 | | DECLARE_READ32_MEMBER (prefetch_limitu_r); |
| 171 | | DECLARE_WRITE32_MEMBER(prefetch_limitu_w); |
| 172 | | DECLARE_READ16_MEMBER (iobaseu_r); |
| 173 | | DECLARE_WRITE16_MEMBER(iobaseu_w); |
| 174 | | DECLARE_READ16_MEMBER (iolimitu_r); |
| 175 | | DECLARE_WRITE16_MEMBER(iolimitu_w); |
| 176 | | DECLARE_READ32_MEMBER (expansion_base_r); |
| 177 | | DECLARE_WRITE32_MEMBER(expansion_base_w); |
| 178 | | DECLARE_READ8_MEMBER (interrupt_line_r); |
| 179 | | DECLARE_WRITE8_MEMBER (interrupt_line_w); |
| 180 | | DECLARE_READ8_MEMBER (interrupt_pin_r); |
| 181 | | DECLARE_WRITE8_MEMBER (interrupt_pin_w); |
| 182 | | DECLARE_READ16_MEMBER (bridge_control_r); |
| 183 | | DECLARE_WRITE16_MEMBER(bridge_control_w); |
| 184 | | |
| 185 | 142 | protected: |
| 186 | 143 | pci_device *sub_devices[32*8]; |
| 187 | 144 | dynamic_array<pci_device *> all_devices; |
| 188 | | dynamic_array<pci_bridge_device *> all_bridges; |
| 145 | dynamic_array<pci_device *> all_bridges; |
| 189 | 146 | |
| 190 | | UINT8 primary_bus, secondary_bus, subordinate_bus; |
| 191 | | UINT16 bridge_control; |
| 192 | | |
| 193 | 147 | virtual void device_start(); |
| 194 | 148 | virtual void device_reset(); |
| 195 | 149 | virtual const address_space_config *memory_space_config(address_spacenum spacenum) const; |
| r242247 | r242248 | |
| 197 | 151 | virtual device_t *bus_root(); |
| 198 | 152 | virtual void regenerate_config_mapping(); |
| 199 | 153 | |
| 200 | | UINT32 do_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask); |
| 201 | | UINT32 propagate_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask); |
| 202 | | UINT32 config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask); |
| 203 | | void do_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask); |
| 204 | | void propagate_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask); |
| 205 | | void config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask); |
| 206 | | |
| 207 | 154 | private: |
| 208 | 155 | address_space_config configure_space_config; |
| 209 | 156 | }; |
| r242247 | r242248 | |
| 241 | 188 | DECLARE_READ32_MEMBER(config_data_r); |
| 242 | 189 | DECLARE_WRITE32_MEMBER(config_data_w); |
| 243 | 190 | |
| 244 | | UINT32 root_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask); |
| 245 | | void root_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask); |
| 191 | UINT32 config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask); |
| 192 | void config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask); |
| 246 | 193 | |
| 247 | 194 | void regenerate_mapping(); |
| 248 | 195 | }; |
trunk/src/mess/drivers/tsispch.c
| r242247 | r242248 | |
| 157 | 157 | READ8_MEMBER( tsispch_state::dsw_r ) |
| 158 | 158 | { |
| 159 | 159 | /* the only dipswitch I'm really sure about is s4-7 which enables the test mode |
| 160 | | * The switches are, for normal operation on my unit: |
| 160 | * The switches are, for normal operation on my unit (and the older unit as well): |
| 161 | 161 | * 1 2 3 4 5 6 7 8 |
| 162 | 162 | * ON ON OFF OFF OFF OFF OFF OFF |
| 163 | 163 | * which makes this register read 0xFC |
| r242247 | r242248 | |
| 227 | 227 | upd7725->snesdsp_write(false, data); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p0_w ) |
| 231 | { |
| 232 | fprintf(stderr, "upd772x changed p0 state to %d!\n",state); |
| 233 | //TODO: do stuff here! |
| 234 | } |
| 235 | |
| 236 | WRITE_LINE_MEMBER( tsispch_state::dsp_to_8086_p1_w ) |
| 237 | { |
| 238 | fprintf(stderr, "upd772x changed p1 state to %d!\n",state); |
| 239 | //TODO: do stuff here! |
| 240 | } |
| 241 | |
| 230 | 242 | /***************************************************************************** |
| 231 | 243 | Reset and Driver Init |
| 232 | 244 | *****************************************************************************/ |
| 233 | 245 | void tsispch_state::machine_reset() |
| 234 | 246 | { |
| 235 | | // clear fifos (TODO: memset would work better here...) |
| 236 | | int i; |
| 237 | | for (i=0; i<32; i++) m_infifo[i] = 0; |
| 238 | | m_infifo_tail_ptr = m_infifo_head_ptr = 0; |
| 239 | 247 | fprintf(stderr,"machine reset\n"); |
| 240 | 248 | } |
| 241 | 249 | |
| r242247 | r242248 | |
| 381 | 389 | MCFG_CPU_ADD("dsp", UPD7725, 8000000) /* VERIFIED clock, unknown divider; correct dsp type is UPD77P20 */ |
| 382 | 390 | MCFG_CPU_PROGRAM_MAP(dsp_prg_map) |
| 383 | 391 | MCFG_CPU_DATA_MAP(dsp_data_map) |
| 392 | MCFG_NECDSP_OUT_P0_CB(WRITELINE(tsispch_state, dsp_to_8086_p0_w)) |
| 393 | MCFG_NECDSP_OUT_P1_CB(WRITELINE(tsispch_state, dsp_to_8086_p1_w)) |
| 384 | 394 | |
| 385 | 395 | /* PIC 8259 */ |
| 386 | 396 | MCFG_PIC8259_ADD("pic8259", INPUTLINE("maincpu", 0), VCC, NULL) |
| r242247 | r242248 | |
| 513 | 523 | ROMX_LOAD( "v1.1__14__speech__plus__(c)1983.am2764.14.u28", 0xfc000, 0x2000, CRC(E616BD6E) SHA1(5DFAE2C5079D89F791C9D7166F9504231A464203),ROM_SKIP(1)) |
| 514 | 524 | ROMX_LOAD( "v1.1__15__speech__plus__(c)1983.am2764.15.u51", 0xfc001, 0x2000, CRC(BEB1FA19) SHA1(72130FE45C3FD3DE7CF794936DC68ED2D4193DAF),ROM_SKIP(1)) |
| 515 | 525 | |
| 516 | | // TSI/Speech plus DSP firmware v?.? (no sticker, but S140025 printed on chip), unlabeled chip, but clearly a NEC UPD77P20C ceramic |
| 517 | | // NOT DUMPED YET, using the 3.12 dsp firmware as a placeholder |
| 526 | // TSI/Speech plus DSP firmware v?.? (no sticker, but S140025 printed on chip), unlabeled chip, but clearly a NEC UPD7720C ceramic |
| 527 | // NOT DUMPED YET, using the 3.12 dsp firmware as a placeholder, since the dsp on the older board is MASK ROM and doesn't dump easily |
| 518 | 528 | ROM_REGION( 0x600, "dspprgload", 0) // packed 24 bit data |
| 519 | | ROM_LOAD( "s140025__dsp_prog.u29", 0x0000, 0x0600, BAD_DUMP CRC(9E46425A) SHA1(80A915D731F5B6863AEEB448261149FF15E5B786)) |
| 529 | ROM_LOAD( "s140025__dsp_prog.u29", 0x0000, 0x0600, NO_DUMP) |
| 530 | ROM_LOAD( "v3.12__8-9-88__dsp_prog.u29", 0x0000, 0x0600, CRC(9E46425A) SHA1(80A915D731F5B6863AEEB448261149FF15E5B786)) // temp placeholder |
| 520 | 531 | ROM_REGION( 0x800, "dspprg", ROMREGION_ERASEFF) // for unpacking 24 bit data into 32 bit data which cpu core can understand |
| 521 | 532 | ROM_REGION( 0x400, "dspdata", 0) |
| 522 | | ROM_LOAD( "s140025__dsp_data.u29", 0x0000, 0x0400, BAD_DUMP CRC(F4E4DD16) SHA1(6E184747DB2F26E45D0E02907105FF192E51BABA)) |
| 533 | ROM_LOAD( "s140025__dsp_data.u29", 0x0000, 0x0400, NO_DUMP) |
| 534 | ROM_LOAD( "v3.12__8-9-88__dsp_data.u29", 0x0000, 0x0400, CRC(F4E4DD16) SHA1(6E184747DB2F26E45D0E02907105FF192E51BABA)) // temp placeholder |
| 523 | 535 | |
| 524 | 536 | ROM_REGION(0x1000, "proms", 0) |
| 525 | 537 | ROM_LOAD( "dm74s288n.u77", 0x0000, 0x0020, CRC(A88757FC) SHA1(9066D6DBC009D7A126D75B8461CA464DDF134412)) // == am27s19.u77 |