[SeaBIOS] ISA device and shared memory

Albin Kauffmann albin.kauffmann at gmail.com
Thu Jul 26 17:23:15 CEST 2012


Hello,

I'm trying to add the support for an old com90c65 ISA card (a network 
device using the old ARCnet protocol and handled by the com90xx Linux 
module). This device is using both IO ports and IO memory.

The I/O ports are working and the code is largely inspired from the 
ne2k_isa support. However, I have not find the right way to register the 
I/O memory. I've tried the following code :


static const MemoryRegionOps com90c65_mmio_ops = {
     .read = com90c65_mmio_read,
     .write = com90c65_mmio_write,
     .endianness = DEVICE_NATIVE_ENDIAN,
};

[...]

memory_region_init_io(&s->mmio, &com90c65_mmio_ops, s, "com90c65-mmio",
                       size);
memory_region_add_subregion(isa_address_space(dev),
                             isa_mem_base + isa->mmiobase, &s->mmio);


Depending on mmiobase, I get :
  - mmiobase == 0xd0000 : no error message but debuging QEMU shows me 
that my read/write functions are not called.
  - mmiobase == 0xd0800 : the following error :
qemu-system-i386: [...]/qemu-1.1.0/exec.c:2371: register_subpage: 
Assertion `existing->mr->subpage || existing->mr == &io_mem_unassigned' 
failed

Because the ISA and PCI memory areas seem to overlap and as the ISA bus 
is accessed via a PCI to ISA bridge, they might be something else to 
initialize but I can't find what and browsing the QEMU code didn't help me.

However, I have managed to make it work by using a call to 
memory_region_add_subregion_overlap() with a priority bigger than the 
PCI one (priority >= 2) but it only works with mmiobase == 0xd0000.

As it might also be a seabios configuration problem, I have added the 
seabios mailing list in the recipients.

In attachement, you'll find the output of info mtree, info qtree and the 
logs of seabios.

Any help will be really appreciated,
Thanks :)

-- 
Albin Kauffmann
-------------- next part --------------
Start bios (version rel-1.7.0-0-ga026308-dirty-20120417_104821-rincewind.home.kraxel.org)
Ram Size=0x08000000 (0x0000000000000000 high)
Relocating init from 0x000e31b0 to 0x07fe13b0 (size 60196)
CPU Mhz=2344
=== PCI bus & bridge init ===
PCI: pci_bios_init_bus_rec bus = 0x0
=== PCI device probing ===
Found 6 PCI devices (max PCI bus is 00)
=== PCI new allocation pass #1 ===
PCI: check devices
=== PCI new allocation pass #2 ===
PCI: init bases bus 0 (primary)
  type io max 40 sum 50 base c000
    size       40: 1 bar(s),     c000 ->     c03f
    size       10: 1 bar(s),     c040 ->     c04f
  type mem max 20000 sum 51000 base feba0000
    size    20000: 2 bar(s), feba0000 -> febdffff
    size    10000: 1 bar(s), febe0000 -> febeffff
    size     1000: 1 bar(s), febf0000 -> febf0fff
  type prefmem max 2000000 sum 2000000 base fc000000
    size  2000000: 1 bar(s), fc000000 -> fdffffff
PCI: map device bdf=00:00.0
PCI: map device bdf=00:01.0
PCI: map device bdf=00:01.1
  bar 4, addr c040, size 10 [io]
PCI: map device bdf=00:01.3
PCI: map device bdf=00:02.0
  bar 0, addr fc000000, size 2000000 [prefmem]
  bar 1, addr febf0000, size 1000 [mem]
  bar 6, addr febe0000, size 10000 [mem]
PCI: map device bdf=00:03.0
  bar 0, addr feba0000, size 20000 [mem]
  bar 1, addr c000, size 40 [io]
  bar 6, addr febc0000, size 20000 [mem]
PCI: init bdf=00:00.0 id=8086:1237
PCI: init bdf=00:01.0 id=8086:7000
PCI: init bdf=00:01.1 id=8086:7010
PCI: init bdf=00:01.3 id=8086:7113
PCI: init bdf=00:02.0 id=1013:00b8
PCI: init bdf=00:03.0 id=8086:100e
PIIX3/PIIX4 init: elcr=00 0c
Found 1 cpu(s) max supported 1 cpu(s)
MP table addr=0x000fda70 MPC table addr=0x000fda80 size=224
SMBIOS ptr=0x000fda50 table=0x000fd940 size=263
ACPI DSDT=0x07ffe5f0
ACPI tables: RSDP=0x000fd910 RSDT=0x07ffe5b0
Scan for VGA option rom
Running option rom at c000:0003
Turning on vga text mode console
SeaBIOS (version rel-1.7.0-0-ga026308-dirty-20120417_104821-rincewind.home.kraxel.org)

Found 1 lpt ports
Found 1 serial ports
Searching bootorder for: /pci at i0cf8/isa at 1/fdc at 03f0/floppy at 0
ATA controller 1 at 1f0/3f4/0 (irq 14 dev 9)
ATA controller 2 at 170/374/0 (irq 15 dev 9)
DVD/CD [ata1-0: QEMU DVD-ROM ATAPI-4 DVD/CD]
Searching bootorder for: /pci at i0cf8/*@1,1/drive at 1/disk at 0
PS2 keyboard initialized
All threads complete.
Scan for option roms
Running option rom at c900:0003
pmm call arg1=1
pmm call arg1=0
pmm call arg1=1
pmm call arg1=0
Running option rom at cc80:0003
Searching bootorder for: /pci at i0cf8/*@3
Searching bootorder for: /rom at genroms/kvmvapic.bin
Searching bootorder for: /rom at genroms/linuxboot.bin
Running option rom at ca00:0003
ebda moved from 9fc00 to 9f400
Returned 57344 bytes of ZoneHigh
e820 map has 6 items:
  0: 0000000000000000 - 000000000009f400 = 1 RAM
  1: 000000000009f400 - 00000000000a0000 = 2 RESERVED
  2: 00000000000f0000 - 0000000000100000 = 2 RESERVED
  3: 0000000000100000 - 0000000007ffe000 = 1 RAM
  4: 0000000007ffe000 - 0000000008000000 = 2 RESERVED
  5: 00000000fffc0000 - 0000000100000000 = 2 RESERVED
enter handle_19:
  NULL
Booting from ROM...
Booting from cc80:003c
-------------- next part --------------
memory
0000000000000000-7ffffffffffffffe (prio 0, RW): system
  0000000000000000-0000000007ffffff (prio 0, RW): alias ram-below-4g @pc.ram 0000000000000000-0000000007ffffff
  00000000000a0000-00000000000bffff (prio 1, RW): alias smram-region @pci 00000000000a0000-00000000000bffff
  00000000000c0000-00000000000c3fff (prio 1, R-): alias pam-rom @pc.ram 00000000000c0000-00000000000c3fff
  00000000000c4000-00000000000c7fff (prio 1, R-): alias pam-rom @pc.ram 00000000000c4000-00000000000c7fff
  00000000000c8000-00000000000cbfff (prio 1, R-): alias pam-rom @pc.ram 00000000000c8000-00000000000cbfff
  00000000000ca000-00000000000ccfff (prio 1000, RW): alias kvmvapic-rom @pc.ram 00000000000ca000-00000000000ccfff
  00000000000cc000-00000000000cffff (prio 1, R-): alias pam-rom @pc.ram 00000000000cc000-00000000000cffff
  00000000000d0000-00000000000d3fff (prio 1, RW): alias pam-ram @pc.ram 00000000000d0000-00000000000d3fff
  00000000000d0000-00000000000d07ff (prio 0, RW): com90c65-mmio
  00000000000d4000-00000000000d7fff (prio 1, RW): alias pam-ram @pc.ram 00000000000d4000-00000000000d7fff
  00000000000d8000-00000000000dbfff (prio 1, RW): alias pam-ram @pc.ram 00000000000d8000-00000000000dbfff
  00000000000dc000-00000000000dffff (prio 1, RW): alias pam-ram @pc.ram 00000000000dc000-00000000000dffff
  00000000000e0000-00000000000e3fff (prio 1, RW): alias pam-ram @pc.ram 00000000000e0000-00000000000e3fff
  00000000000e4000-00000000000e7fff (prio 1, RW): alias pam-ram @pc.ram 00000000000e4000-00000000000e7fff
  00000000000e8000-00000000000ebfff (prio 1, RW): alias pam-ram @pc.ram 00000000000e8000-00000000000ebfff
  00000000000ec000-00000000000effff (prio 1, RW): alias pam-ram @pc.ram 00000000000ec000-00000000000effff
  00000000000f0000-00000000000fffff (prio 1, R-): alias pam-rom @pc.ram 00000000000f0000-00000000000fffff
  0000000008000000-00000000ffffffff (prio 0, RW): alias pci-hole @pci 0000000008000000-00000000ffffffff
  00000000fec00000-00000000fec00fff (prio 0, RW): ioapic
  00000000fed00000-00000000fed003ff (prio 0, RW): hpet
  00000000fee00000-00000000feefffff (prio 0, RW): apic-msi
  00000000fffe0000-00000000ffffffff (prio 0, R-): system.flash
  0000000100000000-40000000ffffffff (prio 0, RW): alias pci-hole64 @pci 0000000100000000-40000000ffffffff
I/O
0000000000000000-000000000000ffff (prio 0, RW): io
  0000000000000020-0000000000000021 (prio 0, RW): pic
  0000000000000040-0000000000000043 (prio 0, RW): pit
  0000000000000060-0000000000000060 (prio 0, RW): i8042-data
  0000000000000061-0000000000000061 (prio 0, RW): elcr
  0000000000000064-0000000000000064 (prio 0, RW): i8042-cmd
  0000000000000070-0000000000000071 (prio 0, RW): rtc
  000000000000007e-000000000000007f (prio 0, RW): kvmvapic
  0000000000000092-0000000000000092 (prio 0, RW): port92
  00000000000000a0-00000000000000a1 (prio 0, RW): pic
  0000000000000170-0000000000000177 (prio 0, RW): alias ide @ide 0000000000000170-0000000000000177
  00000000000001f0-00000000000001f7 (prio 0, RW): alias ide @ide 00000000000001f0-00000000000001f7
  00000000000002e0-00000000000002ef (prio 0, RW): com90c65-io
  0000000000000376-0000000000000376 (prio 0, RW): alias ide @ide 0000000000000376-0000000000000376
  0000000000000378-000000000000037f (prio 0, RW): alias parallel @parallel 0000000000000378-000000000000037f
  00000000000003f1-00000000000003f5 (prio 0, RW): alias fdc @fdc 00000000000003f1-00000000000003f5
  00000000000003f6-00000000000003f6 (prio 0, RW): alias ide @ide 00000000000003f6-00000000000003f6
  00000000000003f7-00000000000003f7 (prio 0, RW): alias fdc @fdc 00000000000003f7-00000000000003f7
  00000000000003f8-00000000000003ff (prio 0, RW): serial
  00000000000004d0-00000000000004d0 (prio 0, RW): elcr
  00000000000004d1-00000000000004d1 (prio 0, RW): elcr
  0000000000000510-0000000000000511 (prio 0, RW): fwcfg
  0000000000000cf8-0000000000000cfb (prio 0, RW): pci-conf-idx
  0000000000000cfc-0000000000000cff (prio 0, RW): pci-conf-data
  0000000000005658-0000000000005658 (prio 0, RW): vmport
  000000000000c000-000000000000c03f (prio 1, RW): e1000-io
  000000000000c040-000000000000c04f (prio 1, RW): piix-bmdma-container
    000000000000c040-000000000000c043 (prio 0, RW): piix-bmdma
    000000000000c044-000000000000c047 (prio 0, RW): bmdma
    000000000000c048-000000000000c04b (prio 0, RW): piix-bmdma
    000000000000c04c-000000000000c04f (prio 0, RW): bmdma
aliases
pc.ram
0000000000000000-0000000007ffffff (prio 0, RW): pc.ram
pci
0000000000000000-7ffffffffffffffe (prio 0, RW): pci
  00000000000a0000-00000000000bffff (prio 1, RW): cirrus-lowmem-container
    00000000000a0000-00000000000a7fff (prio 1, RW): alias vga.bank0 @vga.vram 0000000000000000-0000000000007fff
    00000000000a0000-00000000000bffff (prio 0, RW): cirrus-low-memory
    00000000000a8000-00000000000affff (prio 1, RW): alias vga.bank1 @vga.vram 0000000000008000-000000000000ffff
  00000000000c0000-00000000000dffff (prio 1, RW): pc.rom
  00000000000e0000-00000000000fffff (prio 1, R-): isa-bios
  00000000fc000000-00000000fdffffff (prio 1, RW): cirrus-pci-bar0
    00000000fc000000-00000000fc7fffff (prio 1, RW): vga.vram
    00000000fc000000-00000000fc7fffff (prio 0, RW): cirrus-linear-io
    00000000fd000000-00000000fd3fffff (prio 0, RW): cirrus-bitblt-mmio
  00000000feba0000-00000000febbffff (prio 1, RW): e1000-mmio
  00000000febf0000-00000000febf0fff (prio 1, RW): cirrus-mmio
ide
0000000000000000-7ffffffffffffffe (prio 0, RW): ide
ide
0000000000000000-7ffffffffffffffe (prio 0, RW): ide
ide
0000000000000000-7ffffffffffffffe (prio 0, RW): ide
parallel
0000000000000000-7ffffffffffffffe (prio 0, RW): parallel
fdc
0000000000000000-7ffffffffffffffe (prio 0, RW): fdc
ide
0000000000000000-7ffffffffffffffe (prio 0, RW): ide
fdc
0000000000000000-7ffffffffffffffe (prio 0, RW): fdc
vga.vram
0000000000000000-00000000007fffff (prio 1, RW): vga.vram
-------------- next part --------------
bus: main-system-bus
  type System
  dev: hpet, id ""
    gpio-in 2
    gpio-out 1
    dev-prop: timers = 3
    dev-prop: msi = off
    irq 32
    mmio 00000000fed00000/0000000000000400
  dev: ioapic, id ""
    gpio-in 24
    irq 0
    mmio 00000000fec00000/0000000000001000
  dev: i440FX-pcihost, id ""
    irq 0
    bus: pci.0
      type PCI
      dev: PIIX4_PM, id ""
        dev-prop: smb_io_base = 45312
        bus-prop: addr = 01.3
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        bus-prop: command_serr_enable = on
        class Bridge, addr 00:01.3, pci id 8086:7113 (sub 1af4:1100)
        bus: i2c
          type I2C
          dev: smbus-eeprom, id ""
            bus-prop: address = 87
          dev: smbus-eeprom, id ""
            bus-prop: address = 86
          dev: smbus-eeprom, id ""
            bus-prop: address = 85
          dev: smbus-eeprom, id ""
            bus-prop: address = 84
          dev: smbus-eeprom, id ""
            bus-prop: address = 83
          dev: smbus-eeprom, id ""
            bus-prop: address = 82
          dev: smbus-eeprom, id ""
            bus-prop: address = 81
          dev: smbus-eeprom, id ""
            bus-prop: address = 80
      dev: piix3-ide, id ""
        bus-prop: addr = 01.1
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        bus-prop: command_serr_enable = on
        class IDE controller, addr 00:01.1, pci id 8086:7010 (sub 1af4:1100)
        bar 4: i/o at 0xc040 [0xc04f]
        bus: ide.1
          type IDE
          dev: ide-cd, id ""
            dev-prop: drive = ide1-cd0
            dev-prop: logical_block_size = 512
            dev-prop: physical_block_size = 512
            dev-prop: min_io_size = 0
            dev-prop: opt_io_size = 0
            dev-prop: bootindex = -1
            dev-prop: discard_granularity = 0
            dev-prop: ver = "1.1.0-ow"
            dev-prop: wwn = 0x0
            dev-prop: serial = "QM00003"
            dev-prop: model = <null>
            bus-prop: unit = 0
        bus: ide.0
          type IDE
      dev: e1000, id ""
        dev-prop: mac = 52:54:00:12:34:56
        dev-prop: vlan = 0
        dev-prop: netdev = <null>
        dev-prop: bootindex = -1
        bus-prop: addr = 03.0
        bus-prop: romfile = "pxe-e1000.rom"
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        bus-prop: command_serr_enable = on
        class Ethernet controller, addr 00:03.0, pci id 8086:100e (sub 1af4:1100)
        bar 0: mem at 0xfeba0000 [0xfebbffff]
        bar 1: i/o at 0xc000 [0xc03f]
        bar 6: mem at 0xffffffffffffffff [0x1fffe]
      dev: cirrus-vga, id ""
        bus-prop: addr = 02.0
        bus-prop: romfile = "vgabios-cirrus.bin"
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        bus-prop: command_serr_enable = on
        class VGA controller, addr 00:02.0, pci id 1013:00b8 (sub 1af4:1100)
        bar 0: mem at 0xfc000000 [0xfdffffff]
        bar 1: mem at 0xfebf0000 [0xfebf0fff]
        bar 6: mem at 0xffffffffffffffff [0xfffe]
      dev: PIIX3, id ""
        bus-prop: addr = 01.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        bus-prop: multifunction = on
        bus-prop: command_serr_enable = on
        class ISA bridge, addr 00:01.0, pci id 8086:7000 (sub 1af4:1100)
        bus: isa.0
          type ISA
          dev: com90c65_isa, id ""
            dev-prop: iobase = 0x2e0
            dev-prop: irq = 5
            dev-prop: mmiobase = 0xd0000
            dev-prop: nodeid = 256
            dev-prop: mac = 52:54:00:12:34:57
            dev-prop: vlan = 1
            dev-prop: netdev = <null>
            dev-prop: bootindex = -1
            isa irq 5
          dev: isa-fdc, id ""
            dev-prop: iobase = 0x3f0
            dev-prop: irq = 6
            dev-prop: dma = 2
            dev-prop: driveA = floppy0
            dev-prop: driveB = <null>
            dev-prop: bootindexA = -1
            dev-prop: bootindexB = -1
            dev-prop: check_media_rate = on
            isa irq 6
          dev: port92, id ""
          dev: vmmouse, id ""
          dev: vmport, id ""
          dev: i8042, id ""
            isa irqs 1,12
          dev: isa-parallel, id ""
            dev-prop: index = 0
            dev-prop: iobase = 0x378
            dev-prop: irq = 7
            dev-prop: chardev = parallel0
            isa irq 7
          dev: isa-serial, id ""
            dev-prop: index = 0
            dev-prop: iobase = 0x3f8
            dev-prop: irq = 4
            dev-prop: chardev = serial0
            dev-prop: wakeup = 0
            isa irq 4
          dev: isa-pcspk, id ""
            dev-prop: iobase = 0x61
          dev: isa-pit, id ""
            gpio-in 1
            gpio-out 1
            dev-prop: iobase = 0x40
          dev: mc146818rtc, id ""
            dev-prop: base_year = 2000
            dev-prop: lost_tick_policy = discard
          dev: isa-i8259, id ""
            gpio-in 8
            gpio-out 1
            dev-prop: iobase = 0xa0
            dev-prop: elcr_addr = 0x4d1
            dev-prop: elcr_mask = 0xde
            dev-prop: master = off
          dev: isa-i8259, id ""
            gpio-in 8
            gpio-out 1
            dev-prop: iobase = 0x20
            dev-prop: elcr_addr = 0x4d0
            dev-prop: elcr_mask = 0xf8
            dev-prop: master = on
      dev: i440FX, id ""
        bus-prop: addr = 00.0
        bus-prop: romfile = <null>
        bus-prop: rombar = 1
        bus-prop: multifunction = off
        bus-prop: command_serr_enable = on
        class Host bridge, addr 00:00.0, pci id 8086:1237 (sub 1af4:1100)
  dev: fw_cfg, id ""
    dev-prop: ctl_iobase = 0x510
    dev-prop: data_iobase = 0x511
    irq 0
    mmio ffffffffffffffff/0000000000000002
    mmio ffffffffffffffff/0000000000000001
  dev: pc-sysfw, id ""
    dev-prop: rom_only = 0
    irq 0
  dev: kvmvapic, id ""
    irq 0
  dev: apic, id ""
    dev-prop: id = 0
    dev-prop: vapic = on
    irq 0
    mmio 00000000fee00000/0000000000100000


More information about the SeaBIOS mailing list