[PATCH] missing bus_alloc_resouce() calls for i8259

Robert Millan rmh at debian.org
Mon Aug 8 20:17:35 UTC 2011


Attached patch fixes this problem when booting the MALTA flavour on QEMU:

  le0: <AMD PCnet-PCI> irq 0 at device 11.0 on pci0
  le0: Lazy allocation of 0x20 bytes rid 0x10 type 4 at 0x20
  qemu: hardware error: register_ioport_write: invalid opaque

>From QEMU side, it appears that this I/O allocation is using the wrong
address: 0x20 is reserved for the i8259 controller.

>From FreeBSD kernel side, it appears that 0x20 is assigned to le
driver because it hasn't been allocated by anybody else. i8259 is
hooked to PCI bus on MALTA (or at least on QEMU/MALTA), but there's no
corresponding bus_alloc_resource() call.

So I've added bus_alloc_resource() calls to register the i8259 as a
child of GT64120 PCI bridge. It appears to work, as QEMU now breaks
when allocating le ports at 0x40 rather than 0x20:

  le0: <AMD PCnet-PCI> irq 0 at device 11.0 on pci0
  le0: Lazy allocation of 0x20 bytes rid 0x10 type 4 at 0x40
  qemu: hardware error: register_ioport_write: invalid opaque

0x40 is for i8254 controller.  I could not find code to use this
controller, but looking at platform_start() for MALTA I assume time is
tracked by CPU count register without any external time source (not
even for calibration! is that so?), and therefore i8254 is not used.
Is there supposed to be a bus_alloc_resource() explicitly for i8254
too?

I'm not sure if my patch is the right approach.  In case it is, I know
it's a bit kludgy; if you're interested, I could clean it up for your
consideration.  I'd propose adding a new function that takes care of
i8259 stuff separately from gt_attach(), including
bus_alloc_resource() registration and the register initialization
above that.

-- 
Robert Millan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 006_mips_i8259_alloc.diff
Type: text/x-patch
Size: 694 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-mips/attachments/20110808/f48ea907/006_mips_i8259_alloc.bin


More information about the freebsd-mips mailing list