update for kernel 6.0

This commit is contained in:
JerryXiao 2022-10-13 11:35:20 +08:00
parent 25b93f5a3d
commit fe2b38e66f
Signed by: Jerry
GPG Key ID: 22618F758B5BE2E5
3 changed files with 159 additions and 4 deletions

View File

@ -1,7 +1,7 @@
pkgbase = nvidia-340xx
pkgdesc = NVIDIA drivers for linux, 340xx legacy branch
pkgver = 340.108
pkgrel = 30
pkgrel = 31
url = https://www.nvidia.com/
arch = x86_64
license = custom
@ -22,6 +22,7 @@ pkgbase = nvidia-340xx
source = 0008-kernel-5.16.patch
source = 0009-kernel-5.17.patch
source = 0010-kernel-5.18.patch
source = 0011-kernel-6.0.patch
b2sums = 6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028
b2sums = 49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8
b2sums = 7150233df867a55f57aa5e798b9c7618329d98459fecc35c4acfad2e9772236cb229703c4fa072381c509279d0588173d65f46297231f4d3bfc65a1ef52e65b1
@ -34,6 +35,7 @@ pkgbase = nvidia-340xx
b2sums = caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9
b2sums = 0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2
b2sums = d69c9acbe550d5fccca68ca6a0d5095cbcaf887d2bc43704a8eb85533896692f16701eef07ead297881f596f5502c3105bb5bea77b2dcaf6c4dc2b49941f9f19
b2sums = a411df83e0166366ecc7b9adfb374168487b6cfac5de0ee4a41f2c24bc234947c16f814b5c50bf36ba08c5b7e69b0c14378194f338bbe3fcae446375651d98b4
pkgname = nvidia-340xx
pkgdesc = NVIDIA drivers for linux, 340xx legacy branch

151
0011-kernel-6.0.patch Normal file
View File

