xen/arm: Mark each device used by Xen as disabled in DOM0 FDT
Hi Julien
Quoted 39 lines
On some board, there is no alias to the UART. To avoid modification in the device tree, dt-uart should also search device by path.
To distinguish an alias from a path, dt-uart will check the first character. If it's a / then it's path, otherwise it's an alias.
Signed-off-by Julien Grall <julien.grall@xxxxxxxxxx>--- xen/drivers/char/dt-uart.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)xen/drivers/char/dt-uart.c +4
-3@@ -26,9 +26,10 @@/* * Configure UART port with a string: -* alias,options +* path,options * -* @alias: alias used in the device tree for the UART +* @path: full path used in the device tree for the UART. If the path +* doesn't start with '/', we assuming that it's an alias. * @options: UART speficic options (see in each UART driver) */ static char __initdata opt_dtuart[30 ] ="" ;@@ -38,7 +39,7 @@ void __init dt_uart_init(void) {struct dt_device_node *dev;int ret; -const char *devalias = opt_dtuart; +const char *devpath = opt_dtuart;char *options;if ( !console_has ("dtuart" ) || !strcmp (opt_dtuart,"" ) )
xen/drivers/char/dt-uart.c void __init dt_uart_init(void) · line 61
Quoted 10 lines
xen/drivers/char/dt-uart.c +5
-2@@ -53,12 +54,15 @@ void __init dt_uart_init(void)else options ="" ; -early_printk ("Looking for UART console %s\n" , devalias); - dev =dt_find_node_by_alias (devalias); +early_printk ("Looking for UART console %s\n" , devpath); +if ( *devpath =='/' ) + dev =dt_find_node_by_path (devpath); +else + dev =dt_find_node_by_alias (devpath);
if '/' start an alias, it should be
+ if ( *devpath == '/' )
+ dev = dt_find_node_by_alias(devpath);
+ else
+ dev = dt_find_node_by_path(devpath);
bamvor
Quoted 10 lines
xen/drivers/char/dt-uart.c +1
-1if ( !dev ) { -early_printk ("Unable to find device \"%s\"\n" , devalias); +early_printk ("Unable to find device \"%s\"\n" , devpath);return ; }Signature · 1 line
1.7.10.4
Quoted 9 lines · Bamvor Jian Zhang
Review
Quoted 7 lines
(quoted diff) +5
-2- early_printk("Looking for UART console %s\n", devalias); - dev = dt_find_node_by_alias(devalias); + early_printk("Looking for UART console %s\n", devpath); + if ( *devpath == '/' ) + dev = dt_find_node_by_path(devpath); + else + dev = dt_find_node_by_alias(devpath);if '/' start an alias, it should be
I think / is the start of a path not an alias, so the current code is correct.
Review
Quoted 5 lines
(quoted diff) +4
-0+ if ( *devpath == '/' ) + dev = dt_find_node_by_alias(devpath); + else + dev = dt_find_node_by_path(devpath);
Ian.
Quoted 1 line · Bamvor Jian Zhang
Hi Julien
Hi Bamvor,
Quoted 51 lines
Quoted 39 lines
On some board, there is no alias to the UART. To avoid modification in the device tree, dt-uart should also search device by path.
To distinguish an alias from a path, dt-uart will check the first character. If it's a / then it's path, otherwise it's an alias.
Signed-off-by Julien Grall <julien.grall@xxxxxxxxxx>--- xen/drivers/char/dt-uart.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)xen/drivers/char/dt-uart.c +4
-3@@ -26,9 +26,10 @@/* * Configure UART port with a string: -* alias,options +* path,options * -* @alias: alias used in the device tree for the UART +* @path: full path used in the device tree for the UART. If the path +* doesn't start with '/', we assuming that it's an alias. * @options: UART speficic options (see in each UART driver) */ static char __initdata opt_dtuart[30 ] ="" ;@@ -38,7 +39,7 @@ void __init dt_uart_init(void) {struct dt_device_node *dev;int ret; -const char *devalias = opt_dtuart; +const char *devpath = opt_dtuart;char *options;if ( !console_has ("dtuart" ) || !strcmp (opt_dtuart,"" ) )xen/drivers/char/dt-uart.c void __init dt_uart_init(void) · line 61
Quoted 10 lines
xen/drivers/char/dt-uart.c +5
-2@@ -53,12 +54,15 @@ void __init dt_uart_init(void)else options ="" ; -early_printk ("Looking for UART console %s\n" , devalias); - dev =dt_find_node_by_alias (devalias); +early_printk ("Looking for UART console %s\n" , devpath); +if ( *devpath =='/' ) + dev =dt_find_node_by_path (devpath); +else + dev =dt_find_node_by_alias (devpath);if '/' start an alias, it should be
Quoted 1 line
From the ePAR
(http://www.power.org/resources/downloads/Power_ePAPR_APPROVED_v1.0.pdf)
section 3.3: an alias name must match the following pattern: [0-9a-z-]+ So we can't find '/' in the alias.
Review
Quoted 4 lines
(quoted diff) +4
-0+ if ( *devpath == '/' ) + dev = dt_find_node_by_alias(devpath); + else + dev = dt_find_node_by_path(devpath);
A path always start by '/'. With your solution, it won't be possible to get the UART by path.
Signature · 1 line
Julien Grall