mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: PATCH: module for legacy PC9800 ide
  2003-03-21 19:28 PATCH: module for legacy PC9800 ide Alan Cox
@ 2003-03-21 18:59 ` Christoph Hellwig
  2003-03-21 20:24   ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2003-03-21 18:59 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, torvalds

On Fri, Mar 21, 2003 at 07:28:45PM +0000, Alan Cox wrote:
> +	/* These ports are probably used by IDE I/F.  */
> +	request_region(0x430, 1, "ide");
> +	request_region(0x435, 1, "ide");

No error chechking?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* PATCH: module for legacy PC9800 ide
@ 2003-03-21 19:28 Alan Cox
  2003-03-21 18:59 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2003-03-21 19:28 UTC (permalink / raw)
  To: linux-kernel, torvalds

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux-2.5.65/drivers/ide/legacy/pc9800.c linux-2.5.65-ac2/drivers/ide/legacy/pc9800.c
--- linux-2.5.65/drivers/ide/legacy/pc9800.c	1970-01-01 01:00:00.000000000 +0100
+++ linux-2.5.65-ac2/drivers/ide/legacy/pc9800.c	2003-03-14 01:19:31.000000000 +0000
@@ -0,0 +1,80 @@
+/*
+ *  ide_pc9800.c
+ *
+ *  Copyright (C) 1997-2000  Linux/98 project,
+ *			     Kyoto University Microcomputer Club.
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/ioport.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/pc9800.h>
+
+#define PC9800_IDE_BANKSELECT	0x432
+
+#undef PC9800_IDE_DEBUG
+
+static void pc9800_select(ide_drive_t *drive)
+{
+#ifdef PC9800_IDE_DEBUG
+	byte old;
+
+	/* Too noisy: */
+	/* printk(KERN_DEBUG "pc9800_select(%s)\n", drive->name); */
+
+	outb(0x80, PC9800_IDE_BANKSELECT);
+	old = inb(PC9800_IDE_BANKSELECT);
+	if (old != HWIF(drive)->index)
+		printk(KERN_DEBUG "ide-pc9800: switching bank #%d -> #%d\n",
+			old, HWIF(drive)->index);
+#endif
+	outb(HWIF(drive)->index, PC9800_IDE_BANKSELECT);
+}
+
+void __init ide_probe_for_pc9800(void)
+{
+	u8 saved_bank;
+
+	if (!PC9800_9821_P() /* || !PC9821_IDEIF_DOUBLE_P() */)
+		return;
+
+	if (!request_region(PC9800_IDE_BANKSELECT, 1, "ide0/1 bank")) {
+		printk(KERN_ERR
+			"ide: bank select port (%#x) is already occupied!\n",
+			PC9800_IDE_BANKSELECT);
+		return;
+	}
+
+	/* Do actual probing. */
+	if ((saved_bank = inb(PC9800_IDE_BANKSELECT)) == (u8) ~0
+	    || (outb(saved_bank ^ 1, PC9800_IDE_BANKSELECT),
+		/* Next outb is dummy for reading status. */
+		outb(0x80, PC9800_IDE_BANKSELECT),
+		inb(PC9800_IDE_BANKSELECT) != (saved_bank ^ 1))) {
+		printk(KERN_INFO
+			"ide: pc9800 type bank selecting port not found\n");
+		release_region(PC9800_IDE_BANKSELECT, 1);
+		return;
+	}
+
+	/* Restore original value, just in case. */
+	outb(saved_bank, PC9800_IDE_BANKSELECT);
+
+	/* These ports are probably used by IDE I/F.  */
+	request_region(0x430, 1, "ide");
+	request_region(0x435, 1, "ide");
+
+	if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET] == HD_DATA &&
+	    ide_hwifs[1].io_ports[IDE_DATA_OFFSET] == HD_DATA) {
+		ide_hwifs[0].chipset = ide_pc9800;
+		ide_hwifs[0].mate = &ide_hwifs[1];
+		ide_hwifs[0].selectproc = pc9800_select;
+		ide_hwifs[1].chipset = ide_pc9800;
+		ide_hwifs[1].mate = &ide_hwifs[0];
+		ide_hwifs[1].selectproc = pc9800_select;
+	}
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: module for legacy PC9800 ide
  2003-03-21 18:59 ` Christoph Hellwig
@ 2003-03-21 20:24   ` Alan Cox
  2003-03-22  0:47     ` Osamu Tomita
  0 siblings, 1 reply; 5+ messages in thread
From: Alan Cox @ 2003-03-21 20:24 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: Linux Kernel Mailing List, tomita

On Fri, 2003-03-21 at 18:59, Christoph Hellwig wrote:
> On Fri, Mar 21, 2003 at 07:28:45PM +0000, Alan Cox wrote:
> > +	/* These ports are probably used by IDE I/F.  */
> > +	request_region(0x430, 1, "ide");
> > +	request_region(0x435, 1, "ide");
> 
> No error chechking?

If it fails you have a rather bigger problem on your hands.

