mcb: mcb-pci: Only remap the 1st 0x200 bytes of BAR 0
authorJohannes Thumshirn <johannes.thumshirn@men.de>
Tue, 16 Dec 2014 09:09:20 +0000 (10:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 10 Nov 2018 15:39:16 +0000 (07:39 -0800)
commit17a4b61833db0fd17164dfa7762cf6354d794e3f
tree4b9e2c89dfb8a2b3307bf2c1c02605a9c04c44a3
parent924dfb717e891f8a004434935ef7cb14916a5319
mcb: mcb-pci: Only remap the 1st 0x200 bytes of BAR 0

[ Upstream commit 7b7c54914f73966976893747ee8e2ca58166a627 ]

Currently it is not possible to have a kernel with built-in MCB attached
devices. This results out of the fact that mcb-pci requests PCI BAR 0, then
parses the chameleon table and calls the driver's probe function before
releasing BAR 0 again. When building the kernel with modules this is not a
problem (and therefore it wasn't detected by my tests yet).

A solution is to only remap the 1st 0x200 bytes of a Chameleon PCI device.
0x200 bytes is the maximum size of a Chameleon v2 Table.

Also this patch stops disabling the PCI device on successful registration of MCB
devices.

Signed-off-by: Johannes Thumshirn <johannes.thumshirn@men.de>
Suggested-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/mcb/mcb-internal.h
drivers/mcb/mcb-pci.c