trunk/src/emu/machine/pci.c
| r242248 | r242249 | |
| 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 | |
| 25 | 58 | 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) |
| 26 | 59 | : device_t(mconfig, type, name, tag, owner, clock, shortname, source) |
| 27 | 60 | { |
| r242248 | r242249 | |
| 361 | 394 | void pci_bridge_device::device_reset() |
| 362 | 395 | { |
| 363 | 396 | pci_device::device_reset(); |
| 397 | |
| 398 | bridge_control = 0x0000; |
| 399 | primary_bus = 0x00; |
| 400 | secondary_bus = 0x00; |
| 401 | subordinate_bus = 0x00; |
| 364 | 402 | regenerate_config_mapping(); |
| 365 | 403 | } |
| 366 | 404 | |
| r242248 | r242249 | |
| 371 | 409 | all_devices[i]->reset_all_mappings(); |
| 372 | 410 | } |
| 373 | 411 | |
| 374 | | |
| 375 | 412 | void pci_bridge_device::map_device(UINT64 memory_window_start, UINT64 memory_window_end, UINT64 memory_offset, address_space *memory_space, |
| 376 | 413 | UINT64 io_window_start, UINT64 io_window_end, UINT64 io_offset, address_space *io_space) |
| 377 | 414 | { |
| r242248 | r242249 | |
| 394 | 431 | sub_devices[i]->map_config(i, config_space); |
| 395 | 432 | } |
| 396 | 433 | |
| 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 | } |
| 397 | 443 | |
| 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 | |
| 398 | 711 | 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) |
| 399 | 712 | : pci_bridge_device(mconfig, type, name, tag, owner, clock, shortname, source) |
| 400 | 713 | { |
| r242248 | r242249 | |
| 473 | 786 | |
| 474 | 787 | READ32_MEMBER(pci_host_device::config_data_r) |
| 475 | 788 | { |
| 476 | | return config_address & 0x80000000 ? config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff; |
| 789 | return config_address & 0x80000000 ? root_config_read((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, mem_mask) : 0xffffffff; |
| 477 | 790 | } |
| 478 | 791 | |
| 479 | 792 | WRITE32_MEMBER(pci_host_device::config_data_w) |
| 480 | 793 | { |
| 481 | 794 | if(config_address & 0x80000000) |
| 482 | | config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); |
| 795 | root_config_write((config_address >> 16) & 0xff, (config_address >> 8) & 0xff, config_address & 0xfc, data, mem_mask); |
| 483 | 796 | } |
| 484 | 797 | |
| 485 | | UINT32 pci_host_device::config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 798 | UINT32 pci_host_device::root_config_read(UINT8 bus, UINT8 device, UINT16 reg, UINT32 mem_mask) |
| 486 | 799 | { |
| 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(); |
| 800 | if(bus == 0x00) |
| 801 | return do_config_read(bus, device, reg, mem_mask); |
| 495 | 802 | |
| 496 | | return data; |
| 803 | return propagate_config_read(bus, device, reg, mem_mask); |
| 497 | 804 | } |
| 498 | 805 | |
| 499 | | void pci_host_device::config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 806 | void pci_host_device::root_config_write(UINT8 bus, UINT8 device, UINT16 reg, UINT32 data, UINT32 mem_mask) |
| 500 | 807 | { |
| 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(); |
| 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); |
| 508 | 813 | } |
| 509 | 814 | |
| 510 | 815 | |
trunk/src/emu/machine/pci.h
| r242248 | r242249 | |
| 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 | |
| 142 | 185 | protected: |
| 143 | 186 | pci_device *sub_devices[32*8]; |
| 144 | 187 | dynamic_array<pci_device *> all_devices; |
| 145 | | dynamic_array<pci_device *> all_bridges; |
| 188 | dynamic_array<pci_bridge_device *> all_bridges; |
| 146 | 189 | |
| 190 | UINT8 primary_bus, secondary_bus, subordinate_bus; |
| 191 | UINT16 bridge_control; |
| 192 | |
| 147 | 193 | virtual void device_start(); |
| 148 | 194 | virtual void device_reset(); |
| 149 | 195 | virtual const address_space_config *memory_space_config(address_spacenum spacenum) const; |
| r242248 | r242249 | |
| 151 | 197 | virtual device_t *bus_root(); |
| 152 | 198 | virtual void regenerate_config_mapping(); |
| 153 | 199 | |
| 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 | |
| 154 | 207 | private: |
| 155 | 208 | address_space_config configure_space_config; |
| 156 | 209 | }; |
| r242248 | r242249 | |
| 188 | 241 | DECLARE_READ32_MEMBER(config_data_r); |
| 189 | 242 | DECLARE_WRITE32_MEMBER(config_data_w); |
| 190 | 243 | |
| 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); |
| 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); |
| 193 | 246 | |
| 194 | 247 | void regenerate_mapping(); |
| 195 | 248 | }; |