RE: static I/O device mapping of UART for early prints console

2012-03-11 Thread 卜弋天


  Date: Sun, 11 Mar 2012 12:29:44 +0530
 Subject: static I/O device mapping of UART for early prints  console
 From: pcuser.ma...@gmail.com
 To: kernelnewbies@kernelnewbies.org
 
 I'm doing kernel porting to arm926 based FPGA board (similar to
 samsung-s3c6410 board). I'm trying to setup UART for early print and
 console.
 I gone through some reference boards(samsung-s3c6410) for setting up
 uart for early print  console.
 
 I can't trace the virtual mapping for UART registers in adduart
 macro in debug-macro.S file
 
 .macro addruart, rp, rv
  ldr \rp, = S3C_PA_UART
  ldr \rv, = S3C_VA_UART
 
 
 Basically,I want to know how to calculate this virtual
 address(S3C_VA_UART)  from the physical address(S3C_PA_UART)
actually, this is io_virtual_address map to io_physical_address, it is not 
equal to kernel_virtual_adressmap to kernel_physical_address.differenct 
platform providers such as Qualcomm, TI, STE, Samsung use different fomula to 
map IO address. for example, for OMAP1, TI use a very simple fomula to map from 
io_virtual_address to io_physical_address:io_virtual_address = 
io_physical_address-0x0100 so suppose TI's uart0 physical address is 
0xFFFB, then the virtial address of uart0 is 0xFEFB. for Samsung 
S3c64XX: 1. both physical and virtual address of uart is defined in 
map.h:#define S3C_PA_UART  (0x7F005000)
/* See notes on UART VA mapping in debug-macro.S */
#define S3C_VA_UARTx(x) (S3C_VA_UART + (S3C_PA_UART  0xf) + ((x) * 
S3C_UART_OFFSET))#define S3C_VA_UART0  S3C_VA_UARTx(0)
#define S3C_VA_UART1  S3C_VA_UARTx(1)
#define S3C_VA_UART2  S3C_VA_UARTx(2)
#define S3C_VA_UART3  S3C_VA_UARTx(3) 2. so for uart0, the virtual address will 
be:virtual_uart0_address = S3C_VA_UART + (S3C_PA_UART  0xf) and in 
map-base.h:#define S3C_ADDR_BASE (0xF400)
#define S3C_VA_UART S3C_ADDR(0x0100) /* UART */
so S3C_VA_UART = 0xF500 3. at last:virtual_uart0_address = S3C_VA_UART + 
(S3C_PA_UART  0xf)= 0xF500 + (0x7F005xf) = 0xF5005000 
please do not try to use  __phys_to_virt, this is for kernel virtual address to 
kernel physical address translation, rather than IO address map.
  ___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Macro explanation

2012-03-11 Thread Vijay Chauhan
On Sat, Mar 10, 2012 at 12:10 AM, Manohar Vanga manohar.va...@gmail.com wrote:
 Also, from the
 archives: http://www.mail-archive.com/kernelnewbies@nl.linux.org/msg12320.html

Thank you for links which gives good explanation.
But I am not able to understand the part accessing a member through
NULL pointer like ((size_t) ((TYPE *)0)-MEMBER)
How it is handled?

In C code if we access a member through NULL pointer like this will
cause the code to crash.
Am I missing something?



 On Fri, Mar 9, 2012 at 7:21 PM, Vijay Chauhan kernel.vi...@gmail.com
 wrote:

 Hi,

 I'm checking the container_of and offsetof macro

 #define container_of(ptr, type, member) ({ \
                const typeof( ((type *)0)-member ) *__mptr = (ptr);
                (type *)( (char *)__mptr - offsetof(type,member) );})

 #define offsetof(TYPE, MEMBER) \
  ((size_t) ((TYPE *)0)-MEMBER)


 I did not understand the first line of both macro. Will it not create
 the NULL pointer dereference problem? I know it works and read some
 article but it did not explain this part, so can anyone explain why
 the NULL pointer error is not coming. Am I missing something?
 Any C language specification of such example.

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




 --
 /manohar

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Macro explanation

2012-03-11 Thread Mandeep Sandhu
On Mon, Mar 12, 2012 at 1:03 AM, Vijay Chauhan kernel.vi...@gmail.com wrote:
 On Sat, Mar 10, 2012 at 12:10 AM, Manohar Vanga manohar.va...@gmail.com 
 wrote:
 Also, from the
 archives: http://www.mail-archive.com/kernelnewbies@nl.linux.org/msg12320.html

 Thank you for links which gives good explanation.
 But I am not able to understand the part accessing a member through
 NULL pointer like ((size_t) ((TYPE *)0)-MEMBER)
 How it is handled?

This macro is interpreted at 'compile-time', i.e during the
preprocessor stage...the NULL pointer exception would be generated if
the code was 'run' at runtime. The typeof GCC builtin is also
interpreted at compile-time. CMIIW. Hope that explains the seeming
NULL pointer dereference.

-mandeep


 In C code if we access a member through NULL pointer like this will
 cause the code to crash.
 Am I missing something?



 On Fri, Mar 9, 2012 at 7:21 PM, Vijay Chauhan kernel.vi...@gmail.com
 wrote:

 Hi,

 I'm checking the container_of and offsetof macro

 #define container_of(ptr, type, member) ({ \
                const typeof( ((type *)0)-member ) *__mptr = (ptr);
                (type *)( (char *)__mptr - offsetof(type,member) );})

 #define offsetof(TYPE, MEMBER) \
  ((size_t) ((TYPE *)0)-MEMBER)


 I did not understand the first line of both macro. Will it not create
 the NULL pointer dereference problem? I know it works and read some
 article but it did not explain this part, so can anyone explain why
 the NULL pointer error is not coming. Am I missing something?
 Any C language specification of such example.

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies




 --
 /manohar

 ___
 Kernelnewbies mailing list
 Kernelnewbies@kernelnewbies.org
 http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: Macro explanation

2012-03-11 Thread Manish Katiyar
On Sun, Mar 11, 2012 at 9:40 PM, Mandeep Sandhu
mandeepsandhu@gmail.com wrote:
 On Mon, Mar 12, 2012 at 1:03 AM, Vijay Chauhan kernel.vi...@gmail.com wrote:
 On Sat, Mar 10, 2012 at 12:10 AM, Manohar Vanga manohar.va...@gmail.com 
 wrote:
 Also, from the
 archives: http://www.mail-archive.com/kernelnewbies@nl.linux.org/msg12320.html

 Thank you for links which gives good explanation.
 But I am not able to understand the part accessing a member through
 NULL pointer like ((size_t) ((TYPE *)0)-MEMBER)
 How it is handled?

All you are doing is computing the address and not dereferencing it.
If you dereference it, yes it will panic. eg..

*(((size_t) ((TYPE *)0)-MEMBER)) will cause panic

-- 
Thanks -
Manish

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Git info needed

2012-03-11 Thread trisha yad
Hi All,

I want Info about how to get patches from private Git.
I have downloaded Catalin Marinas git(ARM). I want to know check to
support ARM 15 how many patches are added, so that we can analysis the
difference.
http://git.kernel.org/?p=linux/kernel/git/cmarinas/linux-arm-arch.git;a=summary

1. I want to extract the patches. what command I will use for it with
reference to linus torvalds git.

2. Also If i want to see on kernel version 3.1 which all patches are
added by catalin to make it work for ARM 15, How can I know.


Thanks a lot.
Regards

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies