linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* IN_BYTE and OUT_BYTE replacement
@ 2009-07-09 12:28 Andrei Martynov
  2009-07-09 12:46 ` Alan Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Andrei Martynov @ 2009-07-09 12:28 UTC (permalink / raw)
  To: linux-ide

Hi,

there were specific i/o macros IN_BYTE and OUT_BYTE in 2.4 kernel to
access IDE registers, but seems they are gone in 2.6 kernel and
replaced by ioread8 / iowrite8 that are used everywhere and not in
libata only. In my case original code for 2.4 kernel wrote specific
value to undocumented chipset register on *every* r/w access to *any*
IDE register.

#define OUT_BYTE(b,p) { outb(b,p); outb(255, JASPER_IDE_BASE + 0xe0); }
static inline byte jasper_ide_in_byte(int p)
{
        byte b;
        b = (byte)inb(p);
        outb(255, JASPER_IDE_BASE + 0xe0);
        return b;
}
#define IN_BYTE(p) jasper_ide_in_byte(p)

Is there any way to reproduce this behavior in libata other than
redefining ioread8/iowrite8?

-- 
Best regards,
 Andrei                          mailto:andrei.martynov@web.de


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

* Re: IN_BYTE and OUT_BYTE replacement
  2009-07-09 12:28 IN_BYTE and OUT_BYTE replacement Andrei Martynov
@ 2009-07-09 12:46 ` Alan Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Alan Cox @ 2009-07-09 12:46 UTC (permalink / raw)
  To: Andrei Martynov; +Cc: linux-ide

> Is there any way to reproduce this behavior in libata other than
> redefining ioread8/iowrite8?

For the cases where hardware so far has needed this there are higher
level abstractions. It depends what cases the jasper h/w needs it for.

If you are using the SFF taskfile style interface then

	->sff_dev_select
	->sff_tf_load
	->sff_tf_read
	->sff_exec_command
	->sff_check_status
	->sff_check_altstatus
	->sff_irq_clear
	->sff_data_xfer

And for DMA

	->bmdma_setup
	->bmdma_start
	->bmdma_stop
	->bmdma_status

which are mostly just I/O operations.

Abstracting at this higher level helps performance by avoiding huge
numbers of indirect function calls through pointers.


However the reset logic isn't cleanly separated so might need a bit of
work if that is a problem.

It's hard to tell without more info whether they do the write on every
access because they can't just do it on the ones that need it or because
they need to do it each time.

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

end of thread, other threads:[~2009-07-09 12:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-09 12:28 IN_BYTE and OUT_BYTE replacement Andrei Martynov
2009-07-09 12:46 ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).