lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 21 Sep 2006 02:30:17 -0400
From:	Jeff Garzik <jgarzik@...ox.com>
To:	Zang Roy-r61911 <tie-fei.zang@...escale.com>
CC:	Roland Dreier <rdreier@...co.com>, Andrew Morton <akpm@...l.org>,
	netdev <netdev@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [patch 3/3] Add tsi108 On Chip Ethernet device driver support

Zang Roy-r61911 wrote:
> On Thu, 2006-09-21 at 12:26, Jeff Garzik wrote:
>> Zang Roy-r61911 wrote:
>>> +#define TSI108_ETH_WRITE_REG(offset, val) \
>>> +     writel(le32_to_cpu(val),data->regs + (offset))
>>> +
>>> +#define TSI108_ETH_READ_REG(offset) \
>>> +     le32_to_cpu(readl(data->regs + (offset)))
>>> +
>>> +#define TSI108_ETH_WRITE_PHYREG(offset, val) \
>>> +     writel(le32_to_cpu(val), data->phyregs + (offset))
>>> +
>>> +#define TSI108_ETH_READ_PHYREG(offset) \
>>> +     le32_to_cpu(readl(data->phyregs + (offset)))
>>
>> NAK:
>>
>> 1) writel() and readl() are defined to be little endian.
>>
>> If your platform is different, then your platform should have its own 
>> foobus_writel() and foobus_readl().
> 
> Tsi108 bridge is designed for powerpc platform. Originally, I use
> out_be32() and in_be32(). While there is no obvious reason to object
> using this bridge in a little endian system. Maybe some extra hardware
> logic needed for the bus interface. le32_to_cpu() can  be aware the
> endian difference.

To restate, readl() should read a little endian value, and return a 
CPU-endian value.  writel() should receive a CPU-endian value, and write 
a little endian value.

If your platform's readl/writel doesn't do that, it's broken.

That's why normal PCI drivers can use readl() and writel() on either 
big-endian or little-endian machines, without needing to use le32_to_cpu().

	Jeff



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