Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2013
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.08 KB | None | 0 0
  1. --- src/nvidia_subr.c.orig  2013-03-02 17:43:26.000000000 +0400
  2. +++ src/nvidia_subr.c   2013-03-02 17:44:28.000000000 +0400
  3. @@ -12,6 +12,10 @@
  4.  #include "os-interface.h"
  5.  #include "nv.h"
  6.  #include "nv-freebsd.h"
  7. +#include <contrib/dev/acpica/include/acpi.h>
  8. +#include <contrib/dev/acpica/include/accommon.h>
  9. +#include <dev/acpica/acpivar.h>
  10. +
  11.  
  12.  #if defined(NVCPU_X86) && defined(NV_USE_OS_VM86_INT10CALL)
  13.  #include <machine/vm86.h>
  14. @@ -1491,7 +1495,45 @@
  15.      NvU32 *pOutData
  16.  )
  17.  {
  18. -    return RM_ERR_NOT_SUPPORTED;
  19. +    device_t dev = nv->handle, bus;
  20. +    ACPI_STATUS status;
  21. +    union acpi_object *rom;
  22. +    union acpi_object rom_arg[2];
  23. +    struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL };
  24. +    struct acpi_object_list input = { 2, rom_arg };
  25. +    bus = dev;
  26. +    do {
  27. +       bus = device_get_parent(bus);
  28. +    } while (bus != NULL && strcmp(device_get_name(bus), "acpi"));
  29. +    if (!bus) {
  30. +        printf("couldn't find acpi bus\n");
  31. +        return RM_ERROR;
  32. +    }
  33. +    if (!strncmp(device_get_name(device_get_parent(dev)), "vgapci", 6)) {
  34. +                dev = device_get_parent(dev);
  35. +    } else printf("name is %s\n", device_get_name(device_get_parent(dev)));
  36. +    rom_arg[0].Type = ACPI_TYPE_INTEGER;
  37. +    rom_arg[0].Integer.Value = pInData[0];
  38. +    rom_arg[1].Type = ACPI_TYPE_INTEGER;
  39. +    rom_arg[1].Integer.Value = pInData[1];
  40. +    status = ACPI_EVALUATE_OBJECT(bus, dev, "_ROM", &input, &output);
  41. +    if (ACPI_FAILURE(status)) {
  42. +       printf("Failed to do the rom truc %x\n", status);
  43. +       return RM_ERROR;
  44. +    } else {
  45. +        rom = output.Pointer;
  46. +        if (rom && (rom->Type == ACPI_TYPE_BUFFER) && (rom->Buffer.Length == pInData[1])) {
  47. +                memcpy(pOutData, rom->Buffer.Pointer, rom->Buffer.Length);
  48. +        } else {
  49. +               printf("Invalid rom data\n");
  50. +                free(output.Pointer, M_TEMP);
  51. +                return RM_ERROR;
  52. +        }
  53. +               free(output.Pointer, M_TEMP);
  54. +               return (RM_OK);
  55. +        }
  56. +
  57. +   return (RM_ERROR);
  58.  }
  59.  
  60.  void* NV_API_CALL nv_get_smu_state(void)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement