xref: /freebsd/usr.sbin/fwget/pci/pci_network_realtek (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1#-
2# SPDX-License-Identifier: BSD-2-Clause
3#
4# Copyright 2023 Bjoern A. Zeeb
5# Copyright (c) 2024 The FreeBSD Foundation
6#
7# Portions of this software were developed by Björn Zeeb
8# under sponsorship from the FreeBSD Foundation.
9#
10# Redistribution and use in source and binary forms, with or without
11# modification, are permitted provided that the following conditions
12# are met:
13# 1. Redistributions of source code must retain the above copyright
14#    notice, this list of conditions and the following disclaimer.
15# 2. Redistributions in binary form must reproduce the above copyright
16#    notice, this list of conditions and the following disclaimer in the
17#    documentation and/or other materials provided with the distribution.
18#
19# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29# SUCH DAMAGE.
30#
31
32# rtw88
33pci_network_realtek_rtw88()
34{
35
36	case "$1" in
37
38	# The case pattern table below is generated by a script also helping
39	# to generate the flavor/firmware Makefile definitions for ports.
40	# { sys/contrib/dev/rtw88/zzz_fw_ports_fwget.sh }
41	### >>>
42
43	0xd723)	addpkg "wifi-firmware-rtw88-kmod-rtw8723d"; return 1 ;;
44	0xb821)	addpkg "wifi-firmware-rtw88-kmod-rtw8821c"; return 1 ;;
45	0xc821)	addpkg "wifi-firmware-rtw88-kmod-rtw8821c"; return 1 ;;
46	0xb822)	addpkg "wifi-firmware-rtw88-kmod-rtw8822b"; return 1 ;;
47	0xc822)	addpkg "wifi-firmware-rtw88-kmod-rtw8822c"; return 1 ;;
48	0xc82f)	addpkg "wifi-firmware-rtw88-kmod-rtw8822c"; return 1 ;;
49
50	### <<<
51	esac
52}
53
54# rtw89
55pci_network_realtek_rtw89()
56{
57
58	case "$1" in
59
60	# The case pattern table below is generated by a script also helping
61	# to generate the flavor/firmware Makefile definitions for ports.
62	# { sys/contrib/dev/rtw89/zzz_fw_ports_fwget.sh }
63	### >>>
64
65	0xb851)	addpkg "wifi-firmware-rtw89-kmod-rtw8851b"; return 1 ;;
66	0x8852)	addpkg "wifi-firmware-rtw89-kmod-rtw8852a"; return 1 ;;
67	0xa85a)	addpkg "wifi-firmware-rtw89-kmod-rtw8852a"; return 1 ;;
68	0xb852)	addpkg "wifi-firmware-rtw89-kmod-rtw8852b"; return 1 ;;
69	0xb85b)	addpkg "wifi-firmware-rtw89-kmod-rtw8852b"; return 1 ;;
70	0xc852)	addpkg "wifi-firmware-rtw89-kmod-rtw8852c"; return 1 ;;
71	0x8922)	addpkg "wifi-firmware-rtw89-kmod-rtw8922a"; return 1 ;;
72
73	### <<<
74	esac
75}
76
77
78pci_network_realtek()
79{
80
81	for _drv in rtw88 rtw89; do
82		pci_network_realtek_${_drv} "$1"
83		case $? in
84		1)	break ;;
85		esac
86	done
87}
88