[ide] PIO bugfix

We need to k[un]map_atomic() the current page not the first page
of the scatterlist segment.  Fixes OOPS when using HIGHMEM.

Big thanks to Randy Dunlap for a lot of debugging/testing.
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent b8a16e88
......@@ -274,14 +274,20 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write)
#ifdef CONFIG_HIGHMEM
unsigned long flags;
#endif
unsigned int offset;
u8 *buf;
page = sg[hwif->cursg].page;
offset = sg[hwif->cursg].offset + hwif->cursg_ofs * SECTOR_SIZE;
/* get the current page and offset */
page = nth_page(page, (offset >> PAGE_SHIFT));
offset %= PAGE_SIZE;
#ifdef CONFIG_HIGHMEM
local_irq_save(flags);
#endif
buf = kmap_atomic(page, KM_BIO_SRC_IRQ) +
sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
hwif->nleft--;
hwif->cursg_ofs++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment