Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- src/nvidia_subr.c.orig 2013-03-02 17:43:26.000000000 +0400
- +++ src/nvidia_subr.c 2013-03-02 17:44:28.000000000 +0400
- @@ -12,6 +12,10 @@
- #include "os-interface.h"
- #include "nv.h"
- #include "nv-freebsd.h"
- +#include <contrib/dev/acpica/include/acpi.h>
- +#include <contrib/dev/acpica/include/accommon.h>
- +#include <dev/acpica/acpivar.h>
- +
- #if defined(NVCPU_X86) && defined(NV_USE_OS_VM86_INT10CALL)
- #include <machine/vm86.h>
- @@ -1491,7 +1495,45 @@
- NvU32 *pOutData
- )
- {
- - return RM_ERR_NOT_SUPPORTED;
- + device_t dev = nv->handle, bus;
- + ACPI_STATUS status;
- + union acpi_object *rom;
- + union acpi_object rom_arg[2];
- + struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL };
- + struct acpi_object_list input = { 2, rom_arg };
- + bus = dev;
- + do {
- + bus = device_get_parent(bus);
- + } while (bus != NULL && strcmp(device_get_name(bus), "acpi"));
- + if (!bus) {
- + printf("couldn't find acpi bus\n");
- + return RM_ERROR;
- + }
- + if (!strncmp(device_get_name(device_get_parent(dev)), "vgapci", 6)) {
- + dev = device_get_parent(dev);
- + } else printf("name is %s\n", device_get_name(device_get_parent(dev)));
- + rom_arg[0].Type = ACPI_TYPE_INTEGER;
- + rom_arg[0].Integer.Value = pInData[0];
- + rom_arg[1].Type = ACPI_TYPE_INTEGER;
- + rom_arg[1].Integer.Value = pInData[1];
- + status = ACPI_EVALUATE_OBJECT(bus, dev, "_ROM", &input, &output);
- + if (ACPI_FAILURE(status)) {
- + printf("Failed to do the rom truc %x\n", status);
- + return RM_ERROR;
- + } else {
- + rom = output.Pointer;
- + if (rom && (rom->Type == ACPI_TYPE_BUFFER) && (rom->Buffer.Length == pInData[1])) {
- + memcpy(pOutData, rom->Buffer.Pointer, rom->Buffer.Length);
- + } else {
- + printf("Invalid rom data\n");
- + free(output.Pointer, M_TEMP);
- + return RM_ERROR;
- + }
- + free(output.Pointer, M_TEMP);
- + return (RM_OK);
- + }
- +
- + return (RM_ERROR);
- }
- void* NV_API_CALL nv_get_smu_state(void)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement