* [RFC][DOC] writing IDE driver guidelines @ 2004-05-15 17:23 Bartlomiej Zolnierkiewicz 2004-05-15 17:34 ` Jeff Garzik 0 siblings, 1 reply; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-15 17:23 UTC (permalink / raw) To: Marc Singer; +Cc: linux-ide, linux-kernel Feedback is welcomed. writing IDE driver guidelines general rules: - code outside drivers/ide directory shouldn't need to include <linux/ide.h> if it does something is wrong - do not believe in popular myth that driver code can be of less quality than core kernel code - don't copy without thinking ugly and bogus code (there is still lot of such in IDE) - IDE is going into full host driver model so write host driver for your interface - host drivers should request/release IO resource themelves and set hwif->mmio to 2 - remember about ordering issues (you break device ordering and some machines won't boot) - use linux-ide@vger.kernel.org mailing list new architecture: - add only what is really necessary to <asm/ide.h> and put interface specific code into drivers/ide - ide_init_hwif_ports() is obsolete and dying, define IDE_ARCH_NO_OBSOLETE_INIT in <asm/ide.h> - define ide_default_irq(), ide_init_default_irq() and ide_default_io_base() to (0) - ide_init_default_hwifs() is gone architecture specific drivers: - do not abuse ide_default_irq()/ide_default_io_base() from <asm/ide.h> - your driver should be in drivers/ide/<your_arch>/<your_driver_name> - see drivers in drivers/ide/arm and drivers/ide/legacy for examples (especially m68k and arm specific drivers) - do not use ide_setup_ports() PCI drivers: - no need to split your driver on .c and .h files - /proc/ide/ interfaces are obsolete -- Bartlomiej Zolnierkiewicz (15 May 2004) ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 17:23 [RFC][DOC] writing IDE driver guidelines Bartlomiej Zolnierkiewicz @ 2004-05-15 17:34 ` Jeff Garzik 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz 0 siblings, 1 reply; 10+ messages in thread From: Jeff Garzik @ 2004-05-15 17:34 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz; +Cc: Marc Singer, linux-ide, linux-kernel On Sat, May 15, 2004 at 07:23:50PM +0200, Bartlomiej Zolnierkiewicz wrote: > - do not believe in popular myth that driver code > can be of less quality than core kernel code chuckle :) > - don't copy without thinking ugly and bogus code > (there is still lot of such in IDE) Agreed, but I think most driver authors will not know what is ugly and bogus code, otherwise they would probably not copy it... (I hope!) > - host drivers should request/release IO resource > themelves and set hwif->mmio to 2 Don't you mean, hwif->mmio==2 for MMIO hardware? > - ide_init_hwif_ports() is obsolete and dying, > define IDE_ARCH_NO_OBSOLETE_INIT in <asm/ide.h> hmmmm. Please consider reversing this: Make ide_init_hwif_ports() present _only_ if IDE_ARCH_OBSOLETE_INIT is defined. Then add that define for all arches that still use ide_init_hwif_ports(). > - define ide_default_irq(), ide_init_default_irq() > and ide_default_io_base() to (0) Maybe provide generic definitions, so that new arches don't even have to care about this? Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 17:34 ` Jeff Garzik @ 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz 2004-05-15 18:13 ` Bartlomiej Zolnierkiewicz ` (2 more replies) 0 siblings, 3 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-15 17:58 UTC (permalink / raw) To: Jeff Garzik; +Cc: Marc Singer, linux-ide, linux-kernel On Saturday 15 of May 2004 19:34, Jeff Garzik wrote: > On Sat, May 15, 2004 at 07:23:50PM +0200, Bartlomiej Zolnierkiewicz wrote: > > - do not believe in popular myth that driver code > > can be of less quality than core kernel code > > chuckle :) hehe :) > > - don't copy without thinking ugly and bogus code > > (there is still lot of such in IDE) > > Agreed, but I think most driver authors will not know what is ugly > and bogus code, otherwise they would probably not copy it... (I hope!) Some just copy _everything_ what is in other driver, really... > > - host drivers should request/release IO resource > > themelves and set hwif->mmio to 2 > > Don't you mean, hwif->mmio==2 for MMIO hardware? It is was historically for MMIO, now it means that driver handles IO resource itself (per comment in <linux/ide.h>). > > - ide_init_hwif_ports() is obsolete and dying, > > define IDE_ARCH_NO_OBSOLETE_INIT in <asm/ide.h> > > hmmmm. Please consider reversing this: > > Make ide_init_hwif_ports() present _only_ if IDE_ARCH_OBSOLETE_INIT > is defined. > > Then add that define for all arches that still use ide_init_hwif_ports(). Well, I started with this idea but it requires adding this define for far too many archs. This is a problem especially for arm because we have to either leave <asm-arm/arch-*/ide.h> or add #ifdef horror <asm-arm/ide.h>. > > - define ide_default_irq(), ide_init_default_irq() > > and ide_default_io_base() to (0) > > Maybe provide generic definitions, so that new arches don't even > have to care about this? Please explain. Thanks, Bartlomiej ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz @ 2004-05-15 18:13 ` Bartlomiej Zolnierkiewicz 2004-05-15 22:23 ` Jeff Garzik 2004-05-16 0:51 ` Marc Singer 2 siblings, 0 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-15 18:13 UTC (permalink / raw) To: Jeff Garzik; +Cc: Marc Singer, linux-ide, linux-kernel On Saturday 15 of May 2004 19:58, Bartlomiej Zolnierkiewicz wrote: > > > - ide_init_hwif_ports() is obsolete and dying, > > > define IDE_ARCH_NO_OBSOLETE_INIT in <asm/ide.h> > > > > hmmmm. Please consider reversing this: > > > > Make ide_init_hwif_ports() present _only_ if IDE_ARCH_OBSOLETE_INIT > > is defined. > > > > Then add that define for all arches that still use ide_init_hwif_ports(). > > Well, I started with this idea but it requires adding this define for far > too many archs. This is a problem especially for arm because we have to > either leave <asm-arm/arch-*/ide.h> or add #ifdef horror <asm-arm/ide.h>. It was thinko. I will change this, thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz 2004-05-15 18:13 ` Bartlomiej Zolnierkiewicz @ 2004-05-15 22:23 ` Jeff Garzik 2004-05-16 1:00 ` Marc Singer 2004-05-16 19:26 ` Bartlomiej Zolnierkiewicz 2004-05-16 0:51 ` Marc Singer 2 siblings, 2 replies; 10+ messages in thread From: Jeff Garzik @ 2004-05-15 22:23 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz; +Cc: Marc Singer, linux-ide, linux-kernel Bartlomiej Zolnierkiewicz wrote: > On Saturday 15 of May 2004 19:34, Jeff Garzik wrote: >>On Sat, May 15, 2004 at 07:23:50PM +0200, Bartlomiej Zolnierkiewicz wrote: >>>- host drivers should request/release IO resource >>> themelves and set hwif->mmio to 2 >> >>Don't you mean, hwif->mmio==2 for MMIO hardware? > > > It is was historically for MMIO, now it means that driver > handles IO resource itself (per comment in <linux/ide.h>). Maybe then create a constant HOST_IO_RESOURCES (value==2) to make that more obvious? >>>- define ide_default_irq(), ide_init_default_irq() >>> and ide_default_io_base() to (0) >> >>Maybe provide generic definitions, so that new arches don't even >>have to care about this? > > > Please explain. Your document appears to imply that each new arch should define the above three symbols. My suggestion is to devise a method by which new arches don't have to care about those symbols at all, unless required to do so by the underlying hardware. Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 22:23 ` Jeff Garzik @ 2004-05-16 1:00 ` Marc Singer 2004-05-16 19:34 ` Bartlomiej Zolnierkiewicz 2004-05-16 19:26 ` Bartlomiej Zolnierkiewicz 1 sibling, 1 reply; 10+ messages in thread From: Marc Singer @ 2004-05-16 1:00 UTC (permalink / raw) To: Jeff Garzik; +Cc: Bartlomiej Zolnierkiewicz, linux-ide, linux-kernel On Sat, May 15, 2004 at 06:23:04PM -0400, Jeff Garzik wrote: > Bartlomiej Zolnierkiewicz wrote: > >On Saturday 15 of May 2004 19:34, Jeff Garzik wrote: > >>On Sat, May 15, 2004 at 07:23:50PM +0200, Bartlomiej Zolnierkiewicz wrote: > >>>- host drivers should request/release IO resource > >>> themelves and set hwif->mmio to 2 > >> > >>Don't you mean, hwif->mmio==2 for MMIO hardware? > > > > > >It is was historically for MMIO, now it means that driver > >handles IO resource itself (per comment in <linux/ide.h>). > > Maybe then create a constant HOST_IO_RESOURCES (value==2) to make that > more obvious? > Please allow me to advocate for the naive. While I do not in favor of lengthy commented discourses within the code for all of the usual reasons, I do believe that interface documentation is always welcome. It encourages everyone to learn and follow the rules. It allows the subsystem maintainer to establish a boundary so that accessing lower-level structures are left alone. I'm not talking about a HOWTO as we know it. Let's look at this mmio flag. How about writing this at a very minimum. int mmio; /* 0: iommio; <insert appropriate direction */ /* 2: custom; driver must reserve & release system resources */ Certainly, I'd rather see something along the lines of a full description. int mmio; /* This field controls whether or not the driver blah, blah. If the driver needs to reserve system resources, e.g. ports of memory, set the value to 2 and blah, blah. */ It isn't much, but it goes a long way. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-16 1:00 ` Marc Singer @ 2004-05-16 19:34 ` Bartlomiej Zolnierkiewicz 0 siblings, 0 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-16 19:34 UTC (permalink / raw) To: Marc Singer, Jeff Garzik; +Cc: linux-ide, linux-kernel On Sunday 16 of May 2004 03:00, Marc Singer wrote: > On Sat, May 15, 2004 at 06:23:04PM -0400, Jeff Garzik wrote: > > Bartlomiej Zolnierkiewicz wrote: > > >On Saturday 15 of May 2004 19:34, Jeff Garzik wrote: > > >>On Sat, May 15, 2004 at 07:23:50PM +0200, Bartlomiej Zolnierkiewicz wrote: > > >>>- host drivers should request/release IO resource > > >>> themelves and set hwif->mmio to 2 > > >> > > >>Don't you mean, hwif->mmio==2 for MMIO hardware? > > > > > >It is was historically for MMIO, now it means that driver > > >handles IO resource itself (per comment in <linux/ide.h>). > > > > Maybe then create a constant HOST_IO_RESOURCES (value==2) to make that > > more obvious? > > Please allow me to advocate for the naive. > > While I do not in favor of lengthy commented discourses within the > code for all of the usual reasons, I do believe that interface > documentation is always welcome. It encourages everyone to learn and > follow the rules. It allows the subsystem maintainer to establish a > boundary so that accessing lower-level structures are left alone. > > I'm not talking about a HOWTO as we know it. Let's look at this mmio > flag. How about writing this at a very minimum. > > int mmio; /* 0: iommio; <insert appropriate direction */ > /* 2: custom; driver must reserve & release system resources */ I think this is good for ide.h > Certainly, I'd rather see something along the lines of a full > description. > > int mmio; > /* This field controls whether or not the driver blah, > blah. If the driver needs to reserve system resources, > e.g. ports of memory, set the value to 2 and blah, blah. */ and this is good for documentation file. > It isn't much, but it goes a long way. Thanks. ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 22:23 ` Jeff Garzik 2004-05-16 1:00 ` Marc Singer @ 2004-05-16 19:26 ` Bartlomiej Zolnierkiewicz 1 sibling, 0 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-16 19:26 UTC (permalink / raw) To: Jeff Garzik; +Cc: Marc Singer, linux-ide, linux-kernel On Sunday 16 of May 2004 00:23, Jeff Garzik wrote: > >>>- define ide_default_irq(), ide_init_default_irq() > >>> and ide_default_io_base() to (0) > >> > >>Maybe provide generic definitions, so that new arches don't even > >>have to care about this? > > > > Please explain. > > Your document appears to imply that each new arch should define the > above three symbols. > > My suggestion is to devise a method by which new arches don't have to > care about those symbols at all, unless required to do so by the > underlying hardware. OK will work on this ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz 2004-05-15 18:13 ` Bartlomiej Zolnierkiewicz 2004-05-15 22:23 ` Jeff Garzik @ 2004-05-16 0:51 ` Marc Singer 2004-05-16 19:33 ` Bartlomiej Zolnierkiewicz 2 siblings, 1 reply; 10+ messages in thread From: Marc Singer @ 2004-05-16 0:51 UTC (permalink / raw) To: Bartlomiej Zolnierkiewicz; +Cc: Jeff Garzik, linux-ide, linux-kernel On Sat, May 15, 2004 at 07:58:03PM +0200, Bartlomiej Zolnierkiewicz wrote: > > > - host drivers should request/release IO resource > > > themelves and set hwif->mmio to 2 > > > > Don't you mean, hwif->mmio==2 for MMIO hardware? > > It is was historically for MMIO, now it means that driver > handles IO resource itself (per comment in <linux/ide.h>). If you are talking about this int mmio; /* hosts iomio (0) or custom (2) select do you really think that's enough? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [RFC][DOC] writing IDE driver guidelines 2004-05-16 0:51 ` Marc Singer @ 2004-05-16 19:33 ` Bartlomiej Zolnierkiewicz 0 siblings, 0 replies; 10+ messages in thread From: Bartlomiej Zolnierkiewicz @ 2004-05-16 19:33 UTC (permalink / raw) To: Marc Singer; +Cc: Jeff Garzik, linux-ide, linux-kernel On Sunday 16 of May 2004 02:51, Marc Singer wrote: > On Sat, May 15, 2004 at 07:58:03PM +0200, Bartlomiej Zolnierkiewicz wrote: > > > > - host drivers should request/release IO resource > > > > themelves and set hwif->mmio to 2 > > > > > > Don't you mean, hwif->mmio==2 for MMIO hardware? > > > > It is was historically for MMIO, now it means that driver > > handles IO resource itself (per comment in <linux/ide.h>). > > If you are talking about this > > int mmio; /* hosts iomio (0) or custom (2) > select > > do you really think that's enough? No and I didn't say this. I tried to describe current state of affairs. Don't blame me for cryptic comments in <linux/ide.h>. ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-05-16 19:32 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2004-05-15 17:23 [RFC][DOC] writing IDE driver guidelines Bartlomiej Zolnierkiewicz 2004-05-15 17:34 ` Jeff Garzik 2004-05-15 17:58 ` Bartlomiej Zolnierkiewicz 2004-05-15 18:13 ` Bartlomiej Zolnierkiewicz 2004-05-15 22:23 ` Jeff Garzik 2004-05-16 1:00 ` Marc Singer 2004-05-16 19:34 ` Bartlomiej Zolnierkiewicz 2004-05-16 19:26 ` Bartlomiej Zolnierkiewicz 2004-05-16 0:51 ` Marc Singer 2004-05-16 19:33 ` Bartlomiej Zolnierkiewicz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox