[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) ...@@ -274,14 +274,20 @@ static void ide_pio_sector(ide_drive_t *drive, unsigned int write)
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
unsigned long flags; unsigned long flags;
#endif #endif
unsigned int offset;
u8 *buf; u8 *buf;
page = sg[hwif->cursg].page; 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 #ifdef CONFIG_HIGHMEM
local_irq_save(flags); local_irq_save(flags);
#endif #endif
buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + buf = kmap_atomic(page, KM_BIO_SRC_IRQ) + offset;
sg[hwif->cursg].offset + (hwif->cursg_ofs * SECTOR_SIZE);
hwif->nleft--; hwif->nleft--;
hwif->cursg_ofs++; 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