@ -0,0 +1,151 @@
diff -Naur a/kernel/nv-acpi.c b/kernel/nv-acpi.c
--- a/kernel/nv-acpi.c 2022-10-14 02:26:04.379601051 +0000
+++ b/kernel/nv-acpi.c 2022-10-14 02:28:07.309332369 +0000
@@ -178,6 +178,53 @@
return 0;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
+static struct nv_acpi_add_enumerated_data {
+ nv_acpi_t *object;
+ int *counter;
+};
+static int nv_acpi_add_enumerated(struct acpi_device *dev, void *data)
+{
+ struct nv_acpi_add_enumerated_data *rcvd_data = data;
+ nv_acpi_t *pNvAcpiObject = rcvd_data->object;
+ int *device_counter = rcvd_data->counter;
+ acpi_status status = -1;
+ nv_acpi_integer_t device_id = 0;
+ if (!dev)
+ return 0;
+ if (*device_counter == NV_MAXNUM_DISPLAY_DEVICES) {
+ nv_printf(NV_DBG_ERRORS,
+ "NVRM: nv_acpi_add: Total number of devices cannot exceed %d\n",
+ NV_MAXNUM_DISPLAY_DEVICES);
+ return 1;
+ }
+ status =
+ acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
+ if (ACPI_FAILURE(status))
+ /* Couldnt query device_id for this device */
+ return 0;
+
+ device_id = (device_id & 0xffff);
+
+ if ((device_id != 0x100) && /* Not a known CRT device-id */
+ (device_id != 0x200) && /* Not a known TV device-id */
+ (device_id != 0x0110) && (device_id != 0x0118) && (device_id != 0x0400) && /* Not an LCD*/
+ (device_id != 0x0111) && (device_id != 0x0120) && (device_id != 0x0300)) /* Not a known DVI device-id */
+ {
+ /* This isnt a known device Id.
+ Do default switching on this system. */
+ pNvAcpiObject->default_display_mask = 1;
+ return 1;
+ }
+
+ pNvAcpiObject->pNvVideo[*device_counter].dev_id = device_id;
+ pNvAcpiObject->pNvVideo[*device_counter].dev_handle = dev->handle;
+
+ (*device_counter)++;
+ return 0;
+}
+#endif
+
static int nv_acpi_add(struct acpi_device *device)
{
/*
@@ -190,8 +237,10 @@
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list control_argument_list = { 0, NULL };
nv_stack_t *sp = NULL;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
+#endif
int device_counter = 0;
NV_KMEM_CACHE_ALLOC_STACK(sp);
@@ -220,6 +269,7 @@
// grab handles to all the important nodes representing devices
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
list_for_each_safe(node, next, &device->children)
{
struct acpi_device *dev =
@@ -261,6 +311,13 @@
device_counter++;
}
+#else
+ struct nv_acpi_add_enumerated_data data = {
+ .object = pNvAcpiObject,
+ .counter = &device_counter,
+ };
+ acpi_dev_for_each_child(device, nv_acpi_add_enumerated, &data);
+#endif
// arg 0, bits 1:0, 0 = enable events
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
@@ -1192,6 +1249,31 @@
return status;
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 0, 0)
+static int nv_acpi_ddc_method_enumerated(struct acpi_device *dev, void *data)
+{
+ acpi_handle *lcd_dev_handle = data;
+ acpi_status status;
+ nv_acpi_integer_t device_id = 0;
+ if (!dev)
+ return 0;
+ status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
+ if (ACPI_FAILURE(status))
+ /* Couldnt query device_id for this device */
+ return 0;
+
+ device_id = (device_id & 0xffff);
+
+ if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
+ {
+ *lcd_dev_handle = dev->handle;
+ nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
+ return 1;
+ }
+ return 0;
+}
+#endif
+
/*
* This function executes a _DDC ACPI method.
*/
@@ -1207,8 +1289,10 @@
union acpi_object *ddc;
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
struct acpi_object_list input = { 1, &ddc_arg0 };
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
struct list_head *node, *next;
nv_acpi_integer_t device_id = 0;
+#endif
NvU32 i;
acpi_handle dev_handle = NULL;
acpi_handle lcd_dev_handle = NULL;
@@ -1239,6 +1323,7 @@
return RM_ERR_NOT_SUPPORTED;
}
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0)
list_for_each_safe(node, next, &device->children)
{
struct acpi_device *dev =
@@ -1262,6 +1347,9 @@
}
}
+#else
+ acpi_dev_for_each_child(device, nv_acpi_ddc_method_enumerated, &lcd_dev_handle);
+#endif
if (lcd_dev_handle == NULL)
{

View File

@ -1,12 +1,12 @@
# Maintainer: graysky <graysky AT archlinux DOT us>
# Maintainer: Jerry Xiao <aur@mail.jerryxiao.cc>
# Contributor: Giancarlo Razzolini <grazzolini@archlinux.org>
# Contributor: Eric Bélanger <eric@archlinux.org>
# Contributor: graysky <graysky AT archlinux DOT us>
pkgbase=nvidia-340xx
pkgname=(nvidia-340xx nvidia-340xx-dkms); [ -n "$NVIDIA_340XX_DKMS_ONLY" ] && pkgname=(nvidia-340xx-dkms)
pkgver=340.108
pkgrel=30
pkgrel=31
pkgdesc="NVIDIA drivers for linux, 340xx legacy branch"
arch=('x86_64')
url="https://www.nvidia.com/"
@ -27,6 +27,7 @@ source=("https://us.download.nvidia.com/XFree86/Linux-x86_64/${pkgver}/NVIDIA-Li
0008-kernel-5.16.patch
0009-kernel-5.17.patch
0010-kernel-5.18.patch
0011-kernel-6.0.patch
)
b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb21396cfd89ebc54c32f921ea17e3e47eaa95abcbc24ecbd144fb89028'
'49d99f612e8eee3ab5e34083c25348bfd14ed5fc8a7984dafc0dad7c0ae0df2c0b2a63a1bb993da440eb0a60293d7c753ca3889bd2f51991b8ddc51bce2fe4a8'
@ -39,7 +40,8 @@ b2sums=('6538bbec53b10f8d20977f9b462052625742e9709ef06e24cf2e55de5d0c55f1620a4bb
'b3b7bbd597252b25ccb68f431f83707a10d464996f6c74bb67143795df96054da719faf09c1ad2e1c215261356833ad3fa0d9e60552151f827f9d7be7ae44605'
'caedc5651bfd14c02fb677f9c5e87adef298d871c6281b78ce184108310e4243ded82210873014be7fedee0dd6251305fa9bbce0c872b76438e0895ef76109d9'
'0266e1baaac9ffbb94d9e916a693b1663d8686b15e970bfc30f7c51f051a0af9267aa5f6a12b68586c69d2e9796a1124488b3997ba4b26db1a5ac10a892f0df2'
'd69c9acbe550d5fccca68ca6a0d5095cbcaf887d2bc43704a8eb85533896692f16701eef07ead297881f596f5502c3105bb5bea77b2dcaf6c4dc2b49941f9f19')
'd69c9acbe550d5fccca68ca6a0d5095cbcaf887d2bc43704a8eb85533896692f16701eef07ead297881f596f5502c3105bb5bea77b2dcaf6c4dc2b49941f9f19'
'a411df83e0166366ecc7b9adfb374168487b6cfac5de0ee4a41f2c24bc234947c16f814b5c50bf36ba08c5b7e69b0c14378194f338bbe3fcae446375651d98b4')
_pkg="NVIDIA-Linux-x86_64-${pkgver}-no-compat32"
# default is 'linux' substitute custom name here