remove goto in rdioctl()

2018-01-28 Thread Michael W. Bombardieri
Hello,

Function rdioctl() uses a goto to leave the switch statement
but a break would be enough. There is no other code to jump over
(avoid) as with rdstrategy() which has goto bad and goto done.

- Michael


Index: rd.c
===
RCS file: /cvs/src/sys/dev/rd.c,v
retrieving revision 1.13
diff -u -p -u -r1.13 rd.c
--- rd.c30 Dec 2017 23:08:29 -  1.13
+++ rd.c29 Jan 2018 03:52:56 -
@@ -266,31 +266,31 @@ rdioctl(dev_t dev, u_long cmd, caddr_t d
rdgetdisklabel(dev, sc, lp, 0);
memcpy(sc->sc_dk.dk_label, lp, sizeof(*lp));
free(lp, M_TEMP, sizeof(*lp));
-   goto done;
+   break;
 
case DIOCGPDINFO:
rdgetdisklabel(dev, sc, (struct disklabel *)data, 1);
-   goto done;
+   break;
 
case DIOCGDINFO:
*(struct disklabel *)data = *(sc->sc_dk.dk_label);
-   goto done;
+   break;
 
case DIOCGPART:
((struct partinfo *)data)->disklab = sc->sc_dk.dk_label;
((struct partinfo *)data)->part =
>sc_dk.dk_label->d_partitions[DISKPART(dev)];
-   goto done;
+   break;
 
case DIOCWDINFO:
case DIOCSDINFO:
if ((fflag & FWRITE) == 0) {
error = EBADF;
-   goto done;
+   break;
}
 
if ((error = disk_lock(>sc_dk)) != 0)
-   goto done;
+   break;
 
error = setdisklabel(sc->sc_dk.dk_label,
(struct disklabel *)data, sc->sc_dk.dk_openmask);
@@ -301,10 +301,9 @@ rdioctl(dev_t dev, u_long cmd, caddr_t d
}
 
disk_unlock(>sc_dk);
-   goto done;
+   break;
}
 
- done:
device_unref(>sc_dev);
return (error);
 }



[PATCH] Fix Order of Intel Graphics on amd64.html

2018-01-28 Thread Bryan Vyhmeister
I noticed that the order of listed Intel integrated graphics support is
not consistent from newest to oldest as it is for Radeon devices on the
same page. The patch puts Kaby Lake above Skylake as it is 7th and then
6th generation respectively.

Bryan


Index: amd64.html
===
RCS file: /cvs/www/amd64.html,v
retrieving revision 1.274
diff -u -p -r1.274 amd64.html
--- amd64.html  19 Nov 2017 18:36:41 -  1.274
+++ amd64.html  29 Jan 2018 01:22:34 -
@@ -73,8 +73,8 @@ expected to work:
 
 Intel devices can be confusing as well. Some devices expected to work:
 
-Intel Skylake (found on i-6xxx CPU)
 Intel Kaby Lake (found on i-7xxx CPU)
+Intel Skylake (found on i-6xxx CPU)
 Intel Broadwell (found on i-5xxx CPU)
 Earlier Intel models and revisions are expected to work as well.
 The PowerVR graphics found on some Atom CPUs are not supported.



install.sub: Simplify interface listing

2018-01-28 Thread Klemens Nanni
On Sun, Jan 28, 2018 at 09:09:42PM +, Stuart Henderson wrote:
> On 2018/01/28 21:34, bijan wrote:
> > On 01/28/18 21:24, bijan wrote:
> > > Hi,
> > > 
> > > Added -l argument to ifconfig to only print names of interfaces.
> > > (Maybe a lame excuse from me for being too lazy but FreeBSD
> > > supports it too)
> > Missed the usage string, Update!
> 
> Pretty sure this diff has been rejected once or twice before.
> 
> This is what the installer does,
> 
> ifconfig | sed -n 's/^\([^[:space:]]*\):.*/\1/p'
Seems overly complicated to me, interface names are the only lines in
ifconfig without leading whitespaces and must begin with a lowercase
letter.

How about this? Exact same output.

