summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristopher Kersey <augustus@gentoo.org>2005-12-07 21:32:18 +0000
committerKristopher Kersey <augustus@gentoo.org>2005-12-07 21:32:18 +0000
commitfca9921d2ba877afb6517013b65d9311ed2259a8 (patch)
tree1b9b714eeac64062ffe9b64c9766ea9f04e67e1f /media-video
parentStable on amd64. (diff)
downloadgentoo-2-fca9921d2ba877afb6517013b65d9311ed2259a8.tar.gz
gentoo-2-fca9921d2ba877afb6517013b65d9311ed2259a8.tar.bz2
gentoo-2-fca9921d2ba877afb6517013b65d9311ed2259a8.zip
Added Zander's power management patch as requested in bug #114640. Added documentation as requested in bug #114659.
(Portage version: 2.0.51.22-r3)
Diffstat (limited to 'media-video')
-rw-r--r--media-video/nvidia-kernel/ChangeLog10
-rw-r--r--media-video/nvidia-kernel/Manifest3
-rw-r--r--media-video/nvidia-kernel/files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff385
-rw-r--r--media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.8174-r12
-rw-r--r--media-video/nvidia-kernel/nvidia-kernel-1.0.8174-r1.ebuild122
5 files changed, 521 insertions, 1 deletions
diff --git a/media-video/nvidia-kernel/ChangeLog b/media-video/nvidia-kernel/ChangeLog
index f202816a7ab1..9896486a5dfd 100644
--- a/media-video/nvidia-kernel/ChangeLog
+++ b/media-video/nvidia-kernel/ChangeLog
@@ -1,6 +1,14 @@
# ChangeLog for media-video/nvidia-kernel
# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.124 2005/12/05 18:09:42 augustus Exp $
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/ChangeLog,v 1.125 2005/12/07 21:32:17 augustus Exp $
+
+*nvidia-kernel-1.0.8174-r1 (07 Dec 2005)
+
+ 07 Dec 2005; <augustus@gentoo.org>
+ +files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff,
+ +nvidia-kernel-1.0.8174-r1.ebuild:
+ Added Zander's power management patch as requested in bug #114640.
+ Added documentation as requested in bug #114659.
*nvidia-kernel-1.0.8174 (05 Dec 2005)
diff --git a/media-video/nvidia-kernel/Manifest b/media-video/nvidia-kernel/Manifest
index 59b5842c5869..5ff14f980da3 100644
--- a/media-video/nvidia-kernel/Manifest
+++ b/media-video/nvidia-kernel/Manifest
@@ -6,12 +6,14 @@ MD5 6912838fee04de491aa184c309e274a9 nvidia-kernel-1.0.6111-r3.ebuild 4523
MD5 a8662932891c8000604f99edb85c808a ChangeLog 32042
MD5 6e28642fae4a75a66584dd04910cbac4 nvidia-kernel-1.0.7676-r1.ebuild 4669
MD5 044c61105ab94548ebf0d98a8482eec6 nvidia-kernel-1.0.7676.ebuild 4549
+MD5 946faef95ff3151aea56b2272d854b11 nvidia-kernel-1.0.8174-r1.ebuild 3581
MD5 075fe48a4f1fc90d2c3814e7bcd1d1ab metadata.xml 313
MD5 0da986517ab8d7beb13c5d1fe5a4c1c6 nvidia-kernel-1.0.7667.ebuild 4538
MD5 ed1e098d85579c75542ef0a49ee4dd5c files/digest-nvidia-kernel-1.0.6111-r3 163
MD5 8a4687b0fc3e7cc0b36c247697d94701 files/digest-nvidia-kernel-1.0.6629-r4 163
MD5 97b3ec5488fb7f7f6cdde31ee42e45af files/digest-nvidia-kernel-1.0.7167-r1 163
MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676-r1 163
+MD5 eafb3ff0c01e832a5a4abc80f9e7eec7 files/digest-nvidia-kernel-1.0.8174-r1 164
MD5 61c3ebdd8604c971bf969ea03040d170 files/digest-nvidia-kernel-1.0.7174 163
MD5 ef2c4ecedb45b67d79b43ffe58c660cf files/digest-nvidia-kernel-1.0.7667 163
MD5 4ea42a34abde5c81fe828b09afab7651 files/digest-nvidia-kernel-1.0.7676 163
@@ -53,3 +55,4 @@ MD5 5125c6d55ae72122144771ef1697db53 files/1.0.7676/NVIDIA_kernel-1.0-7676-13610
MD5 196649a84a2396a6588f27457a39d1fa files/1.0.7676/NVIDIA_kernel-1.0-7676-1386866.diff 2491
MD5 99b630e5a1d4b732e930781f25187194 files/1.0.7676/NVIDIA_kernel-1.0-7676-1321905.diff 1047
MD5 c0495ec827a938afcb807dd618e03945 files/1.0.7676/NVIDIA_kernel-1.0-7676-1359015.diff 3294
+MD5 1cac21325aacb18a199949ee20979165 files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff 11631
diff --git a/media-video/nvidia-kernel/files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff b/media-video/nvidia-kernel/files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff
new file mode 100644
index 000000000000..565a7ac557a9
--- /dev/null
+++ b/media-video/nvidia-kernel/files/1.0.8174/NVIDIA_kernel-1.0-8174-1423627.diff
@@ -0,0 +1,385 @@
+Only in usr/src/nv.1423627: .nv.c.rej.swp
+diff -ru usr/src/nv/Makefile.kbuild usr/src/nv.1423627/Makefile.kbuild
+--- usr/src/nv/Makefile.kbuild 2005-11-23 03:58:01.000000000 +0100
++++ usr/src/nv.1423627/Makefile.kbuild 2005-12-04 14:56:24.092375500 +0100
+@@ -186,6 +186,14 @@
+ ifeq ($(shell $(CONFTEST) sysctl_max_map_count), 1)
+ EXTRA_CFLAGS += -DNV_SYSCTL_MAX_MAP_COUNT_PRESENT
+ endif
++
++ ifeq ($(shell $(CONFTEST) pm_message_t), 1)
++ EXTRA_CFLAGS += -DNV_PM_MESSAGE_T_PRESENT
++ endif
++
++ ifeq ($(shell $(CONFTEST) pci_choose_state), 1)
++ EXTRA_CFLAGS += -DNV_PCI_CHOOSE_STATE_PRESENT
++ endif
+ endif
+
+ ifeq ($(shell $(CONFTEST) remap_pfn_range), 1)
+diff -ru usr/src/nv/conftest.sh usr/src/nv.1423627/conftest.sh
+--- usr/src/nv/conftest.sh 2005-11-23 03:58:01.000000000 +0100
++++ usr/src/nv.1423627/conftest.sh 2005-12-04 14:56:24.092375500 +0100
+@@ -643,4 +643,47 @@
+ fi
+ ;;
+
++ pm_message_t)
++ #
++ # Does linux/pm.h declare the pm_message_t type?
++ #
++
++ echo "#include <linux/pm.h>
++ void nv_test_pm_message_t(pm_message_t state) {
++ pm_message_t *p = &state;
++ }" > conftest$$.c
++
++ $CC $CFLAGS -Wno-error -c conftest$$.c > /dev/null 2>&1
++ rm -f conftest$$.c
++
++ if [ -f conftest$$.o ]; then
++ rm -f conftest$$.o
++ echo 1
++ else
++ echo 0
++ fi
++ ;;
++
++ pci_choose_state)
++ #
++ # Determine if pci_choose_state() is present.
++ #
++
++ echo "#include <linux/pci.h>
++ pci_power_t
++ nv_pci_choose_state(struct pci_dev *dev, pm_message_t state) {
++ return pci_choose_state(dev, state);
++ }" > conftest$$.c
++
++ $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
++ rm -f conftest$$.c
++
++ if [ -f conftest$$.o ]; then
++ rm -f conftest$$.o
++ echo 1
++ else
++ echo 0
++ fi
++ ;;
++
+ esac
+diff -ru usr/src/nv/nv-linux.h usr/src/nv.1423627/nv-linux.h
+--- usr/src/nv/nv-linux.h 2005-11-23 03:58:01.000000000 +0100
++++ usr/src/nv.1423627/nv-linux.h 2005-12-04 14:56:24.092375500 +0100
+@@ -642,15 +642,49 @@
+ #define NV_PRINT_AT(at)
+ #endif
+
+-// acpi support has been back-ported to the 2.4 kernel, but the 2.4 driver
+-// model is not sufficient for full acpi support. it may work in some cases,
+-// but not enough for us to officially support this configuration.
+-#if defined(CONFIG_ACPI) && defined(KERNEL_2_6)
+-#define NV_PM_SUPPORT_ACPI
++/*
++ * On Linux 2.6, we support both APM and ACPI power management. On Linux
++ * 2.4, we support APM, only. ACPI support has been back-ported to the
++ * Linux 2.4 kernel, but the Linux 2.4 driver model is not sufficient for
++ * full ACPI support: it may work with some systems, but not reliably
++ * enough for us to officially support this configuration.
++ *
++ * We support two Linux kernel power managment interfaces: the original
++ * pm_register()/pm_unregister() on Linux 2.4 and the device driver model
++ * backed PCI driver power management callbacks introduced with Linux
++ * 2.6.
++ *
++ * The code below determines which interface to support on this kernel
++ * version, if any; if built for Linux 2.6, it will also determine if the
++ * kernel comes with ACPI or APM power management support.
++ */
++#if defined(KERNEL_2_6) && (defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI))
++#define NV_PM_SUPPORT_DEVICE_DRIVER_MODEL
++#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
++#define NV_PM_SUPPORT_NEW_STYLE_APM
++#endif
+ #endif
+
+-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
+-#define NV_PM_SUPPORT_APM
++/*
++ * On Linux 2.6 kernels >= 2.6.11, the PCI subsystem provides a new
++ * interface that allows PCI drivers to determine the correct power state
++ * for a given system power state; our suspend/resume callbacks now use
++ * this interface and operate on PCI power state defines.
++ *
++ * Define these new PCI power state #define's here for compatibility with
++ * older Linux 2.6 kernels.
++ */
++#if defined(KERNEL_2_6) && !defined(PCI_D0)
++#define PCI_D0 PM_SUSPEND_ON
++#define PCI_D3hot PM_SUSPEND_MEM
++#endif
++
++#if defined(KERNEL_2_6) && !defined(NV_PM_MESSAGE_T_PRESENT)
++typedef u32 pm_message_t;
++#endif
++
++#if defined(KERNEL_2_4) && (defined(CONFIG_APM) || defined(CONFIG_APM_MODULE))
++#define NV_PM_SUPPORT_OLD_STYLE_APM
+ #endif
+
+ #ifndef minor
+diff -ru usr/src/nv/nv.c usr/src/nv.1423627/nv.c
+--- usr/src/nv/nv.c 2005-11-23 03:58:01.000000000 +0100
++++ usr/src/nv.1423627/nv.c 2005-12-04 14:57:13.791481500 +0100
+@@ -29,7 +29,7 @@
+
+ static nv_linux_state_t nv_linux_devices[NV_MAX_DEVICES];
+
+-#if defined(NV_PM_SUPPORT_APM)
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
+ static struct pm_dev *apm_nv_dev[NV_MAX_DEVICES] = { 0 };
+ #endif
+
+@@ -244,8 +244,8 @@
+ void nv_kern_isr_bh(unsigned long);
+ irqreturn_t nv_kern_isr(int, void *, struct pt_regs *);
+ void nv_kern_rc_timer(unsigned long);
+-#if defined(NV_PM_SUPPORT_APM)
+-int nv_kern_apm_event(struct pm_dev *dev, pm_request_t rqst, void *data);
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
++static int nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
+ #endif
+
+ static int nv_kern_read_cardinfo(char *, char **, off_t off, int, int *, void *);
+@@ -265,9 +265,10 @@
+ unsigned int nv_kern_ctl_poll(struct file *, poll_table *);
+
+ int nv_kern_probe(struct pci_dev *, const struct pci_device_id *);
+-#if defined(NV_PM_SUPPORT_ACPI)
+-int nv_kern_acpi_standby(struct pci_dev *, u32);
+-int nv_kern_acpi_resume(struct pci_dev *);
++
++#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
++static int nv_kern_suspend(struct pci_dev *, pm_message_t);
++static int nv_kern_resume(struct pci_dev *);
+ #endif
+
+ /***
+@@ -292,9 +293,9 @@
+ .name = "nvidia",
+ .id_table = nv_pci_table,
+ .probe = nv_kern_probe,
+-#if defined(NV_PM_SUPPORT_ACPI)
+- .suspend = nv_kern_acpi_standby,
+- .resume = nv_kern_acpi_resume,
++#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
++ .suspend = nv_kern_suspend,
++ .resume = nv_kern_resume,
+ #endif
+ };
+
+@@ -1299,7 +1300,7 @@
+ nv_lock_init_locks(nv_ctl);
+ }
+
+-#if defined(NV_PM_SUPPORT_APM)
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
+ for (i = 0; i < num_nv_devices; i++)
+ {
+ apm_nv_dev[i] = pm_register(PM_PCI_DEV, PM_SYS_VGA, nv_kern_apm_event);
+@@ -1418,7 +1419,7 @@
+ if (nv_pte_t_cache != NULL)
+ NV_KMEM_CACHE_DESTROY(nv_pte_t_cache);
+
+-#if defined(NV_PM_SUPPORT_APM)
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
+ for (i = 0; i < num_nv_devices; i++)
+ if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]);
+ #endif
+@@ -1473,10 +1474,10 @@
+ inter_module_unregister("nv_linux_devices");
+ #endif
+
+-#if defined(NV_PM_SUPPORT_APM)
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
+ for (i = 0; i < num_nv_devices; i++)
+ {
+- pm_unregister(apm_nv_dev[i]);
++ if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]);
+ }
+ #endif
+
+@@ -2429,9 +2430,9 @@
+ mod_timer(&nvl->rc_timer, jiffies + HZ); /* set another timeout in 1 second */
+ }
+
+-#if defined(NV_PM_SUPPORT_APM)
++#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
+ /* kernel calls us with a power management event */
+-int
++static int
+ nv_kern_apm_event(
+ struct pm_dev *dev,
+ pm_request_t rqst,
+@@ -2466,7 +2467,6 @@
+
+ switch (rqst)
+ {
+-#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
+ case PM_RESUME:
+ nv_printf(NV_DBG_INFO, "NVRM: APM: received resume event\n");
+ status = rm_power_management(nv, 0, NV_PM_APM_RESUME);
+@@ -2476,15 +2476,12 @@
+ nv_printf(NV_DBG_INFO, "NVRM: APM: received suspend event\n");
+ status = rm_power_management(nv, 0, NV_PM_APM_SUSPEND);
+ break;
+-#endif
+
+-#if defined(KERNEL_2_4)
+ // 2.4 kernels sent a PM_SAVE_STATE request when powering down via
+ // ACPI. just ignore it and return success so the power down works
+ case PM_SAVE_STATE:
+ status = RM_OK;
+ break;
+-#endif
+
+ default:
+ nv_printf(NV_DBG_WARNINGS, "NVRM: APM: unsupported event: %d\n", rqst);
+@@ -2496,7 +2493,7 @@
+
+ return status;
+ }
+-#endif
++#endif /* defined(NV_PM_SUPPORT_OLD_STYLE_APM) */
+
+ /*
+ ** nv_kern_ctl_open
+@@ -3739,6 +3736,7 @@
+ nvl = &nv_linux_devices[num_nv_devices];
+ nv = NV_STATE_PTR(nvl);
+
++ pci_set_drvdata(dev, (void *)nvl);
+ nvl->dev = dev;
+ nv->vendor_id = dev->vendor;
+ nv->device_id = dev->device;
+@@ -3816,11 +3814,10 @@
+ #endif
+ }
+
+-#if defined(NV_PM_SUPPORT_ACPI)
++#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
+
+-int
+-nv_acpi_event
+-(
++static int
++nv_power_management(
+ struct pci_dev *dev,
+ u32 state
+ )
+@@ -3828,70 +3825,77 @@
+ nv_state_t *nv;
+ nv_linux_state_t *lnv = NULL;
+ int status = RM_OK;
+- U032 i;
+-
+- nv_printf(NV_DBG_INFO, "NVRM: nv_acpi_event: %d\n", state);
+
+- for (i = 0; i < num_nv_devices; i++)
+- {
+- if (nv_linux_devices[i].dev == dev)
+- {
+- lnv = &nv_linux_devices[i];
+- break;
+- }
+- }
++ nv_printf(NV_DBG_INFO, "NVRM: nv_power_management: %d\n", state);
++ lnv = pci_get_drvdata(dev);
+
+ if ((!lnv) || (lnv->dev != dev))
+ {
+- nv_printf(NV_DBG_WARNINGS, "NVRM: ACPI: invalid device!\n");
++ nv_printf(NV_DBG_WARNINGS, "NVRM: PM: invalid device!\n");
+ return -1;
+ }
+
+ nv = NV_STATE_PTR(lnv);
++ nv_verify_pci_config(NV_STATE_PTR(lnv), TRUE);
+
+ switch (state)
+ {
+- case PM_SUSPEND_MEM:
++#if defined(NV_PM_SUPPORT_NEW_STYLE_APM)
++ case PCI_D3hot:
++ nv_printf(NV_DBG_INFO, "NVRM: APM: received suspend event\n");
++ status = rm_power_management(nv, 0, NV_PM_APM_SUSPEND);
++ break;
++
++ case PCI_D0:
++ nv_printf(NV_DBG_INFO, "NVRM: APM: received resume event\n");
++ status = rm_power_management(nv, 0, NV_PM_APM_RESUME);
++ break;
++#else
++ case PCI_D3hot:
+ nv_printf(NV_DBG_INFO, "NVRM: ACPI: received suspend event\n");
+ status = rm_power_management(nv, 0, NV_PM_ACPI_STANDBY);
+ break;
+
+- case PM_SUSPEND_ON:
++ case PCI_D0:
+ nv_printf(NV_DBG_INFO, "NVRM: ACPI: received resume event\n");
+ status = rm_power_management(nv, 0, NV_PM_ACPI_RESUME);
+ break;
+-
++#endif
+ default:
+- nv_printf(NV_DBG_WARNINGS, "NVRM: ACPI: unsupported event: %d\n", state);
++ nv_printf(NV_DBG_WARNINGS, "NVRM: PM: unsupported event: %d\n", state);
+ return -1;
+ }
+
+ if (status != RM_OK)
+- nv_printf(NV_DBG_ERRORS, "NVRM: ACPI: failed event: %d\n", state);
++ nv_printf(NV_DBG_ERRORS, "NVRM: PM: failed event: %d\n", state);
+
+ return status;
+ }
+
+-int
+-nv_kern_acpi_standby
+-(
+- struct pci_dev *dev,
+- u32 state
++static int nv_kern_suspend(
++ struct pci_dev *dev,
++ pm_message_t state
+ )
+ {
+- return nv_acpi_event(dev, state);
++ int power_state = -1;
++
++#if !defined(NV_PM_MESSAGE_T_PRESENT)
++ power_state = state;
++#elif defined(NV_PCI_CHOOSE_STATE_PRESENT)
++ power_state = pci_choose_state(dev, state);
++#endif
++
++ return nv_power_management(dev, power_state);
+ }
+
+-int
+-nv_kern_acpi_resume
+-(
++static int nv_kern_resume(
+ struct pci_dev *dev
+ )
+ {
+- return nv_acpi_event(dev, PM_SUSPEND_ON);
++ return nv_power_management(dev, PCI_D0);
+ }
+
+-#endif
++#endif /* defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL) */
+
+ void* NV_API_CALL nv_get_adapter_state(
+ U016 bus,
diff --git a/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.8174-r1 b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.8174-r1
new file mode 100644
index 000000000000..5d6a6bdffd91
--- /dev/null
+++ b/media-video/nvidia-kernel/files/digest-nvidia-kernel-1.0.8174-r1
@@ -0,0 +1,2 @@
+MD5 3f21b6928ab38960113bf257062576c7 NVIDIA-Linux-x86-1.0-8174-pkg1.run 11998227
+MD5 d1f9786dfda74005832ac005e276462a NVIDIA-Linux-x86_64-1.0-8174-pkg2.run 9559334
diff --git a/media-video/nvidia-kernel/nvidia-kernel-1.0.8174-r1.ebuild b/media-video/nvidia-kernel/nvidia-kernel-1.0.8174-r1.ebuild
new file mode 100644
index 000000000000..7a30a08e67e1
--- /dev/null
+++ b/media-video/nvidia-kernel/nvidia-kernel-1.0.8174-r1.ebuild
@@ -0,0 +1,122 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/nvidia-kernel/nvidia-kernel-1.0.8174-r1.ebuild,v 1.1 2005/12/07 21:32:17 augustus Exp $
+
+inherit eutils linux-mod
+
+X86_PKG_V="pkg1"
+AMD64_PKG_V="pkg2"
+NV_V="${PV/1.0./1.0-}"
+X86_NV_PACKAGE="NVIDIA-Linux-x86-${NV_V}"
+AMD64_NV_PACKAGE="NVIDIA-Linux-x86_64-${NV_V}"
+
+DESCRIPTION="Linux kernel module for the NVIDIA X11 driver"
+HOMEPAGE="http://www.nvidia.com/"
+SRC_URI="x86? ( ftp://download.nvidia.com/XFree86/Linux-x86/${NV_V}/${X86_NV_PACKAGE}-${X86_PKG_V}.run )
+ amd64? ( http://download.nvidia.com/XFree86/Linux-x86_64/${NV_V}/${AMD64_NV_PACKAGE}-${AMD64_PKG_V}.run )"
+
+if use x86; then
+ PKG_V="${X86_PKG_V}"
+ NV_PACKAGE="${X86_NV_PACKAGE}"
+elif use amd64; then
+ PKG_V="${AMD64_PKG_V}"
+ NV_PACKAGE="${AMD64_NV_PACKAGE}"
+fi
+
+S="${WORKDIR}/${NV_PACKAGE}-${PKG_V}/usr/src/nv"
+
+LICENSE="NVIDIA"
+SLOT="0"
+KEYWORDS="-* ~x86 ~amd64"
+RESTRICT="nostrip"
+IUSE=""
+
+RDEPEND="virtual/modutils"
+DEPEND="virtual/linux-sources"
+export _POSIX2_VERSION="199209"
+
+mtrr_check() {
+ ebegin "Checking for MTRR support"
+ linux_chkconfig_present MTRR
+ eend $?
+
+ if [[ $? -ne 0 ]] ; then
+ eerror "This version needs MTRR support for most chipsets!"
+ eerror "Please enable MTRR support in your kernel config, found at:"
+ eerror
+ eerror " Processor type and features"
+ eerror " [*] MTRR (Memory Type Range Register) support"
+ eerror
+ eerror "and recompile your kernel ..."
+ die "MTRR support not detected!"
+ fi
+}
+
+pkg_setup() {
+ linux-mod_pkg_setup
+ MODULE_NAMES="nvidia(video:${S})"
+ BUILD_PARAMS="IGNORE_CC_MISMATCH=yes V=1 SYSSRC=${KV_DIR} SYSOUT=${KV_OUT_DIR}"
+ mtrr_check
+}
+
+src_unpack() {
+ local NV_PATCH_PREFIX="${FILESDIR}/${PV}/NVIDIA_kernel-1.0-${PV##*.}"
+
+ if [[ ${KV_MINOR} -eq 6 && ${KV_PATCH} -lt 7 ]] ; then
+ echo
+ ewarn "Your kernel version is ${KV_MAJOR}.${KV_MINOR}.${KV_PATCH}"
+ ewarn "This is not officially supported for ${P}. It is likely you"
+ ewarn "will not be able to compile or use the kernel module."
+ ewarn "It is recommended that you upgrade your kernel to a version >= 2.6.7"
+ echo
+ ewarn "DO NOT file bug reports for kernel versions less than 2.6.7 as they will be ignored."
+ fi
+
+ cd ${WORKDIR}
+ bash ${DISTDIR}/${NV_PACKAGE}-${PKG_V}.run --extract-only
+
+ # Add patches below, with a breif description.
+ cd ${S}
+ # Any general patches should go here
+
+ # Patches from Zander goes here
+ epatch ${NV_PATCH_PREFIX}-1423627.diff
+
+ # Now any patches specific to the 2.6 kernel should go here
+ if kernel_is 2 6 ; then
+ einfo "Applying 2.6 kernel patches"
+ # Fix calling of smp_processor_id() when preempt is enabled
+ epatch ${NV_PATCH_PREFIX//8174/7167}-disable-preempt-on-smp_processor_id.patch
+ fi
+
+ # Quiet down warnings the user do not need to see
+ sed -i \
+ -e 's:-Wpointer-arith::g' \
+ -e 's:-Wsign-compare::g' \
+ ${S}/Makefile.kbuild
+
+ # If you set this then it's your own fault when stuff breaks :)
+ [[ -n ${USE_CRAZY_OPTS} ]] && sed -i "s:-O:${CFLAGS}:" Makefile.*
+
+ # If greater than 2.6.5 use M= instead of SUBDIR=
+ cd ${S}; convert_to_m Makefile.kbuild
+}
+
+src_install() {
+ linux-mod_src_install
+
+ # Add the aliases
+ sed -e 's:\${PACKAGE}:'${PF}':g' ${FILESDIR}/nvidia > ${WORKDIR}/nvidia
+ insinto /etc/modules.d
+ newins ${WORKDIR}/nvidia nvidia
+
+ # Docs
+ # Bug #97768: Install README correctly and install Changelog.
+ newdoc ${S}/../../share/doc/README.txt README
+ dodoc ${S}/../../share/doc/NVIDIA_Changelog
+ dodoc ${S}/../../share/doc/Copyrights
+}
+
+pkg_postinst() {
+ linux-mod_pkg_postinst
+}