I agree however - Osamu, can you fix this

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: module for legacy PC9800 ide
  2003-03-21 20:24   ` Alan Cox
@ 2003-03-22  0:47     ` Osamu Tomita
  2003-03-22 15:14       ` Alan Cox
  0 siblings, 1 reply; 5+ messages in thread
From: Osamu Tomita @ 2003-03-22  0:47 UTC (permalink / raw)
  To: Alan Cox, Christoph Hellwig; +Cc: Linus Torvalds, Linux Kernel Mailing List

On Fri, Mar 21, 2003 at 08:24:44PM +0000, Alan Cox wrote:
> On Fri, 2003-03-21 at 18:59, Christoph Hellwig wrote:
> > On Fri, Mar 21, 2003 at 07:28:45PM +0000, Alan Cox wrote:
> > > +	/* These ports are probably used by IDE I/F.  */
> > > +	request_region(0x430, 1, "ide");
> > > +	request_region(0x435, 1, "ide");
> > 
> > No error chechking?
> 
> If it fails you have a rather bigger problem on your hands.
> 
> I agree however - Osamu, can you fix this
Thanks.
Could you plese replace patch by this one.
Some PC-98 has these port, not all PC-98. These ports are connected to
IDE chip. But driver doesn't use these ports. So I added a warning
messeage.

--- /dev/null	2002-08-31 08:31:37.000000000 +0900
+++ linux/drivers/ide/legacy/pc9800.c	2003-03-22 09:09:25.000000000 +0900
@@ -0,0 +1,84 @@
+/*
+ *  ide_pc9800.c
+ *
+ *  Copyright (C) 1997-2000  Linux/98 project,
+ *			     Kyoto University Microcomputer Club.
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+#include <linux/ioport.h>
+#include <linux/ide.h>
+#include <linux/init.h>
+
+#include <asm/io.h>
+#include <asm/pc9800.h>
+
+#define PC9800_IDE_BANKSELECT	0x432
+
+#undef PC9800_IDE_DEBUG
+
+static void pc9800_select(ide_drive_t *drive)
+{
+#ifdef PC9800_IDE_DEBUG
+	byte old;
+
+	/* Too noisy: */
+	/* printk(KERN_DEBUG "pc9800_select(%s)\n", drive->name); */
+
+	outb(0x80, PC9800_IDE_BANKSELECT);
+	old = inb(PC9800_IDE_BANKSELECT);
+	if (old != HWIF(drive)->index)
+		printk(KERN_DEBUG "ide-pc9800: switching bank #%d -> #%d\n",
+			old, HWIF(drive)->index);
+#endif
+	outb(HWIF(drive)->index, PC9800_IDE_BANKSELECT);
+}
+
+void __init ide_probe_for_pc9800(void)
+{
+	u8 saved_bank;
+
+	if (!PC9800_9821_P() /* || !PC9821_IDEIF_DOUBLE_P() */)
+		return;
+
+	if (!request_region(PC9800_IDE_BANKSELECT, 1, "ide0/1 bank")) {
+		printk(KERN_ERR
+			"ide: bank select port (%#x) is already occupied!\n",
+			PC9800_IDE_BANKSELECT);
+		return;
+	}
+
+	/* Do actual probing. */
+	if ((saved_bank = inb(PC9800_IDE_BANKSELECT)) == (u8) ~0
+	    || (outb(saved_bank ^ 1, PC9800_IDE_BANKSELECT),
+		/* Next outb is dummy for reading status. */
+		outb(0x80, PC9800_IDE_BANKSELECT),
+		inb(PC9800_IDE_BANKSELECT) != (saved_bank ^ 1))) {
+		printk(KERN_INFO
+			"ide: pc9800 type bank selecting port not found\n");
+		release_region(PC9800_IDE_BANKSELECT, 1);
+		return;
+	}
+
+	/* Restore original value, just in case. */
+	outb(saved_bank, PC9800_IDE_BANKSELECT);
+
+	/* These ports are reseved by IDE I/F.  */
+	if (!request_region(0x430, 1, "ide") ||
+	    !request_region(0x435, 1, "ide")) {
+		printk(KERN_WARNING
+			"ide: IO port 0x430 and 0x435 are reserved for IDE"
+			" the card using these ports may not work\n");
+	}
+
+	if (ide_hwifs[0].io_ports[IDE_DATA_OFFSET] == HD_DATA &&
+	    ide_hwifs[1].io_ports[IDE_DATA_OFFSET] == HD_DATA) {
+		ide_hwifs[0].chipset = ide_pc9800;
+		ide_hwifs[0].mate = &ide_hwifs[1];
+		ide_hwifs[0].selectproc = pc9800_select;
+		ide_hwifs[1].chipset = ide_pc9800;
+		ide_hwifs[1].mate = &ide_hwifs[0];
+		ide_hwifs[1].selectproc = pc9800_select;
+	}
+}

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: PATCH: module for legacy PC9800 ide
  2003-03-22  0:47     ` Osamu Tomita
@ 2003-03-22 15:14       ` Alan Cox
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Cox @ 2003-03-22 15:14 UTC (permalink / raw)
  To: Osamu Tomita; +Cc: Christoph Hellwig, Linus Torvalds, Linux Kernel Mailing List

On Sat, 2003-03-22 at 00:47, Osamu Tomita wrote:
> > I agree however - Osamu, can you fix this
> Thanks.
> Could you plese replace patch by this one.
> Some PC-98 has these port, not all PC-98. These ports are connected to
> IDE chip. But driver doesn't use these ports. So I added a warning
> messeage.

I will do


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-03-22 13:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-21 19:28 PATCH: module for legacy PC9800 ide Alan Cox
2003-03-21 18:59 ` Christoph Hellwig
2003-03-21 20:24   ` Alan Cox
2003-03-22  0:47     ` Osamu Tomita
2003-03-22 15:14       ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®