diff -r 3da6885cee9d configs/common/FSConfig.py --- a/configs/common/FSConfig.py Fri Jun 13 16:48:47 2014 +0800 +++ b/configs/common/FSConfig.py Wed Jun 18 09:28:51 2014 +0800 @@ -338,14 +338,15 @@ x86_sys.bridge = Bridge(delay='50ns') x86_sys.bridge.master = x86_sys.iobus.slave x86_sys.bridge.slave = x86_sys.membus.master - # Allow the bridge to pass through the IO APIC (two pages), - # everything in the IO address range up to the local APIC, and - # then the entire PCI address space and beyond + # Allow the bridge to pass through: + # 1) kernel configured PCI device memory map address (range of [mem_size+1, 4GB)), + # 2) the bridge to pass through the IO APIC (two pages, already contained in 1), + # 3) everything in the IO address range up to the local APIC, and + # 4) then the entire PCI address space and beyond x86_sys.bridge.ranges = \ [ - AddrRange(x86_sys.pc.south_bridge.io_apic.pio_addr, - x86_sys.pc.south_bridge.io_apic.pio_addr + - APIC_range_size - 1), + AddrRange(x86_sys.mem_ranges[0].end + 1, + 0xFFFFFFFF), AddrRange(IO_address_space_base, interrupts_address_space_base - 1), AddrRange(pci_config_address_space_base, @@ -423,6 +424,17 @@ disk2.childImage(disk('linux-bigswap2.img')) self.pc.south_bridge.ide.disks = [disk0, disk2] + # Ethernet + # - connect to PCI bus (bus_id=0) + # - connect to I/O APIC use INT-A (InterruptPin=1) + # - use IRQ#10 (open for the use of peripherals) + # - ref http://http://en.wikipedia.org/wiki/Interrupt_request#x86_IRQs + self.pc.ethernet = IGbE_e1000(pci_bus=0, pci_dev=2, pci_func=0, + InterruptLine=10, InterruptPin=1) + self.pc.ethernet.pio = self.iobus.master + self.pc.ethernet.config = self.iobus.master + self.pc.ethernet.dma = self.iobus.slave + # Add in a Bios information structure. structures = [X86SMBiosBiosInformation()] self.smbios_table.structures = structures @@ -444,18 +456,21 @@ address = 0xfec00000) self.pc.south_bridge.io_apic.apic_id = io_apic.id base_entries.append(io_apic) - isa_bus = X86IntelMPBus(bus_id = 0, bus_type='ISA') + # In gem5 Pc::calcPciConfigAddr(), it required "assert(bus==0)", + # but linux kernel cannot config PCI device if it was not connected to PCI bus, + # so we fix PCI bus id to 0, and ISA bus id to 1. + pci_bus = X86IntelMPBus(bus_id = 0, bus_type='PCI') + base_entries.append(pci_bus) + isa_bus = X86IntelMPBus(bus_id = 1, bus_type='ISA') base_entries.append(isa_bus) - pci_bus = X86IntelMPBus(bus_id = 1, bus_type='PCI') - base_entries.append(pci_bus) - connect_busses = X86IntelMPBusHierarchy(bus_id=0, - subtractive_decode=True, parent_bus=1) + connect_busses = X86IntelMPBusHierarchy(bus_id=1, + subtractive_decode=True, parent_bus=0) ext_entries.append(connect_busses) pci_dev4_inta = X86IntelMPIOIntAssignment( interrupt_type = 'INT', polarity = 'ConformPolarity', trigger = 'ConformTrigger', - source_bus_id = 1, + source_bus_id = 0, source_bus_irq = 0 + (4 << 2), dest_io_apic_id = io_apic.id, dest_io_apic_intin = 16) @@ -465,7 +480,7 @@ interrupt_type = 'ExtInt', polarity = 'ConformPolarity', trigger = 'ConformTrigger', - source_bus_id = 0, + source_bus_id = 1, source_bus_irq = irq, dest_io_apic_id = io_apic.id, dest_io_apic_intin = 0) @@ -474,7 +489,7 @@ interrupt_type = 'INT', polarity = 'ConformPolarity', trigger = 'ConformTrigger', - source_bus_id = 0, + source_bus_id = 1, source_bus_irq = irq, dest_io_apic_id = io_apic.id, dest_io_apic_intin = apicPin)