Index: distrib/miniroot/install.sub
===
RCS file: /cvs/src/distrib/miniroot/install.sub,v
retrieving revision 1.1056
diff -u -p -r1.1056 install.sub
--- distrib/miniroot/install.sub21 Jan 2018 19:58:37 -  1.1056
+++ distrib/miniroot/install.sub28 Jan 2018 22:39:19 -
@@ -330,7 +330,7 @@ get_ifs() {
local _if _iflist=$(rmel vlan $(ifconfig -C))
 
for _if in $(ifconfig "$@" 2>/dev/null |
-   sed -n 's/^\([^[:space:]]*\):.*/\1/p'); do
+   sed -n '/^[a-z]/s,:.*,,p'); do
isin "${_if%%+([0-9])}" $_iflist || echo $_if
done
 }



Re: list only names of interfaces in ifconfig.8

2018-01-28 Thread Stuart Henderson
On 2018/01/28 21:34, bijan wrote:
> On 01/28/18 21:24, bijan wrote:
> > Hi,
> > 
> > Added -l argument to ifconfig to only print names of interfaces.
> > (Maybe a lame excuse from me for being too lazy but FreeBSD
> > supports it too)
> Missed the usage string, Update!

Pretty sure this diff has been rejected once or twice before.

This is what the installer does,

ifconfig | sed -n 's/^\([^[:space:]]*\):.*/\1/p'



Re: list only names of interfaces in ifconfig.8

2018-01-28 Thread bijan

On 01/28/18 21:24, bijan wrote:

Hi,

Added -l argument to ifconfig to only print names of interfaces.
(Maybe a lame excuse from me for being too lazy but FreeBSD
supports it too)

Missed the usage string, Update!

>From 2d00dbc563db1f2581342cbf02a83cbb3a6a5966 Mon Sep 17 00:00:00 2001
From: Bijan Ebrahimi 
Date: Fri, 19 Jan 2018 18:18:24 +0330
Subject: [PATCH] added printing list names

---
 sbin/ifconfig/ifconfig.8 |  7 ++-
 sbin/ifconfig/ifconfig.c | 37 -
 2 files changed, 42 insertions(+), 2 deletions(-)

diff --git sbin/ifconfig/ifconfig.8 sbin/ifconfig/ifconfig.8
index ef9592cf3..6055fa4aa 100644
--- sbin/ifconfig/ifconfig.8
+++ sbin/ifconfig/ifconfig.8
@@ -39,7 +39,7 @@
 .Nd configure network interface parameters
 .Sh SYNOPSIS
 .Nm ifconfig
-.Op Fl AaC
+.Op Fl AaCl
 .Op Ar interface
 .Op Ar address_family
 .Oo
@@ -88,6 +88,11 @@ This is the default, if no parameters are given to
 Print the names of all network pseudo-devices that
 can be created dynamically at runtime using
 .Nm Cm create .
+.It Fl l
+Causes
+.Nm
+to print names of all existing interfaces.
+.Nm .
 .It Ar interface
 The
 .Ar interface
diff --git sbin/ifconfig/ifconfig.c sbin/ifconfig/ifconfig.c
index 4a0f4d632..3505287c4 100644
--- sbin/ifconfig/ifconfig.c
+++ sbin/ifconfig/ifconfig.c
@@ -232,6 +232,7 @@ void	unsettrunkport(const char *, int);
 void	settrunkproto(const char *, int);
 void	trunk_status(void);
 void	list_cloners(void);
+void	list_names(void);
 
 #ifndef SMALL
 void	carp_status(void);
@@ -632,6 +633,7 @@ main(int argc, char *argv[])
 	const struct afswtch *rafp = NULL;
 	int create = 0;
 	int Cflag = 0;
+	int lflag = 0;
 	int gflag = 0;
 	int i;
 
@@ -659,6 +661,10 @@ main(int argc, char *argv[])
 			case 'g':
 gflag = 1;
 break;
+			case 'l':
+lflag = 1;
+nomore = 1;
+break;
 			case 'C':
 Cflag = 1;
 nomore = 1;
@@ -695,6 +701,10 @@ main(int argc, char *argv[])
 		list_cloners();
 		return (0);
 	}
