Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b0fc889c authored by Chandru's avatar Chandru Committed by Jesse Barnes
Browse files

PCI hotplug: ibmphp: read the length of ebda and map entire ebda region



ibmphp driver currently maps only 1KB of ebda memory area into kernel address
space during driver initialization. This causes kernel oops when the driver is
modprobe'd and it accesses memory beyond 1KB within ebda segment. The first
byte of ebda segment actually stores the length of the ebda region in
Kilobytes. Hence make use of the length parameter and map the entire ebda
region.

Signed-off-by: default avatarChandru Siddalingappa <chandru@linux.vnet.ibm.com>
Signed-off-by: default avatarJesse Barnes <jbarnes@virtuousgeek.org>
parent 6fcaf17a
Loading
Loading
Loading
Loading
+9 −2
Original line number Original line Diff line number Diff line
@@ -245,7 +245,7 @@ static void __init print_ebda_hpc (void)


int __init ibmphp_access_ebda (void)
int __init ibmphp_access_ebda (void)
{
{
	u8 format, num_ctlrs, rio_complete, hs_complete;
	u8 format, num_ctlrs, rio_complete, hs_complete, ebda_sz;
	u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base;
	u16 ebda_seg, num_entries, next_offset, offset, blk_id, sub_addr, re, rc_id, re_id, base;
	int rc = 0;
	int rc = 0;


@@ -260,7 +260,14 @@ int __init ibmphp_access_ebda (void)
	iounmap (io_mem);
	iounmap (io_mem);
	debug ("returned ebda segment: %x\n", ebda_seg);
	debug ("returned ebda segment: %x\n", ebda_seg);
	
	
	io_mem = ioremap(ebda_seg<<4, 1024);
	io_mem = ioremap(ebda_seg<<4, 1);
	ebda_sz = readb(io_mem);
	iounmap(io_mem);
	debug("ebda size: %d(KiB)\n", ebda_sz);
	if (ebda_sz == 0)
		return -ENOMEM;

	io_mem = ioremap(ebda_seg<<4, (ebda_sz * 1024));
	if (!io_mem )
	if (!io_mem )
		return -ENOMEM;
		return -ENOMEM;
	next_offset = 0x180;
	next_offset = 0x180;