1 diff -ru usr/src/nv/Makefile.kbuild usr/src/nv.U012206/Makefile.kbuild
2 --- usr/src/nv/Makefile.kbuild 2005-12-15 01:57:35.000000000 +0100
3 +++ usr/src/nv.U012206/Makefile.kbuild 2006-01-22 15:32:35.775636750 +0100
5 ifeq ($(shell $(CONFTEST) sysctl_max_map_count), 1)
6 EXTRA_CFLAGS += -DNV_SYSCTL_MAX_MAP_COUNT_PRESENT
9 + ifeq ($(shell $(CONFTEST) pm_message_t), 1)
10 + EXTRA_CFLAGS += -DNV_PM_MESSAGE_T_PRESENT
13 + ifeq ($(shell $(CONFTEST) pci_choose_state), 1)
14 + EXTRA_CFLAGS += -DNV_PCI_CHOOSE_STATE_PRESENT
17 + ifeq ($(shell $(CONFTEST) vm_insert_page), 1)
18 + EXTRA_CFLAGS += -DNV_VM_INSERT_PAGE_PRESENT
22 ifeq ($(shell $(CONFTEST) remap_pfn_range), 1)
23 diff -ru usr/src/nv/conftest.sh usr/src/nv.U012206/conftest.sh
24 --- usr/src/nv/conftest.sh 2005-12-15 01:57:35.000000000 +0100
25 +++ usr/src/nv.U012206/conftest.sh 2006-01-22 15:32:06.353798000 +0100
29 CFLAGS="-D__KERNEL__ \
30 --nostdinc -isystem $ISYSTEM \
31 --Werror -Wimplicit-function-declaration"
32 +-DKBUILD_BASENAME=\"#conftest$$\" -DKBUILD_MODNAME=\"#conftest$$\" \
33 +-nostdinc -isystem $ISYSTEM"
35 if [ "$OUTPUT" != "$SOURCES" ]; then
36 ARCH=`uname -m | sed -e 's/i.86/i386/'`
40 echo "#include <linux/mm.h>
41 - int nv_remap_page_range(void) {
42 + void conftest_remap_page_range(void) {
46 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
49 + if [ -f conftest$$.o ]; then
54 + echo "#include <linux/mm.h>
55 + int conftest_remap_page_range(void) {
56 pgprot_t pgprot = __pgprot(0);
57 - remap_page_range(NULL, 0L, 0L, 0L, pgprot);
58 + return remap_page_range(NULL, 0L, 0L, 0L, pgprot);
61 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
65 echo "#include <linux/mm.h>
66 - int nv_remap_page_range(void) {
67 + int conftest_remap_page_range(void) {
68 pgprot_t pgprot = __pgprot(0);
69 - remap_page_range(0L, 0L, 0L, pgprot);
70 + return remap_page_range(0L, 0L, 0L, pgprot);
73 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
78 - $HOSTCC $CFLAGS -Wno-error -o conftest$$ conftest$$.c > /dev/null 2>&1
79 + $HOSTCC $CFLAGS -o conftest$$ conftest$$.c > /dev/null 2>&1
82 if [ -f conftest$$ ]; then
84 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
85 #include <asm/cacheflush.h>
87 - int nv_change_page_attr(struct page *pp, int i, pgprot_t prot) {
88 - return change_page_attr(pp, i, prot);
89 + void conftest_change_page_attr() {
93 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
96 if [ -f conftest$$.o ]; then
109 echo "#include <linux/pci.h>
111 - nv_pci_get_class(unsigned int class, struct pci_dev *from) {
112 - return pci_get_class(class, from);
113 + void conftest_pci_get_class(void) {
117 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
120 if [ -f conftest$$.o ]; then
133 echo "#include <linux/mm.h>
134 - int nv_remap_pfn_range(void) {
135 - pgprot_t pgprot = __pgprot(0);
136 - remap_pfn_range(NULL, 0L, 0L, 0L, pgprot);
137 + void conftest_remap_pfn_range(void) {
141 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
144 if [ -f conftest$$.o ]; then
154 @@ -548,11 +559,11 @@
157 echo "#include <linux/sched.h>
158 - struct rlimit *nv_signal_struct_rlim(void) {
159 + struct rlimit *conftest_signal_struct_rlim(void) {
160 return current->signal->rlim;
163 - $CC $CFLAGS -Wno-error -c conftest$$.c > /dev/null 2>&1
164 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
167 if [ -f conftest$$.o ]; then
169 echo "#include <linux/types.h>
170 #include <linux/agp_backend.h>
171 typedef struct agp_bridge_data agp_bridge_data;
172 - agp_bridge_data *nv_agp_backend_acquire(struct pci_dev *dev) {
173 + agp_bridge_data *conftest_agp_backend_acquire(struct pci_dev *dev) {
174 return agp_backend_acquire(dev);
180 echo "#include <linux/vmalloc.h>
181 - void *nv_vmap(struct page **pg, int cnt) {
182 + void conftest_vmap(void) {
186 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
189 + if [ -f conftest$$.o ]; then
194 + echo "#include <linux/vmalloc.h>
195 + void *conftest_vmap(struct page **pg, int cnt) {
196 return vmap(pg, cnt);
199 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
204 echo "#include <linux/vmalloc.h>
205 #include <linux/mm.h>
206 - void *nv_vmap(struct page **pg, int cnt) {
207 + void *conftest_vmap(struct page **pg, int cnt) {
208 return vmap(pg, cnt, 0, PAGE_KERNEL);
211 $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
218 - exit 1 # there ain't no vmap()
220 + # We couldn't determine the number of arguments expected by the
230 echo "#include <linux/sched.h>
231 - int nv_test_sysctl_max_map_count(void) {
232 + int conftest_sysctl_max_map_count(void) {
233 return sysctl_max_map_count;
242 + # Does linux/pm.h declare the pm_message_t type?
245 + echo "#include <linux/pm.h>
246 + void conftest_pm_message_t(pm_message_t state) {
247 + pm_message_t *p = &state;
250 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
253 + if [ -f conftest$$.o ]; then
263 + # Determine if pci_choose_state() is present.
266 + echo "#include <linux/pci.h>
267 + void conftest_pci_choose_state(void) {
268 + pci_choose_state();
271 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
274 + if [ -f conftest$$.o ]; then
284 + # Determine if vm_insert_page() is present.
287 + echo "#include <linux/mm.h>
288 + void conftest_vm_insert_page(void) {
292 + $CC $CFLAGS -c conftest$$.c > /dev/null 2>&1
295 + if [ -f conftest$$.o ]; then
304 diff -ru usr/src/nv/nv-linux.h usr/src/nv.U012206/nv-linux.h
305 --- usr/src/nv/nv-linux.h 2005-12-15 01:57:35.000000000 +0100
306 +++ usr/src/nv.U012206/nv-linux.h 2006-01-22 15:32:35.775636750 +0100
307 @@ -642,15 +642,49 @@
308 #define NV_PRINT_AT(at)
311 -// acpi support has been back-ported to the 2.4 kernel, but the 2.4 driver
312 -// model is not sufficient for full acpi support. it may work in some cases,
313 -// but not enough for us to officially support this configuration.
314 -#if defined(CONFIG_ACPI) && defined(KERNEL_2_6)
315 -#define NV_PM_SUPPORT_ACPI
317 + * On Linux 2.6, we support both APM and ACPI power management. On Linux
318 + * 2.4, we support APM, only. ACPI support has been back-ported to the
319 + * Linux 2.4 kernel, but the Linux 2.4 driver model is not sufficient for
320 + * full ACPI support: it may work with some systems, but not reliably
321 + * enough for us to officially support this configuration.
323 + * We support two Linux kernel power managment interfaces: the original
324 + * pm_register()/pm_unregister() on Linux 2.4 and the device driver model
325 + * backed PCI driver power management callbacks introduced with Linux
328 + * The code below determines which interface to support on this kernel
329 + * version, if any; if built for Linux 2.6, it will also determine if the
330 + * kernel comes with ACPI or APM power management support.
332 +#if defined(KERNEL_2_6) && (defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) || defined(CONFIG_ACPI))
333 +#define NV_PM_SUPPORT_DEVICE_DRIVER_MODEL
334 +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
335 +#define NV_PM_SUPPORT_NEW_STYLE_APM
339 -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
340 -#define NV_PM_SUPPORT_APM
342 + * On Linux 2.6 kernels >= 2.6.11, the PCI subsystem provides a new
343 + * interface that allows PCI drivers to determine the correct power state
344 + * for a given system power state; our suspend/resume callbacks now use
345 + * this interface and operate on PCI power state defines.
347 + * Define these new PCI power state #define's here for compatibility with
348 + * older Linux 2.6 kernels.
350 +#if defined(KERNEL_2_6) && !defined(PCI_D0)
351 +#define PCI_D0 PM_SUSPEND_ON
352 +#define PCI_D3hot PM_SUSPEND_MEM
355 +#if defined(KERNEL_2_6) && !defined(NV_PM_MESSAGE_T_PRESENT)
356 +typedef u32 pm_message_t;
359 +#if defined(KERNEL_2_4) && (defined(CONFIG_APM) || defined(CONFIG_APM_MODULE))
360 +#define NV_PM_SUPPORT_OLD_STYLE_APM
365 #define PCI_CAP_ID_EXP 0x10
368 +#if defined(NV_VM_INSERT_PAGE_PRESENT)
369 +#define NV_VM_INSERT_PAGE(vma, addr, page) \
370 + vm_insert_page(vma, addr, page)
372 #if defined(NV_REMAP_PFN_RANGE_PRESENT)
373 #define NV_REMAP_PAGE_RANGE(from, offset, x...) \
374 - remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
375 + remap_pfn_range(vma, from, ((offset) >> PAGE_SHIFT), x)
376 #elif defined(NV_REMAP_PAGE_RANGE_5_PRESENT)
377 #define NV_REMAP_PAGE_RANGE(x...) remap_page_range(vma, x)
378 #elif defined(NV_REMAP_PAGE_RANGE_4_PRESENT)
383 -#if !defined(page_to_pfn)
384 -#define page_to_pfn(page) ((page) - mem_map)
387 -#if !defined(pfn_to_page)
388 +#if defined(KERNEL_2_4) && defined(NVCPU_X86) && !defined(pfn_to_page)
389 #define pfn_to_page(pfn) (mem_map + (pfn))
392 diff -ru usr/src/nv/nv-vm.c usr/src/nv.U012206/nv-vm.c
393 --- usr/src/nv/nv-vm.c 2005-12-15 01:57:35.000000000 +0100
394 +++ usr/src/nv.U012206/nv-vm.c 2006-01-22 15:32:35.775636750 +0100
399 +static inline BOOL nv_page_locked(nv_pte_t *page_ptr)
401 + BOOL locked = FALSE;
402 +#if defined(PageReserved)
403 + locked = PageReserved(NV_GET_PAGE_STRUCT(page_ptr->phys_addr));
408 #if defined(NV_SG_MAP_BUFFERS)
410 /* track how much memory has been remapped through the iommu/swiotlb */
412 if (!NV_ALLOC_MAPPING_CONTIG(at->flags))
413 nv_sg_unmap_buffer(dev, &page_ptr->sg_list, page_ptr);
415 - if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags))
416 + if (!NV_ALLOC_MAPPING_CONTIG(at->flags) && !NV_ALLOC_MAPPING_VMALLOC(at->flags) && !nv_page_locked(page_ptr))
417 NV_FREE_PAGES(page_ptr->virt_addr, 0);
420 diff -ru usr/src/nv/nv.c usr/src/nv.U012206/nv.c
421 --- usr/src/nv/nv.c 2005-12-15 01:57:35.000000000 +0100
422 +++ usr/src/nv.U012206/nv.c 2006-01-22 15:32:35.775636750 +0100
425 static nv_linux_state_t nv_linux_devices[NV_MAX_DEVICES];
427 -#if defined(NV_PM_SUPPORT_APM)
428 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
429 static struct pm_dev *apm_nv_dev[NV_MAX_DEVICES] = { 0 };
433 void nv_kern_isr_bh(unsigned long);
434 irqreturn_t nv_kern_isr(int, void *, struct pt_regs *);
435 void nv_kern_rc_timer(unsigned long);
436 -#if defined(NV_PM_SUPPORT_APM)
437 -int nv_kern_apm_event(struct pm_dev *dev, pm_request_t rqst, void *data);
438 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
439 +static int nv_kern_apm_event(struct pm_dev *, pm_request_t, void *);
442 static int nv_kern_read_cardinfo(char *, char **, off_t off, int, int *, void *);
444 unsigned int nv_kern_ctl_poll(struct file *, poll_table *);
446 int nv_kern_probe(struct pci_dev *, const struct pci_device_id *);
447 -#if defined(NV_PM_SUPPORT_ACPI)
448 -int nv_kern_acpi_standby(struct pci_dev *, u32);
449 -int nv_kern_acpi_resume(struct pci_dev *);
451 +#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
452 +static int nv_kern_suspend(struct pci_dev *, pm_message_t);
453 +static int nv_kern_resume(struct pci_dev *);
459 .id_table = nv_pci_table,
460 .probe = nv_kern_probe,
461 -#if defined(NV_PM_SUPPORT_ACPI)
462 - .suspend = nv_kern_acpi_standby,
463 - .resume = nv_kern_acpi_resume,
464 +#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
465 + .suspend = nv_kern_suspend,
466 + .resume = nv_kern_resume,
472 if (!test_bit(X86_FEATURE_PAT, (volatile unsigned long *)&boot_cpu_data.x86_capability))
474 - nv_printf(NV_DBG_ERRORS, "NVRM: cpu does not support PAT, aborting..\n");
475 + nv_printf(NV_DBG_ERRORS,
476 + "NVRM: CPU does not support the PAT, falling back to MTRRs.\n");
480 @@ -1084,9 +1086,12 @@
482 // broken kernels may get confused after splitting the page and
483 // restore the page before returning to us. detect that case.
484 - if ( (pte_val(*kpte) == kpte_val) &&
485 - (pte_val(*kpte) & _PAGE_PSE))
486 + if (((pte_val(*kpte) & ~_PAGE_NX) == kpte_val) &&
487 + (pte_val(*kpte) & _PAGE_PSE))
489 + if ((pte_val(*kpte) & _PAGE_NX) &&
490 + (__nv_supported_pte_mask & _PAGE_NX) == 0)
491 + clear_bit(_PAGE_BIT_NX, kpte);
492 spin_unlock(&init_mm.page_table_lock);
493 // don't change the page back, as it's already been reverted
495 @@ -1299,7 +1304,7 @@
496 nv_lock_init_locks(nv_ctl);
499 -#if defined(NV_PM_SUPPORT_APM)
500 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
501 for (i = 0; i < num_nv_devices; i++)
503 apm_nv_dev[i] = pm_register(PM_PCI_DEV, PM_SYS_VGA, nv_kern_apm_event);
504 @@ -1407,8 +1412,11 @@
506 #if defined(NV_BUILD_NV_PAT_SUPPORT)
509 __nv_enable_pat_support();
512 + nv_printf(NV_DBG_ERRORS,
513 + "NVRM: builtin PAT support disabled, falling back to MTRRs.\n");
517 @@ -1418,7 +1426,7 @@
518 if (nv_pte_t_cache != NULL)
519 NV_KMEM_CACHE_DESTROY(nv_pte_t_cache);
521 -#if defined(NV_PM_SUPPORT_APM)
522 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
523 for (i = 0; i < num_nv_devices; i++)
524 if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]);
526 @@ -1473,10 +1481,10 @@
527 inter_module_unregister("nv_linux_devices");
530 -#if defined(NV_PM_SUPPORT_APM)
531 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
532 for (i = 0; i < num_nv_devices; i++)
534 - pm_unregister(apm_nv_dev[i]);
535 + if (apm_nv_dev[i] != NULL) pm_unregister(apm_nv_dev[i]);
539 @@ -1889,9 +1897,6 @@
540 // allow setting or refusal of specific caching types
543 - case NV_MEMORY_CACHED:
544 - //case NV_MEMORY_WRITEBACK:
546 case NV_MEMORY_UNCACHED_WEAK:
547 *prot = pgprot_noncached_weak(*prot);
549 @@ -1899,19 +1904,53 @@
550 *prot = pgprot_noncached(*prot);
552 case NV_MEMORY_WRITECOMBINED:
553 - if (nv_pat_enabled)
554 + if (nv_pat_enabled &&
555 + (memory_type != NV_MEMORY_TYPE_REGISTERS))
557 *prot = pgprot_writecombined(*prot);
560 - /* agp allocations should be covered by an mtrr if pat isn't enabled */
562 + * If PAT support is unavailable and the memory space isn't
563 + * NV_MEMORY_TYPE_AGP, we need to return an error code to
564 + * the caller, but do not print a warning message.
566 + * In the case of AGP memory, we will have attempted to add
567 + * a WC MTRR for the AGP aperture and aborted the AGP
568 + * initialization if this failed, so we can safely return
571 + * For frame buffer memory, callers are expected to use the
572 + * UC- memory type if we report WC as unsupported, which
573 + * translates to the effective memory type WC if a WC MTRR
574 + * exists or else UC.
576 if (memory_type == NV_MEMORY_TYPE_AGP)
579 + case NV_MEMORY_CACHED:
580 + //case NV_MEMORY_WRITEBACK:
582 + * RAM is cached on Linux by default, we can assume there's
583 + * nothing to be done here. This is not the case for the
584 + * other memory spaces: as commented on above, we will have
585 + * added a WC MTRR for the AGP aperture (or else aborted
586 + * AGP initialization), and we will have made an attempt to
587 + * add a WC MTRR for the frame buffer.
589 + * If a WC MTRR is present, we can't satisfy the WB mapping
590 + * attempt here, since the achievable effective memory
591 + * types in that case are WC and UC, if not it's typically
592 + * UC (MTRRdefType is UC); we could only satisfy WB mapping
593 + * requests with a WB MTRR.
595 + if (memory_type == NV_MEMORY_TYPE_SYSTEM)
597 //case NV_MEMORY_WRITETHRU:
598 //case NV_MEMORY_WRITEPROTECT:
600 nv_printf(NV_DBG_ERRORS,
601 - "NVRM: memory caching type 0x%x not supported for memory space %d!\n",
602 + "NVRM: VM: memory type %d not supported for memory space %d!\n",
603 cache_type, memory_type);
606 @@ -2118,8 +2157,13 @@
607 for (j = i; j < (i + pages); j++)
609 nv_verify_page_mappings(at->page_table[j], NV_ALLOC_MAPPING(at->flags));
610 +#if defined(NV_VM_INSERT_PAGE_PRESENT)
611 + if (NV_VM_INSERT_PAGE(vma, start,
612 + NV_GET_PAGE_STRUCT(at->page_table[j]->phys_addr)))
614 if (NV_REMAP_PAGE_RANGE(start, at->page_table[j]->phys_addr,
615 PAGE_SIZE, vma->vm_page_prot))
618 NV_ATOMIC_DEC(at->usage_count);
620 @@ -2429,9 +2473,9 @@
621 mod_timer(&nvl->rc_timer, jiffies + HZ); /* set another timeout in 1 second */
624 -#if defined(NV_PM_SUPPORT_APM)
625 +#if defined(NV_PM_SUPPORT_OLD_STYLE_APM)
626 /* kernel calls us with a power management event */
632 @@ -2466,7 +2510,6 @@
636 -#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE)
638 nv_printf(NV_DBG_INFO, "NVRM: APM: received resume event\n");
639 status = rm_power_management(nv, 0, NV_PM_APM_RESUME);
640 @@ -2476,15 +2519,12 @@
641 nv_printf(NV_DBG_INFO, "NVRM: APM: received suspend event\n");
642 status = rm_power_management(nv, 0, NV_PM_APM_SUSPEND);
646 -#if defined(KERNEL_2_4)
647 // 2.4 kernels sent a PM_SAVE_STATE request when powering down via
648 // ACPI. just ignore it and return success so the power down works
655 nv_printf(NV_DBG_WARNINGS, "NVRM: APM: unsupported event: %d\n", rqst);
656 @@ -2496,7 +2536,7 @@
661 +#endif /* defined(NV_PM_SUPPORT_OLD_STYLE_APM) */
665 @@ -3739,6 +3779,7 @@
666 nvl = &nv_linux_devices[num_nv_devices];
667 nv = NV_STATE_PTR(nvl);
669 + pci_set_drvdata(dev, (void *)nvl);
671 nv->vendor_id = dev->vendor;
672 nv->device_id = dev->device;
673 @@ -3816,11 +3857,10 @@
677 -#if defined(NV_PM_SUPPORT_ACPI)
678 +#if defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL)
684 +nv_power_management(
688 @@ -3828,70 +3868,77 @@
690 nv_linux_state_t *lnv = NULL;
694 - nv_printf(NV_DBG_INFO, "NVRM: nv_acpi_event: %d\n", state);
696 - for (i = 0; i < num_nv_devices; i++)
698 - if (nv_linux_devices[i].dev == dev)
700 - lnv = &nv_linux_devices[i];
704 + nv_printf(NV_DBG_INFO, "NVRM: nv_power_management: %d\n", state);
705 + lnv = pci_get_drvdata(dev);
707 if ((!lnv) || (lnv->dev != dev))
709 - nv_printf(NV_DBG_WARNINGS, "NVRM: ACPI: invalid device!\n");
710 + nv_printf(NV_DBG_WARNINGS, "NVRM: PM: invalid device!\n");
714 nv = NV_STATE_PTR(lnv);
715 + nv_verify_pci_config(NV_STATE_PTR(lnv), TRUE);
719 - case PM_SUSPEND_MEM:
720 +#if defined(NV_PM_SUPPORT_NEW_STYLE_APM)
722 + nv_printf(NV_DBG_INFO, "NVRM: APM: received suspend event\n");
723 + status = rm_power_management(nv, 0, NV_PM_APM_SUSPEND);
727 + nv_printf(NV_DBG_INFO, "NVRM: APM: received resume event\n");
728 + status = rm_power_management(nv, 0, NV_PM_APM_RESUME);
732 nv_printf(NV_DBG_INFO, "NVRM: ACPI: received suspend event\n");
733 status = rm_power_management(nv, 0, NV_PM_ACPI_STANDBY);
736 - case PM_SUSPEND_ON:
738 nv_printf(NV_DBG_INFO, "NVRM: ACPI: received resume event\n");
739 status = rm_power_management(nv, 0, NV_PM_ACPI_RESUME);
744 - nv_printf(NV_DBG_WARNINGS, "NVRM: ACPI: unsupported event: %d\n", state);
745 + nv_printf(NV_DBG_WARNINGS, "NVRM: PM: unsupported event: %d\n", state);
750 - nv_printf(NV_DBG_ERRORS, "NVRM: ACPI: failed event: %d\n", state);
751 + nv_printf(NV_DBG_ERRORS, "NVRM: PM: failed event: %d\n", state);
757 -nv_kern_acpi_standby
759 - struct pci_dev *dev,
761 +static int nv_kern_suspend(
762 + struct pci_dev *dev,
766 - return nv_acpi_event(dev, state);
767 + int power_state = -1;
769 +#if !defined(NV_PM_MESSAGE_T_PRESENT)
770 + power_state = state;
771 +#elif defined(NV_PCI_CHOOSE_STATE_PRESENT)
772 + power_state = pci_choose_state(dev, state);
775 + return nv_power_management(dev, power_state);
781 +static int nv_kern_resume(
785 - return nv_acpi_event(dev, PM_SUSPEND_ON);
786 + return nv_power_management(dev, PCI_D0);
790 +#endif /* defined(NV_PM_SUPPORT_DEVICE_DRIVER_MODEL) */
792 void* NV_API_CALL nv_get_adapter_state(