+	if (lflag) {
+		list_names();
+		return (0);
+	}
 	if (gflag) {
 		if (argc == 0)
 			printgroupattribs(name);
@@ -1147,6 +1157,31 @@ list_cloners(void)
 	free(buf);
 }
 
+void
+list_names(void)
+{
+	int count = 0;
+	struct ifaddrs *ifap, *ifa;
+	const char *if_name = NULL;
+
+	if (getifaddrs() != 0)
+		err(1, "getifaddrs");
+
+	for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+		if (if_name == ifa->ifa_name)
+			continue;
+		if_name = ifa->ifa_name;
+		if (count++ > 0)
+			printf(" ");
+		printf ("%s", ifa->ifa_name);
+	}
+
+	if (if_name != NULL)
+		printf("\n");
+
+	freeifaddrs(ifap);
+}
+
 #define RIDADDR 0
 #define ADDR	1
 #define MASK	2
@@ -5453,7 +5488,7 @@ __dead void
 usage(void)
 {
 	fprintf(stderr,
-	"usage: ifconfig [-AaC] [interface] [address_family] "
+	"usage: ifconfig [-AaCl] [interface] [address_family] "
 	"[address [dest_address]]\n"
 	"\t\t[parameters]\n");
 	exit(1);
-- 
2.14.2



list only names of interfaces in ifconfig.8

2018-01-28 Thread bijan

Hi,

Added -l argument to ifconfig to only print names of interfaces.
(Maybe a lame excuse from me for being too lazy but FreeBSD
supports it too)

Hope it helps,
B.E


>From dc4f0f8d85a9aa2007b47139f6d609c9830bbfc3 Mon Sep 17 00:00:00 2001
From: Bijan Ebrahimi 
Date: Fri, 19 Jan 2018 18:18:24 +0330
Subject: [PATCH] added printing names of all inetrfaces to ifconfig

---
 sbin/ifconfig/ifconfig.8 |  7 ++-
 sbin/ifconfig/ifconfig.c | 35 +++
 2 files changed, 41 insertions(+), 1 deletion(-)

diff --git sbin/ifconfig/ifconfig.8 sbin/ifconfig/ifconfig.8
index ef9592cf3..6055fa4aa 100644
--- sbin/ifconfig/ifconfig.8
+++ sbin/ifconfig/ifconfig.8
@@ -39,7 +39,7 @@
 .Nd configure network interface parameters
 .Sh SYNOPSIS
 .Nm ifconfig
-.Op Fl AaC
+.Op Fl AaCl
 .Op Ar interface
 .Op Ar address_family
 .Oo
@@ -88,6 +88,11 @@ This is the default, if no parameters are given to
 Print the names of all network pseudo-devices that
 can be created dynamically at runtime using
 .Nm Cm create .
+.It Fl l
+Causes
+.Nm
+to print names of all existing interfaces.
+.Nm .
 .It Ar interface
 The
 .Ar interface
diff --git sbin/ifconfig/ifconfig.c sbin/ifconfig/ifconfig.c
index 4a0f4d632..c4c9a1527 100644
--- sbin/ifconfig/ifconfig.c
+++ sbin/ifconfig/ifconfig.c
@@ -232,6 +232,7 @@ void	unsettrunkport(const char *, int);
 void	settrunkproto(const char *, int);
 void	trunk_status(void);
 void	list_cloners(void);
+void	list_names(void);
 
 #ifndef SMALL
 void	carp_status(void);
@@ -632,6 +633,7 @@ main(int argc, char *argv[])
 	const struct afswtch *rafp = NULL;
 	int create = 0;
 	int Cflag = 0;
+	int lflag = 0;
 	int gflag = 0;
 	int i;
 
@@ -659,6 +661,10 @@ main(int argc, char *argv[])
 			case 'g':
 gflag = 1;
 break;
+			case 'l':
+lflag = 1;
+nomore = 1;
+break;
 			case 'C':
 Cflag = 1;
 nomore = 1;
@@ -695,6 +701,10 @@ main(int argc, char *argv[])
 		list_cloners();
 		return (0);
 	}
+	if (lflag) {
+		list_names();
+		return (0);
+	}
 	if (gflag) {
 		if (argc == 0)
 			printgroupattribs(name);
@@ -1147,6 +1157,31 @@ list_cloners(void)
 	free(buf);
 }
 
