From 00ed6db419f9878a1998461c128e9c2faaecfe35 Mon Sep 17 00:00:00 2001 From: Laurent Vivier Date: Thu, 15 Jan 2009 02:17:00 +0000 Subject: [PATCH] ide: improve support of MMIO ide controller git-svn-id: svn://coreboot.org/openbios/openbios-devel@409 f158a5a8-5612-0410-a976-696ce0be7e32 --- drivers/ide.c | 26 ++++++++++++++------------ drivers/ide.h | 16 +++++++++++----- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/drivers/ide.c b/drivers/ide.c index d2316b9..27dd154 100644 --- a/drivers/ide.c +++ b/drivers/ide.c @@ -89,27 +89,29 @@ static void dump_drive(struct ide_drive *drive) * old style io port operations */ static unsigned char -ob_ide_inb(unsigned long port) +ob_ide_inb(struct ide_channel *chan, unsigned int port) { - return inb(port); + return inb(chan->io_regs[port]); } static void -ob_ide_outb(unsigned char data, unsigned long port) +ob_ide_outb(struct ide_channel *chan, unsigned char data, unsigned int port) { - outb(data, port); + outb(data, chan->io_regs[port]); } static void -ob_ide_insw(unsigned long port, unsigned char *addr, unsigned int count) +ob_ide_insw(struct ide_channel *chan, + unsigned int port, unsigned char *addr, unsigned int count) { - insw(port, addr, count); + insw(chan->io_regs[port], addr, count); } static void -ob_ide_outsw(unsigned long port, unsigned char *addr, unsigned int count) +ob_ide_outsw(struct ide_channel *chan, + unsigned int port, unsigned char *addr, unsigned int count) { - outsw(port, addr, count); + outsw(chan->io_regs[port], addr, count); } static inline unsigned char @@ -117,7 +119,7 @@ ob_ide_pio_readb(struct ide_drive *drive, unsigned int offset) { struct ide_channel *chan = drive->channel; - return chan->obide_inb(chan->io_regs[offset]); + return chan->obide_inb(chan, offset); } static inline void @@ -126,7 +128,7 @@ ob_ide_pio_writeb(struct ide_drive *drive, unsigned int offset, { struct ide_channel *chan = drive->channel; - chan->obide_outb(data, chan->io_regs[offset]); + chan->obide_outb(chan, data, offset); } static inline void @@ -140,7 +142,7 @@ ob_ide_pio_insw(struct ide_drive *drive, unsigned int offset, return; } - chan->obide_insw(chan->io_regs[offset], addr, len / 2); + chan->obide_insw(chan, offset, addr, len / 2); } static inline void @@ -154,7 +156,7 @@ ob_ide_pio_outsw(struct ide_drive *drive, unsigned int offset, return; } - chan->obide_outsw(chan->io_regs[offset], addr, len / 2); + chan->obide_outsw(chan, offset, addr, len / 2); } static void diff --git a/drivers/ide.h b/drivers/ide.h index c002817..29cdcc9 100644 --- a/drivers/ide.h +++ b/drivers/ide.h @@ -169,16 +169,22 @@ struct ide_channel { /* * either mmio or io_regs is set to indicate mmio or not */ - int mmio; + unsigned long mmio; int io_regs[10]; /* * can be set to a mmio hook, default it legacy outb/inb */ - void (*obide_outb)(unsigned char addr, unsigned long port); - unsigned char (*obide_inb)(unsigned long port); - void (*obide_insw)(unsigned long port, unsigned char *addr, unsigned int count); - void (*obide_outsw)(unsigned long port, unsigned char *addr, unsigned int count); + void (*obide_outb)(struct ide_channel *chan, + unsigned char addr, unsigned int port); + unsigned char (*obide_inb)(struct ide_channel *chan, + unsigned int port); + void (*obide_insw)(struct ide_channel *chan, + unsigned int port, unsigned char *addr, + unsigned int count); + void (*obide_outsw)(struct ide_channel *chan, + unsigned int port, unsigned char *addr, + unsigned int count); struct ide_drive drives[2]; char selected;