aboutsummaryrefslogtreecommitdiffstats
path: root/xen-2.4.16
diff options
context:
space:
mode:
authoriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-02-15 15:50:48 +0000
committeriap10@labyrinth.cl.cam.ac.uk <iap10@labyrinth.cl.cam.ac.uk>2003-02-15 15:50:48 +0000
commite2c3c2e000c3614809e4033fd65ea331296ad7e8 (patch)
treed175b459157ddfbc52a6520e7a059541ee1726f6 /xen-2.4.16
parent5e166880cd3c1f576c11942646afefca61514afa (diff)
downloadxen-e2c3c2e000c3614809e4033fd65ea331296ad7e8.tar.gz
xen-e2c3c2e000c3614809e4033fd65ea331296ad7e8.tar.bz2
xen-e2c3c2e000c3614809e4033fd65ea331296ad7e8.zip
bitkeeper revision 1.43 (3e4e61d8nVp2Sx8XMCpKhj4KfuEEVQ)
Partial fix to ensure that the IDE driver maps buffers into Xen memoey before doing PIO cycles to them. The ATAPI case has not been covered, and the mappings are short lived and conservative. Hopefully this code path will not be used for bulk data transfer due to DMA.
Diffstat (limited to 'xen-2.4.16')
-rw-r--r--xen-2.4.16/drivers/ide/ide-taskfile.c13
-rw-r--r--xen-2.4.16/drivers/ide/ide.c28
2 files changed, 34 insertions, 7 deletions
diff --git a/xen-2.4.16/drivers/ide/ide-taskfile.c b/xen-2.4.16/drivers/ide/ide-taskfile.c
index 578af55156..6e1286165f 100644
--- a/xen-2.4.16/drivers/ide/ide-taskfile.c
+++ b/xen-2.4.16/drivers/ide/ide-taskfile.c
@@ -27,6 +27,7 @@
#include <xeno/hdreg.h>
#include <xeno/ide.h>
+#include <asm/domain_page.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
@@ -82,10 +83,12 @@ static inline void task_vlb_sync (ide_ioreg_t port) {
/*
* This is used for most PIO data transfers *from* the IDE interface
*/
-void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ata_input_data (ide_drive_t *drive, void *vbuffer, unsigned int wcount)
{
byte io_32bit = drive->io_32bit;
+ void *buffer = map_domain_mem(virt_to_phys(vbuffer));
+
if (io_32bit) {
#if SUPPORT_VLB_SYNC
if (io_32bit & 2) {
@@ -110,15 +113,19 @@ void ata_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
#endif /* SUPPORT_SLOW_DATA_PORTS */
insw(IDE_DATA_REG, buffer, wcount<<1);
}
+
+ unmap_domain_mem(buffer);
}
/*
* This is used for most PIO data transfers *to* the IDE interface
*/
-void ata_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ata_output_data (ide_drive_t *drive, void *vbuffer, unsigned int wcount)
{
byte io_32bit = drive->io_32bit;
+ void *buffer = map_domain_mem(virt_to_phys(vbuffer));
+
if (io_32bit) {
#if SUPPORT_VLB_SYNC
if (io_32bit & 2) {
@@ -143,6 +150,8 @@ void ata_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
#endif /* SUPPORT_SLOW_DATA_PORTS */
outsw(IDE_DATA_REG, buffer, wcount<<1);
}
+
+ unmap_domain_mem(buffer);
}
diff --git a/xen-2.4.16/drivers/ide/ide.c b/xen-2.4.16/drivers/ide/ide.c
index 51cee21f77..1db4e34834 100644
--- a/xen-2.4.16/drivers/ide/ide.c
+++ b/xen-2.4.16/drivers/ide/ide.c
@@ -149,6 +149,7 @@
/*#include <xeno/completion.h>*/
/*#include <xeno/reboot.h>*/
+#include <asm/domain_page.h>
#include <asm/byteorder.h>
#include <asm/irq.h>
#include <asm/uaccess.h>
@@ -413,8 +414,9 @@ static inline void do_vlb_sync (ide_ioreg_t port) {
/*
* This is used for most PIO data transfers *from* the IDE interface
*/
-void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ide_input_data (ide_drive_t *drive, void *vbuffer, unsigned int wcount)
{
+ void *buffer;
byte io_32bit;
/* first check if this controller has defined a special function
@@ -423,10 +425,17 @@ void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
if(HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_ide_input_data,
- drive, buffer, wcount);
+ drive, vbuffer, wcount);
return;
}
+ /* We assume controllers own functions will make their own
+ * arrangemnets for mapping/unmaping the destination mem if
+ * required (or not if DMA)
+ */
+
+ buffer = map_domain_mem(virt_to_phys(vbuffer));
+
io_32bit = drive->io_32bit;
if (io_32bit) {
@@ -453,21 +462,26 @@ void ide_input_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
#endif /* SUPPORT_SLOW_DATA_PORTS */
insw(IDE_DATA_REG, buffer, wcount<<1);
}
+
+ unmap_domain_mem(buffer);
}
/*
* This is used for most PIO data transfers *to* the IDE interface
*/
-void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
+void ide_output_data (ide_drive_t *drive, void *vbuffer, unsigned int wcount)
{
+ void *buffer;
byte io_32bit;
if(HWIF(drive)->ideproc) {
HWIF(drive)->ideproc(ideproc_ide_output_data,
- drive, buffer, wcount);
+ drive, vbuffer, wcount);
return;
}
+ buffer = map_domain_mem(virt_to_phys(vbuffer));
+
io_32bit = drive->io_32bit;
if (io_32bit) {
@@ -494,6 +508,8 @@ void ide_output_data (ide_drive_t *drive, void *buffer, unsigned int wcount)
#endif /* SUPPORT_SLOW_DATA_PORTS */
outsw(IDE_DATA_REG, buffer, wcount<<1);
}
+
+ unmap_domain_mem(buffer);
}
/*
@@ -510,7 +526,7 @@ void atapi_input_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecount
drive, buffer, bytecount);
return;
}
-
+printk("XXXXX atapi_input_bytes called -- mapping is likely broken\n");
++bytecount;
#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
if (MACH_IS_ATARI || MACH_IS_Q40) {
@@ -532,6 +548,8 @@ void atapi_output_bytes (ide_drive_t *drive, void *buffer, unsigned int bytecoun
return;
}
+printk("XXXXX atapi_output_bytes called -- mapping is likely broken\n");
+
++bytecount;
#if defined(CONFIG_ATARI) || defined(CONFIG_Q40)
if (MACH_IS_ATARI || MACH_IS_Q40) {