Re: efiboot: disallow com(4) speed changes

2017-03-01 Thread sven falempin
On Wed, Mar 1, 2017 at 5:41 PM, sven falempin 
wrote:

>
>
> On Wed, Mar 1, 2017 at 4:31 AM, Patrick Wildt  wrote:
>
>> Hi,
>>
>> there is no com(4) direct access support in EFI, so setting the speed
>> will fail and crash the EFI Application.  Happens when you run stty
>> com0 115200.
>>
>> ok?
>>
>> Patrick
>>
>>
>> diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c
>> b/sys/arch/amd64/stand/libsa/dev_i386.c
>> index e40856cbf05..245ced84a8e 100644
>> --- a/sys/arch/amd64/stand/libsa/dev_i386.c
>> +++ b/sys/arch/amd64/stand/libsa/dev_i386.c
>> @@ -182,8 +182,10 @@ ttydev(char *name)
>>  int
>>  cnspeed(dev_t dev, int sp)
>>  {
>> +#ifndef EFIBOOT
>> if (major(dev) == 8)/* comN */
>> return comspeed(dev, sp);
>> +#endif
>>
>> /* pc0 and anything else */
>> return 9600;
>>
>>
>
> in stand boot
> stty could be disable
>
> ( diff probably got space instead of tabs , please use -b )
> Index: ./stand/boot/cmd.c
> ===
> RCS file: /cvs/src/sys/stand/boot/cmd.c,v
> retrieving revision 1.63
> diff -u -p -r1.63 cmd.c
> --- ./stand/boot/cmd.c  20 Jul 2014 19:33:54 -  1.63
> +++ ./stand/boot/cmd.c  1 Mar 2017 22:36:11 -
> @@ -68,7 +68,9 @@ const struct cmd_table cmd_table[] = {
>  #endif
> {"reboot", CMDT_CMD, Xreboot},
> {"set",CMDT_SET, Xset},
> +#ifndef EFIBOOT
> {"stty",   CMDT_CMD, Xstty},
> +#endif
> {"time",   CMDT_CMD, Xtime},
> {NULL, 0},
>  };
>
>
> Alternatively the function could document the problem ( but it make the
> boot loader bigger
>
>
> Index: ./stand/boot/cmd.c
> ===
> RCS file: /cvs/src/sys/stand/boot/cmd.c,v
> retrieving revision 1.63
> diff -u -p -r1.63 cmd.c
> --- ./stand/boot/cmd.c  20 Jul 2014 19:33:54 -  1.63
> +++ ./stand/boot/cmd.c  1 Mar 2017 22:39:23 -
> @@ -375,6 +375,11 @@ Xstty(void)
> char *cp;
> dev_t dev;
>
> +#ifndef EFIBOOT
> +   printf("no com(4) direct access support in EFI");
> +   return 0;
> +#endif
> +
> if (cmd.argc == 1) {
> printf("%s speed is %d\n", ttyname(0), cnspeed(0, -1));
> return 0;
>
> Maybe a better way ?
>
>
return 0 in the function if we are in EFI mode, of course

Index: ./stand/boot/cmd.c
===
RCS file: /cvs/src/sys/stand/boot/cmd.c,v
retrieving revision 1.63
diff -u -p -r1.63 cmd.c
--- ./stand/boot/cmd.c  20 Jul 2014 19:33:54 -  1.63
+++ ./stand/boot/cmd.c  1 Mar 2017 22:39:23 -
@@ -375,6 +375,11 @@ Xstty(void)
char *cp;
dev_t dev;

+#ifdef EFIBOOT
+   printf("no com(4) direct access support in EFI");
+   return 0;
+#endif
+
if (cmd.argc == 1) {
printf("%s speed is %d\n", ttyname(0), cnspeed(0, -1));
return 0;

-- 

-
() ascii ribbon campaign - against html e-mail
/\


Re: efiboot: disallow com(4) speed changes

2017-03-01 Thread sven falempin
On Wed, Mar 1, 2017 at 4:31 AM, Patrick Wildt  wrote:

> Hi,
>
> there is no com(4) direct access support in EFI, so setting the speed
> will fail and crash the EFI Application.  Happens when you run stty
> com0 115200.
>
> ok?
>
> Patrick
>
>
> diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c
> b/sys/arch/amd64/stand/libsa/dev_i386.c
> index e40856cbf05..245ced84a8e 100644
> --- a/sys/arch/amd64/stand/libsa/dev_i386.c
> +++ b/sys/arch/amd64/stand/libsa/dev_i386.c
> @@ -182,8 +182,10 @@ ttydev(char *name)
>  int
>  cnspeed(dev_t dev, int sp)
>  {
> +#ifndef EFIBOOT
> if (major(dev) == 8)/* comN */
> return comspeed(dev, sp);
> +#endif
>
> /* pc0 and anything else */
> return 9600;
>
>

in stand boot
stty could be disable

( diff probably got space instead of tabs , please use -b )
Index: ./stand/boot/cmd.c
===
RCS file: /cvs/src/sys/stand/boot/cmd.c,v
retrieving revision 1.63
diff -u -p -r1.63 cmd.c
--- ./stand/boot/cmd.c  20 Jul 2014 19:33:54 -  1.63
+++ ./stand/boot/cmd.c  1 Mar 2017 22:36:11 -
@@ -68,7 +68,9 @@ const struct cmd_table cmd_table[] = {
 #endif
{"reboot", CMDT_CMD, Xreboot},
{"set",CMDT_SET, Xset},
+#ifndef EFIBOOT
{"stty",   CMDT_CMD, Xstty},
+#endif
{"time",   CMDT_CMD, Xtime},
{NULL, 0},
 };


Alternatively the function could document the problem ( but it make the
boot loader bigger


Index: ./stand/boot/cmd.c
===
RCS file: /cvs/src/sys/stand/boot/cmd.c,v
retrieving revision 1.63
diff -u -p -r1.63 cmd.c
--- ./stand/boot/cmd.c  20 Jul 2014 19:33:54 -  1.63
+++ ./stand/boot/cmd.c  1 Mar 2017 22:39:23 -
@@ -375,6 +375,11 @@ Xstty(void)
char *cp;
dev_t dev;

+#ifndef EFIBOOT
+   printf("no com(4) direct access support in EFI");
+   return 0;
+#endif
+
if (cmd.argc == 1) {
printf("%s speed is %d\n", ttyname(0), cnspeed(0, -1));
return 0;

Maybe a better way ?

-- 
-
() ascii ribbon campaign - against html e-mail
/\


efiboot: disallow com(4) speed changes

2017-03-01 Thread Patrick Wildt
Hi,

there is no com(4) direct access support in EFI, so setting the speed
will fail and crash the EFI Application.  Happens when you run stty
com0 115200.

ok?

Patrick


diff --git a/sys/arch/amd64/stand/libsa/dev_i386.c 
b/sys/arch/amd64/stand/libsa/dev_i386.c
index e40856cbf05..245ced84a8e 100644
--- a/sys/arch/amd64/stand/libsa/dev_i386.c
+++ b/sys/arch/amd64/stand/libsa/dev_i386.c
@@ -182,8 +182,10 @@ ttydev(char *name)
 int
 cnspeed(dev_t dev, int sp)
 {
+#ifndef EFIBOOT
if (major(dev) == 8)/* comN */
return comspeed(dev, sp);
+#endif
 
/* pc0 and anything else */
return 9600;