+void
+list_names(void)
+{
+	int count = 0;
+	struct ifaddrs *ifap, *ifa;
+	const char *if_name = NULL;
+
+	if (getifaddrs() != 0)
+		err(1, "getifaddrs");
+
+	for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
+		if (if_name == ifa->ifa_name)
+			continue;
+		if_name = ifa->ifa_name;
+		if (count++ > 0)
+			printf(" ");
+		printf ("%s", ifa->ifa_name);
+	}
+
+	if (if_name != NULL)
+		printf("\n");
+
+	freeifaddrs(ifap);
+}
+
 #define RIDADDR 0
 #define ADDR	1
 #define MASK	2
-- 
2.14.2




Re: remove link from oce.4

2018-01-28 Thread Jason McIntyre
On Sun, Jan 28, 2018 at 12:34:55PM +0100, Denis Fondras wrote:
> Hi,
> 
> The link to Emulex website is not available anymore. Remove it.
> 
> Denis
> 

fixed, thanks.
jmc

> Index: oce.4
> ===
> RCS file: /cvs/src/share/man/man4/oce.4,v
> retrieving revision 1.3
> diff -u -p -r1.3 oce.4
> --- oce.4 15 Aug 2012 18:10:06 -  1.3
> +++ oce.4 28 Jan 2018 11:23:39 -
> @@ -46,8 +46,6 @@ HP NC552SFP (SPF+/10GbaseSR)
>  IBM System x 10GbE (SPF+/10GbaseSR)
>  .El
>  .Pp
> -For a comprehensive list of devices please consult the Emulex website:
> -.Lk http://www.emulex.com/products/10gbe-network-adapters-nic.html .
>  .Sh SEE ALSO
>  .Xr arp 4 ,
>  .Xr ifmedia 4 ,
> 



Re: attach ampintc/ampintcmsi early on arm64

