mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
Merge pull request #4758 from heitbaum/510_drivers
Updates to compile with Linux 5.10
This commit is contained in:
commit
d1e4c083ba
@ -0,0 +1,207 @@
|
||||
From: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
Date: Sun, 13 Sep 2020 07:33:32 +0200
|
||||
Subject: Get rid of get_fs/set_fs calls in Broadcom WL driver.
|
||||
Origin: https://gist.github.com/joanbm/5c640ac074d27fd1d82c74a5b67a1290
|
||||
|
||||
Fixes linux-next where get_fs/set_fs is already removed for some architectures.
|
||||
|
||||
NB: Some checks in wlc_ioctl_internal are likely superfluous,
|
||||
but I'm not familiar enough with the driver to remove them with confidence.
|
||||
|
||||
See also: https://lwn.net/Articles/722267/
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/arch/x86/include/asm/uaccess.h?h=next-20200911&id=47058bb54b57962b3958a936ddbc59355e4c5504
|
||||
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/include/linux/uaccess.h?h=next-20200911&id=5e6e9852d6f76e01b2e6803c74258afa5b432bc5
|
||||
|
||||
Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
|
||||
---
|
||||
x86-64/src/wl/sys/wl_cfg80211_hybrid.c | 29 ++-----------------------
|
||||
x86-64/src/wl/sys/wl_iw.c | 25 ++--------------------
|
||||
x86-64/src/wl/sys/wl_linux.c | 40 ++++++++++++++++++++++++++++++-----
|
||||
x86-64/src/wl/sys/wl_linux.h | 2 ++
|
||||
x86-64/src/wl/sys/wlc_pub.h | 1 +
|
||||
5 files changed, 42 insertions(+), 55 deletions(-)
|
||||
|
||||
diff --git a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
index 8e01841..111ec5a 100644
|
||||
--- a/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
+++ b/x86-64/src/wl/sys/wl_cfg80211_hybrid.c
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <wlioctl.h>
|
||||
#include <proto/802.11.h>
|
||||
#include <wl_cfg80211_hybrid.h>
|
||||
+#include <wl_linux.h>
|
||||
|
||||
#define EVENT_TYPE(e) dtoh32((e)->event_type)
|
||||
#define EVENT_FLAGS(e) dtoh16((e)->flags)
|
||||
@@ -445,30 +445,8 @@
|
||||
static s32
|
||||
wl_dev_ioctl(struct net_device *dev, u32 cmd, void *arg, u32 len)
|
||||
{
|
||||
- struct ifreq ifr;
|
||||
- struct wl_ioctl ioc;
|
||||
- mm_segment_t fs;
|
||||
- s32 err = 0;
|
||||
-
|
||||
BUG_ON(len < sizeof(int));
|
||||
-
|
||||
- memset(&ioc, 0, sizeof(ioc));
|
||||
- ioc.cmd = cmd;
|
||||
- ioc.buf = arg;
|
||||
- ioc.len = len;
|
||||
- strcpy(ifr.ifr_name, dev->name);
|
||||
- ifr.ifr_data = (caddr_t)&ioc;
|
||||
-
|
||||
- fs = get_fs();
|
||||
- set_fs(KERNEL_DS);
|
||||
-#if defined(WL_USE_NETDEV_OPS)
|
||||
- err = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#else
|
||||
- err = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#endif
|
||||
- set_fs(fs);
|
||||
-
|
||||
- return err;
|
||||
+ return wlc_ioctl_internal(dev, cmd, arg, len);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
|
||||
diff --git a/x86-64/src/wl/sys/wl_iw.c b/x86-64/src/wl/sys/wl_iw.c
|
||||
index c4c610b..e346b15 100644
|
||||
--- a/x86-64/src/wl/sys/wl_iw.c
|
||||
+++ b/x86-64/src/wl/sys/wl_iw.c
|
||||
@@ -37,6 +37,7 @@ typedef const struct si_pub si_t;
|
||||
|
||||
#include <wl_dbg.h>
|
||||
#include <wl_iw.h>
|
||||
+#include <wl_linux.h>
|
||||
|
||||
extern bool wl_iw_conn_status_str(uint32 event_type, uint32 status,
|
||||
uint32 reason, char* stringBuf, uint buflen);
|
||||
@@ -104,29 +104,7 @@
|
||||
int len
|
||||
)
|
||||
{
|
||||
- struct ifreq ifr;
|
||||
- wl_ioctl_t ioc;
|
||||
- mm_segment_t fs;
|
||||
- int ret;
|
||||
-
|
||||
- memset(&ioc, 0, sizeof(ioc));
|
||||
- ioc.cmd = cmd;
|
||||
- ioc.buf = arg;
|
||||
- ioc.len = len;
|
||||
-
|
||||
- strcpy(ifr.ifr_name, dev->name);
|
||||
- ifr.ifr_data = (caddr_t) &ioc;
|
||||
-
|
||||
- fs = get_fs();
|
||||
- set_fs(KERNEL_DS);
|
||||
-#if defined(WL_USE_NETDEV_OPS)
|
||||
- ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#else
|
||||
- ret = dev->do_ioctl(dev, &ifr, SIOCDEVPRIVATE);
|
||||
-#endif
|
||||
- set_fs(fs);
|
||||
-
|
||||
- return ret;
|
||||
+ return wlc_ioctl_internal(dev, cmd, arg, len);
|
||||
}
|
||||
|
||||
static int
|
||||
diff --git a/x86-64/src/wl/sys/wl_linux.c b/x86-64/src/wl/sys/wl_linux.c
|
||||
index 66069d4..cc01d2b 100644
|
||||
--- a/x86-64/src/wl/sys/wl_linux.c
|
||||
+++ b/x86-64/src/wl/sys/wl_linux.c
|
||||
@@ -1651,10 +1651,7 @@
|
||||
goto done2;
|
||||
}
|
||||
|
||||
- if (get_fs().seg == KERNEL_DS.seg)
|
||||
- buf = ioc.buf;
|
||||
-
|
||||
- else if (ioc.buf) {
|
||||
+ if (ioc.buf) {
|
||||
if (!(buf = (void *) MALLOC(wl->osh, MAX(ioc.len, WLC_IOCTL_MAXLEN)))) {
|
||||
bcmerror = BCME_NORESOURCE;
|
||||
goto done2;
|
||||
@@ -1681,7 +1678,7 @@ wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
||||
WL_UNLOCK(wl);
|
||||
|
||||
done1:
|
||||
- if (ioc.buf && (ioc.buf != buf)) {
|
||||
+ if (ioc.buf) {
|
||||
if (copy_to_user(ioc.buf, buf, ioc.len))
|
||||
bcmerror = BCME_BADADDR;
|
||||
MFREE(wl->osh, buf, MAX(ioc.len, WLC_IOCTL_MAXLEN));
|
||||
@@ -1694,6 +1691,39 @@ done2:
|
||||
return (OSL_ERROR(bcmerror));
|
||||
}
|
||||
|
||||
+int
|
||||
+wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len)
|
||||
+{
|
||||
+ wl_info_t *wl;
|
||||
+ wl_if_t *wlif;
|
||||
+ int bcmerror;
|
||||
+
|
||||
+ if (!dev)
|
||||
+ return -ENETDOWN;
|
||||
+
|
||||
+ wl = WL_INFO(dev);
|
||||
+ wlif = WL_DEV_IF(dev);
|
||||
+ if (wlif == NULL || wl == NULL || wl->dev == NULL)
|
||||
+ return -ENETDOWN;
|
||||
+
|
||||
+ bcmerror = 0;
|
||||
+
|
||||
+ WL_TRACE(("wl%d: wlc_ioctl_internal: cmd 0x%x\n", wl->pub->unit, cmd));
|
||||
+
|
||||
+ WL_LOCK(wl);
|
||||
+ if (!capable(CAP_NET_ADMIN)) {
|
||||
+ bcmerror = BCME_EPERM;
|
||||
+ } else {
|
||||
+ bcmerror = wlc_ioctl(wl->wlc, cmd, buf, len, wlif->wlcif);
|
||||
+ }
|
||||
+ WL_UNLOCK(wl);
|
||||
+
|
||||
+ ASSERT(VALID_BCMERROR(bcmerror));
|
||||
+ if (bcmerror != 0)
|
||||
+ wl->pub->bcmerror = bcmerror;
|
||||
+ return (OSL_ERROR(bcmerror));
|
||||
+}
|
||||
+
|
||||
static struct net_device_stats*
|
||||
wl_get_stats(struct net_device *dev)
|
||||
{
|
||||
diff --git a/x86-64/src/wl/sys/wl_linux.h b/x86-64/src/wl/sys/wl_linux.h
|
||||
index 5b1048e..c8c1f41 100644
|
||||
--- a/x86-64/src/wl/sys/wl_linux.h
|
||||
+++ b/x86-64/src/wl/sys/wl_linux.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#define _wl_linux_h_
|
||||
|
||||
#include <wlc_types.h>
|
||||
+#include <wlc_pub.h>
|
||||
|
||||
typedef struct wl_timer {
|
||||
struct timer_list timer;
|
||||
@@ -187,6 +188,7 @@ extern irqreturn_t wl_isr(int irq, void *dev_id, struct pt_regs *ptregs);
|
||||
extern int __devinit wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
|
||||
extern void wl_free(wl_info_t *wl);
|
||||
extern int wl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
|
||||
+extern int wlc_ioctl_internal(struct net_device *dev, int cmd, void *buf, int len);
|
||||
extern struct net_device * wl_netdev_get(wl_info_t *wl);
|
||||
|
||||
#endif
|
||||
diff --git a/x86-64/src/wl/sys/wlc_pub.h b/x86-64/src/wl/sys/wlc_pub.h
|
||||
index 53a98b8..2b5a029 100644
|
||||
--- a/x86-64/src/wl/sys/wlc_pub.h
|
||||
+++ b/x86-64/src/wl/sys/wlc_pub.h
|
||||
@@ -24,6 +24,7 @@
|
||||
|
||||
#include <wlc_types.h>
|
||||
#include <wlc_utils.h>
|
||||
+#include <siutils.h>
|
||||
#include "proto/802.11.h"
|
||||
#include "proto/bcmevent.h"
|
||||
|
@ -0,0 +1,14 @@
|
||||
--- NVIDIA-Linux-x86_64-340.108-orig/kernel/nv-drm.c 2020-12-14 19:58:21.951120294 +0100
|
||||
+++ NVIDIA-Linux-x86_64-340.108-new/kernel/nv-drm.c 2020-12-14 20:30:05.855962292 +0100
|
||||
@@ -365,7 +365,11 @@
|
||||
struct nv_gem_object *nv_obj = container_of(obj, struct nv_gem_object, base);
|
||||
int page_count = obj->size >> PAGE_SHIFT;
|
||||
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
|
||||
+ return drm_prime_pages_to_sg(obj->dev, nv_obj->pages, page_count);
|
||||
+#else
|
||||
return drm_prime_pages_to_sg(nv_obj->pages, page_count);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void* nv_gem_prime_vmap(
|
@ -5,9 +5,9 @@
|
||||
PKG_NAME="xf86-video-nvidia"
|
||||
# Remember to run "python packages/x11/driver/xf86-video-nvidia/scripts/make_nvidia_udev.py" and commit changes to
|
||||
# "packages/x11/driver/xf86-video-nvidia/udev.d/96-nvidia.rules" whenever bumping version.
|
||||
# Host may require installation of python-lxml and python-requests packages.
|
||||
PKG_VERSION="450.80.02"
|
||||
PKG_SHA256="ad4492e8905e915fe850ffb618347770ca2f0cb488ec3b2b09e96e427dc0d0c3"
|
||||
# Host may require installation of python3-lxml and python3-requests packages.
|
||||
PKG_VERSION="455.45.01"
|
||||
PKG_SHA256="9b707d6244735cf0f745a74c47ed0feeec47bc56baec8122306dee6169ce10fd"
|
||||
PKG_ARCH="x86_64"
|
||||
PKG_LICENSE="nonfree"
|
||||
PKG_SITE="http://www.nvidia.com/"
|
||||
|
@ -292,6 +292,8 @@ ATTRS{device}=="0x1fb8", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x1fb9", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x1ff9", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x20b0", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x20b1", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x20b2", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x20f1", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2182", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2184", GOTO="configure_nvidia"
|
||||
@ -301,6 +303,9 @@ ATTRS{device}=="0x2191", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2192", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x21c4", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x21d1", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2204", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2206", GOTO="configure_nvidia"
|
||||
ATTRS{device}=="0x2484", GOTO="configure_nvidia"
|
||||
GOTO="configure_nvidia-legacy"
|
||||
|
||||
LABEL="configure_nvidia"
|
||||
|
Loading…
x
Reference in New Issue
Block a user