diff options
author | Kevin Lo <kevlo@cvs.openbsd.org> | 2021-10-04 01:33:43 +0000 |
---|---|---|
committer | Kevin Lo <kevlo@cvs.openbsd.org> | 2021-10-04 01:33:43 +0000 |
commit | 13531153789b147a190ccde799e6ba2ebfa316ef (patch) | |
tree | 570d6a236b0f4dcf8b85d467c94bd7ceb6333ec4 | |
parent | def3579d34edcb77d134231980b9e2ed5d5a75dc (diff) |
Build firmware for rsu(4), rtwn(4), and urtwn(4).
We have to install the files with new filenames (removal of "fw" from each of
the filenames) and change the driver to use the new filenames,
such that the package becomes irrelevant.
Discussed with deraadt@ and sthen@
ok deraadt@
-rw-r--r-- | share/man/man4/rsu.4 | 13 | ||||
-rw-r--r-- | share/man/man4/rtwn.4 | 21 | ||||
-rw-r--r-- | share/man/man4/urtwn.4 | 20 | ||||
-rw-r--r-- | sys/dev/microcode/Makefile | 6 | ||||
-rw-r--r-- | sys/dev/microcode/rsu/Makefile | 26 | ||||
-rw-r--r-- | sys/dev/microcode/rsu/build.c | 56 | ||||
-rw-r--r-- | sys/dev/microcode/rtwn/Makefile | 27 | ||||
-rw-r--r-- | sys/dev/microcode/rtwn/build.c | 60 | ||||
-rw-r--r-- | sys/dev/microcode/urtwn/Makefile | 26 | ||||
-rw-r--r-- | sys/dev/microcode/urtwn/build.c | 59 | ||||
-rw-r--r-- | sys/dev/pci/if_rtwn.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_rsu.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/if_urtwn.c | 10 |
13 files changed, 293 insertions, 49 deletions
diff --git a/share/man/man4/rsu.4 b/share/man/man4/rsu.4 index 1bd0d609419..2cf342bbdeb 100644 --- a/share/man/man4/rsu.4 +++ b/share/man/man4/rsu.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rsu.4,v 1.22 2019/11/10 14:10:41 sthen Exp $ +.\" $OpenBSD: rsu.4,v 1.23 2021/10/04 01:33:42 kevlo Exp $ .\" .\" Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 10 2019 $ +.Dd $Mdocdate: October 4 2021 $ .Dt RSU 4 .Os .Sh NAME @@ -78,15 +78,12 @@ driver can be configured at runtime with or on boot with .Xr hostname.if 5 . .Sh FILES -The driver needs at least version 1.1 of the following firmware file, -which is loaded when an interface is attached: +The adapter needs firmware files to run, which are loaded on demand by +the driver when the device is attached: .Pp .Bl -tag -width Ds -offset indent -compact -.It Pa /etc/firmware/rsu-rtl8712fw +.It Pa /etc/firmware/rsu-rtl8712 .El -.Pp -A prepackaged version of the firmware can be installed using -.Xr fw_update 1 . .Sh HARDWARE The following adapters should work: .Pp diff --git a/share/man/man4/rtwn.4 b/share/man/man4/rtwn.4 index f89e3c5ae1e..c8661b859f4 100644 --- a/share/man/man4/rtwn.4 +++ b/share/man/man4/rtwn.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: rtwn.4,v 1.9 2019/11/10 14:10:41 sthen Exp $ +.\" $OpenBSD: rtwn.4,v 1.10 2021/10/04 01:33:42 kevlo Exp $ .\" .\" Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> .\" Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> @@ -15,7 +15,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: November 10 2019 $ +.Dd $Mdocdate: October 4 2021 $ .Dt RTWN 4 .Os .Sh NAME @@ -82,19 +82,16 @@ driver can be configured at runtime with or on boot with .Xr hostname.if 5 . .Sh FILES -The driver needs at least version 1.0 of the following firmware files, -which are loaded when an interface is brought up: +The adapter needs firmware files to run, which are loaded on demand by +the driver when the device is attached: .Pp .Bl -tag -width Ds -offset indent -compact -.It Pa /etc/firmware/rtwn-rtl8188efw -.It Pa /etc/firmware/rtwn-rtl8192cfwU -.It Pa /etc/firmware/rtwn-rtl8192cfwU_B -.It Pa /etc/firmware/rtwn-rtl8723fw -.It Pa /etc/firmware/rtwn-rtl8723fw_B +.It Pa /etc/firmware/rtwn-rtl8188e +.It Pa /etc/firmware/rtwn-rtl8192cU +.It Pa /etc/firmware/rtwn-rtl8192cU_B +.It Pa /etc/firmware/rtwn-rtl8723 +.It Pa /etc/firmware/rtwn-rtl8723_B .El -.Pp -A prepackaged version of the firmware can be installed using -.Xr fw_update 1 . .Sh EXAMPLES The following example scans for available networks: .Pp diff --git a/share/man/man4/urtwn.4 b/share/man/man4/urtwn.4 index 42910b4d6b7..5f1a59e1878 100644 --- a/share/man/man4/urtwn.4 +++ b/share/man/man4/urtwn.4 @@ -1,4 +1,4 @@ -.\" $OpenBSD: urtwn.4,v 1.50 2021/04/25 15:59:56 stsp Exp $ +.\" $OpenBSD: urtwn.4,v 1.51 2021/10/04 01:33:42 kevlo Exp $ .\" .\" Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 25 2021 $ +.Dd $Mdocdate: October 4 2021 $ .Dt URTWN 4 .Os .Sh NAME @@ -84,19 +84,15 @@ driver can be configured at runtime with or on boot with .Xr hostname.if 5 . .Sh FILES -The driver needs at least version 1.1p0 of the following firmware files, -which are loaded when an interface is attached: +The adapter needs firmware files to run, which are loaded on demand by +the driver when the device is attached: .Pp .Bl -tag -width Ds -offset indent -compact -.It Pa /etc/firmware/urtwn-rtl8192cfwT -.It Pa /etc/firmware/urtwn-rtl8192cfwU -.It Pa /etc/firmware/urtwn-rtl8192eu_nic -.It Pa /etc/firmware/urtwn-rtl8723fw -.It Pa /etc/firmware/urtwn-rtl8188eufw +.It Pa /etc/firmware/urtwn-rtl8192cT +.It Pa /etc/firmware/urtwn-rtl8192cU +.It Pa /etc/firmware/urtwn-rtl8192eu +.It Pa /etc/firmware/urtwn-rtl8188eu .El -.Pp -A prepackaged version of the firmware can be installed using -.Xr fw_update 1 . .Sh HARDWARE The following adapters should work: .Pp diff --git a/sys/dev/microcode/Makefile b/sys/dev/microcode/Makefile index 92ae0ea7a14..083d6068e1f 100644 --- a/sys/dev/microcode/Makefile +++ b/sys/dev/microcode/Makefile @@ -1,6 +1,6 @@ -# $OpenBSD: Makefile,v 1.23 2014/07/12 21:56:57 tedu Exp $ +# $OpenBSD: Makefile,v 1.24 2021/10/04 01:33:42 kevlo Exp $ -SUBDIR= afb atmel bnx cirruslogic fxp kue neomagic myx ral rum \ - symbol tigon tht tusb3410 typhoon udl yds zydas +SUBDIR= afb atmel bnx cirruslogic fxp kue neomagic myx ral rsu rtwn rum \ + symbol tigon tht tusb3410 typhoon udl urtwn yds zydas .include <bsd.subdir.mk> diff --git a/sys/dev/microcode/rsu/Makefile b/sys/dev/microcode/rsu/Makefile new file mode 100644 index 00000000000..89b6c2dbc42 --- /dev/null +++ b/sys/dev/microcode/rsu/Makefile @@ -0,0 +1,26 @@ +# $OpenBSD: Makefile,v 1.1 2021/10/04 01:33:42 kevlo Exp $ + +NOPROG= +NOMAN= +CC=${HOSTCC} + +FIRM= rsu-rtl8712 + +PROG= build + +CLEANFILES+= ${FIRM} ${PROG} + +all: ${FIRM} + +${FIRM}: build + ${.OBJDIR}/build + +realinstall: + +afterinstall: + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${FIRM} ${DESTDIR}/etc/firmware + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${.CURDIR}/rsu-license ${DESTDIR}/etc/firmware + +.include <bsd.prog.mk> diff --git a/sys/dev/microcode/rsu/build.c b/sys/dev/microcode/rsu/build.c new file mode 100644 index 00000000000..79ec78dd764 --- /dev/null +++ b/sys/dev/microcode/rsu/build.c @@ -0,0 +1,56 @@ +/* $OpenBSD: build.c,v 1.1 2021/10/04 01:33:42 kevlo Exp $ */ + +/*- + * Copyright (c) 2006 + * Damien Bergamini <damien.bergamini@free.fr> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> + +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +#include "microcode.h" + +static void +output(const char *name, const uint8_t *ucode, int size) +{ + ssize_t rlen; + int fd; + + printf("creating %s length %d\n", name, size); + + fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + err(1, "%s", name); + + rlen = write(fd, ucode, size); + if (rlen == -1) + err(1, "%s", name); + if (rlen != size) + errx(1, "%s: short write", name); + + close(fd); +} + +int +main(void) +{ + output("rsu-rtl8712", rtl8712, sizeof rtl8712); + + return 0; +} diff --git a/sys/dev/microcode/rtwn/Makefile b/sys/dev/microcode/rtwn/Makefile new file mode 100644 index 00000000000..fca54ba2cff --- /dev/null +++ b/sys/dev/microcode/rtwn/Makefile @@ -0,0 +1,27 @@ +# $OpenBSD: Makefile,v 1.1 2021/10/04 01:33:42 kevlo Exp $ + +NOPROG= +NOMAN= +CC=${HOSTCC} + +FIRM= rtwn-rtl8188e rtwn-rtl8192cU rtwn-rtl8192cU_B rtwn-rtl8723 \ + rtwn-rtl8723_B + +PROG= build + +CLEANFILES+= ${FIRM} ${PROG} + +all: ${FIRM} + +${FIRM}: build + ${.OBJDIR}/build + +realinstall: + +afterinstall: + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${FIRM} ${DESTDIR}/etc/firmware + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${.CURDIR}/rtwn-license ${DESTDIR}/etc/firmware + +.include <bsd.prog.mk> diff --git a/sys/dev/microcode/rtwn/build.c b/sys/dev/microcode/rtwn/build.c new file mode 100644 index 00000000000..037ef473355 --- /dev/null +++ b/sys/dev/microcode/rtwn/build.c @@ -0,0 +1,60 @@ +/* $OpenBSD: build.c,v 1.1 2021/10/04 01:33:42 kevlo Exp $ */ + +/*- + * Copyright (c) 2006 + * Damien Bergamini <damien.bergamini@free.fr> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> + +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +#include "microcode.h" + +static void +output(const char *name, const uint8_t *ucode, int size) +{ + ssize_t rlen; + int fd; + + printf("creating %s length %d\n", name, size); + + fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + err(1, "%s", name); + + rlen = write(fd, ucode, size); + if (rlen == -1) + err(1, "%s", name); + if (rlen != size) + errx(1, "%s: short write", name); + + close(fd); +} + +int +main(void) +{ + output("rtwn-rtl8188e", rtl8188e, sizeof rtl8188e); + output("rtwn-rtl8192cU", rtl8192cU, sizeof rtl8192cU); + output("rtwn-rtl8192cU_B", rtl8192cU_B, sizeof rtl8192cU_B); + output("rtwn-rtl8723", rtl8723, sizeof rtl8723); + output("rtwn-rtl8723_B", rtl8723_B, sizeof rtl8723_B); + + return 0; +} diff --git a/sys/dev/microcode/urtwn/Makefile b/sys/dev/microcode/urtwn/Makefile new file mode 100644 index 00000000000..5e0e2f702bb --- /dev/null +++ b/sys/dev/microcode/urtwn/Makefile @@ -0,0 +1,26 @@ +# $OpenBSD: Makefile,v 1.1 2021/10/04 01:33:42 kevlo Exp $ + +NOPROG= +NOMAN= +CC=${HOSTCC} + +FIRM= urtwn-rtl8188eu urtwn-rtl8192cT urtwn-rtl8192cU urtwn-rtl8192eu + +PROG= build + +CLEANFILES+= ${FIRM} ${PROG} + +all: ${FIRM} + +${FIRM}: build + ${.OBJDIR}/build + +realinstall: + +afterinstall: + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${FIRM} ${DESTDIR}/etc/firmware + ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 644 \ + ${.CURDIR}/urtwn-license ${DESTDIR}/etc/firmware + +.include <bsd.prog.mk> diff --git a/sys/dev/microcode/urtwn/build.c b/sys/dev/microcode/urtwn/build.c new file mode 100644 index 00000000000..870ce85b9c8 --- /dev/null +++ b/sys/dev/microcode/urtwn/build.c @@ -0,0 +1,59 @@ +/* $OpenBSD: build.c,v 1.1 2021/10/04 01:33:42 kevlo Exp $ */ + +/*- + * Copyright (c) 2006 + * Damien Bergamini <damien.bergamini@free.fr> + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <sys/types.h> + +#include <err.h> +#include <fcntl.h> +#include <stdio.h> +#include <unistd.h> + +#include "microcode.h" + +static void +output(const char *name, const uint8_t *ucode, int size) +{ + ssize_t rlen; + int fd; + + printf("creating %s length %d\n", name, size); + + fd = open(name, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + err(1, "%s", name); + + rlen = write(fd, ucode, size); + if (rlen == -1) + err(1, "%s", name); + if (rlen != size) + errx(1, "%s: short write", name); + + close(fd); +} + +int +main(void) +{ + output("urtwn-rtl8188eu", rtl8188eu, sizeof rtl8188eu); + output("urtwn-rtl8192cT", rtl8192cT, sizeof rtl8192cT); + output("urtwn-rtl8192cU", rtl8192cU, sizeof rtl8192cU); + output("urtwn-rtl8192eu", rtl8192eu, sizeof rtl8192eu); + + return 0; +} diff --git a/sys/dev/pci/if_rtwn.c b/sys/dev/pci/if_rtwn.c index f72d0be8b22..449729c000e 100644 --- a/sys/dev/pci/if_rtwn.c +++ b/sys/dev/pci/if_rtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rtwn.c,v 1.37 2020/12/12 11:48:53 jan Exp $ */ +/* $OpenBSD: if_rtwn.c,v 1.38 2021/10/04 01:33:42 kevlo Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -2131,17 +2131,17 @@ rtwn_pci_load_firmware(void *cookie, u_char **fw, size_t *len) int error; if (sc->sc_sc.chip & RTWN_CHIP_88E) - name = "rtwn-rtl8188efw"; + name = "rtwn-rtl8188e"; else if (sc->sc_sc.chip & RTWN_CHIP_23A) { if (sc->sc_sc.chip & RTWN_CHIP_UMC_A_CUT) - name = "rtwn-rtl8723fw"; + name = "rtwn-rtl8723"; else - name = "rtwn-rtl8723fw_B"; + name = "rtwn-rtl8723_B"; } else if ((sc->sc_sc.chip & (RTWN_CHIP_UMC_A_CUT | RTWN_CHIP_92C)) == RTWN_CHIP_UMC_A_CUT) - name = "rtwn-rtl8192cfwU"; + name = "rtwn-rtl8192cU"; else - name = "rtwn-rtl8192cfwU_B"; + name = "rtwn-rtl8192cU_B"; error = loadfirmware(name, fw, len); if (error) diff --git a/sys/dev/usb/if_rsu.c b/sys/dev/usb/if_rsu.c index 929d8f161d5..5f5f6d498c1 100644 --- a/sys/dev/usb/if_rsu.c +++ b/sys/dev/usb/if_rsu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rsu.c,v 1.49 2021/02/25 02:48:20 dlg Exp $ */ +/* $OpenBSD: if_rsu.c,v 1.50 2021/10/04 01:33:42 kevlo Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -2021,9 +2021,9 @@ rsu_load_firmware(struct rsu_softc *sc) int ntries, error; /* Read firmware image from the filesystem. */ - if ((error = loadfirmware("rsu-rtl8712fw", &fw, &size)) != 0) { + if ((error = loadfirmware("rsu-rtl8712", &fw, &size)) != 0) { printf("%s: failed loadfirmware of file %s (error %d)\n", - sc->sc_dev.dv_xname, "rsu-rtl8712fw", error); + sc->sc_dev.dv_xname, "rsu-rtl8712", error); return (error); } if (size < sizeof(*hdr)) { diff --git a/sys/dev/usb/if_urtwn.c b/sys/dev/usb/if_urtwn.c index c2133041168..51fc0120f82 100644 --- a/sys/dev/usb/if_urtwn.c +++ b/sys/dev/usb/if_urtwn.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_urtwn.c,v 1.97 2021/04/25 15:59:19 stsp Exp $ */ +/* $OpenBSD: if_urtwn.c,v 1.98 2021/10/04 01:33:42 kevlo Exp $ */ /*- * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> @@ -2045,14 +2045,14 @@ urtwn_load_firmware(void *cookie, u_char **fw, size_t *len) int error; if (sc->sc_sc.chip & RTWN_CHIP_92E) - name = "urtwn-rtl8192eu_nic"; + name = "urtwn-rtl8192eu"; else if (sc->sc_sc.chip & RTWN_CHIP_88E) - name = "urtwn-rtl8188eufw"; + name = "urtwn-rtl8188eu"; else if ((sc->sc_sc.chip & (RTWN_CHIP_UMC_A_CUT | RTWN_CHIP_92C)) == RTWN_CHIP_UMC_A_CUT) - name = "urtwn-rtl8192cfwU"; + name = "urtwn-rtl8192cU"; else - name = "urtwn-rtl8192cfwT"; + name = "urtwn-rtl8192cT"; error = loadfirmware(name, fw, len); if (error) |