2018-01-28 Thread Mark Kettenis
> Date: Sun, 28 Jan 2018 16:22:34 +1100
> From: Jonathan Gray 
> 
> Attach ampintc/ampintcmsi0 early.  Makes it possible to use qemu_arm64
> U-Boot (which isn't aware of virtio devices) with root on pci ahci.
> 
> pciecam0 at mainbus0
> pci0 at pciecam0
> "Red Hat Host" rev 0x00 at pci0 dev 0 function 0 not configured
> ahci0 at pci0 dev 1 function 0 "Intel 82801I AHCI" rev 0x02: msi,ahci0: 
> unable to map interrupt

Ah, the pre-registration code doesn't work for MSIs.  We could fix
that, but your solution is simpler, and it shouldn't hurt attaching
the generic interrupt controllers early.

ok kettenis@



Re: psci function id register on arm64

2018-01-28 Thread Mark Kettenis
> Date: Sun, 28 Jan 2018 14:35:52 +1100
> From: Jonathan Gray 
> 
> semarie reported problems with running arm64 on qemu which turned
> out to be triggered by the psci version call.
> 
> [ using 979488 bytes of bsd ELF symbol table ]
> Copyright (c) 1982, 1986, 1989, 1991, 1993
> The Regents of the University of California.  All rights reserved.
> Copyright (c) 1995-2018 OpenBSD. All rights reserved.  https://www.OpenBSD.org
> 
> OpenBSD 6.2-current (GENERIC) #160: Wed Jan 24 18:26:59 MST 2018
> dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC
> real mem  = 2105647104 (2008MB)
> avail mem = 2017124352 (1923MB)
> mainbus0 at root: unknown model
> cpu0 at mainbus0: ARM Cortex-A57 r1p0
> efi0 at mainbus0: UEFI 2.0.5
> efi0: Das U-Boot rev 0x0
> psci0 at mainbus0Stopped at  psci_attach+0xf4:
> ddb> tr
> hvc_call() at psci_attach+0xf0
> psci_attach() at mainbus_attach_node+0x244
> mainbus_attach_node() at mainbus_attach+0x1ec
> mainbus_attach() at config_attach+0x214
> config_attach() at config_rootfound+0xc0
> config_rootfound() at cpu_configure+0x34
> cpu_configure() at main+0x348
> main() at $x.2+0x70
> ddb> sh reg
> x00x8400
> x1 0
> x2 0
> x3 0
> x40xff80008bf258initstack+0x4a68
> x50x1323
> x60x861e4d1cb67f8248
> x70x861e4d1cb67f8248
> x80xff8000571978hvc_call
> x90x8408
> x10   0x8409
> x110
> x120
> x130
> x14   0xff80073ad744_end+0x6a5ac0c
> x15   0xff8000671f20ap_bits_user
> x16   0xb64c1a07
> x17   0xef56e85d
> x18   0xff80008bf200initstack+0x4a10
> x19   0xff80073ac200_end+0x6a596c8
> x20   0xff80008bf310initstack+0x4b20
> x21   0xff800080$d.5
> x220
> x23   0xff80073ac224_end+0x6a596ec
> x24   0xff8000813388psci_cd
> x25   0xff8000813360psci_ca
> x26   0xff800095gf_log+0x1bc
> x27   0x4085f000
> x28   0x4020
> x29   0xff80008bf2b0initstack+0x4ac0
> x300
> sp0xff80008bf200initstack+0x4a10
> spsr  0x63c5
> elr   0xff8000571978hvc_call
> lr0xff8000254d08psci_attach+0xf4
> psci_attach+0xf4:
> 
> Though it seems other calls had trouble before that, likely since the
> psci changes made in december.
> 
> Attempting to power down...
> Stopped at  boot+0xd4:
> ddb> tr
> hvc_call() at boot+0xd0
> boot() at sys_reboot+0x2c
> reboot() at svc_handler+0x1bc
> svc_handler() at do_el0_sync+0xbc
> do_el0_sync() at handle_el0_sync+0x68
> handle_el0_sync() at 0x4ca7b07a4
> --- trap ---
> ddb> sh reg
> x00x8408
> x1 0
> x2 0
> x3 0
> x40xff8000277918hvc_call
> x5 0
> x60x33781a588ce87b4c
> x70x33781a588ce87b4c
> x80xff80072f7200_end+0x69a49d8
> x90x25bf00aba3ce1b98
> x10  0x16707157c
> x11 0x64
> x120x1dcd662__ALIGN_SIZE+0x1bcd662
> x13  0xc
> x14   0xff8007235184_end+0x68e295c
> x150
> x160
> x17 0x10
> x18   0xff8018b00d90
> x19   0x1008
> x20   0xff8000805000nv2tov_type+0x8
> x21 0x37
> x22 0x37
> x23   0xff8018b00f00
> x24   0xff800080$d.5
> x25   0xff8000856360sysent
> x26 0x37
> x27   0xff80008566d2sysent+0x372
> x28  0x1
> x29   0xff8018b00da0
> x30   0x4f49c4fa
> sp0xff8018b00d90
> spsr  0x63c5
> elr   0xff8000277918hvc_call
> lr0xff80002433f0boot+0xd4
> boot+0xd4:
> 
> qemu-system-aarch64 doesn't recognise the psci call when the high 32 bits
> of x0 are not zero.  The PSCI implemented by the ATF in the
> overdrive 1000 only looks at the low 32 bits.  And all the function ids
> we use set bit 31.  

remove link from oce.4

2018-01-28 Thread Denis Fondras
Hi,

The link to Emulex website is not available anymore. Remove it.

Denis

Index: oce.4
===
RCS file: /cvs/src/share/man/man4/oce.4,v
retrieving revision 1.3
diff -u -p -r1.3 oce.4
--- oce.4   15 Aug 2012 18:10:06 -  1.3
+++ oce.4   28 Jan 2018 11:23:39 -
@@ -46,8 +46,6 @@ HP NC552SFP (SPF+/10GbaseSR)
 IBM System x 10GbE (SPF+/10GbaseSR)
 .El
 .Pp
-For a comprehensive list of devices please consult the Emulex website:
-.Lk http://www.emulex.com/products/10gbe-network-adapters-nic.html .
 .Sh SEE ALSO
 .Xr arp 4 ,
 .Xr ifmedia 4 ,