
Hi Macpaul
On Wed, Oct 26, 2011 at 4:19 PM, 馬克泡 macpaul@gmail.com wrote:
Hi Graeme,
2011/10/25 馬克泡 macpaul@gmail.com:
Hi Marek,
2011/10/25 Marek Vasut marek.vasut@gmail.com:
[snip]
Please check ns16550.c, current code has another such kind of casting #ifdef CONFIG_SYS_NS16550_PORT_MAPPED #define serial_out(x, y) outb(x, (ulong)y) #define serial_in(y) inb((ulong)y) [...] #else #define serial_out(x, y) writeb(x, y) #define serial_in(y) readb(y) #endif
I'm going to change writeb/readb series functions from macro into inline functions.
For all arches? Have you seen /arch/x86/include/asm/io.h?
However, I've found data type casting problem in NS16550. Only here the serial_out with CONFIG_SYS_NS16550_PORT_MAPPED is used for board "eNET". Is this a necessary for this machine to access 8-bytes data?
outb/inb access 8-bit data in a 16-bit address space and the ns16650 has (for the x86 architecture at least) byte aligned registers
Since inline functions are type sensitive, I've suggest to replace the macro for other machines like writeb(x, (uint)y) but Marek think this is not good enough. Could you give some comments?
Hmm, but eNET (well, all x86 really) would not use writeb/readb - outb/inb would be used instead so if you are only touching the writeb/readb, eNET would never see this. So I don't understand where your type conflicts are occuring
Looking at the ulong cast, I was wondering why it was there, and the commit diff says I wrote it which is a bit of a worry :) x86 only has 65535 ports accessible via outb and inb, so I would have thought the case should have been a ushort, not a ulong.
I'm sorry, but without a patch to see what you are actually doing, I'm having a bit of difficulty picturing what is happening and what could be going wrong...
Regards,
Graeme