summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-02-19 12:13:25 -0500
committerEric Anholt <eric@anholt.net>2010-02-20 12:55:13 -0500
commit761d386a940081688b9b599c7a5b0270abfc5138 (patch)
treead0a5ea4150d8ed61e2c196cad34b7586227ae2e
parent6199af00cb47df6347ecd72ff7f6c86a564cec57 (diff)
Remove intel_gtt and intel_lid now that they're in gpu_tools.
-rw-r--r--src/reg_dumper/Makefile.am16
-rw-r--r--src/reg_dumper/gtt.c117
-rw-r--r--src/reg_dumper/lid.c146
3 files changed, 1 insertions, 278 deletions
diff --git a/src/reg_dumper/Makefile.am b/src/reg_dumper/Makefile.am
index 6354334d..ed216c8d 100644
--- a/src/reg_dumper/Makefile.am
+++ b/src/reg_dumper/Makefile.am
@@ -1,25 +1,11 @@
noinst_PROGRAMS = \
- intel_gtt \
- intel_hotplug \
- intel_lid
-
-intel_gtt_SOURCES = \
- gtt.c \
- reg_dumper.h \
- util.c
+ intel_hotplug
intel_hotplug_SOURCES = \
hotplug.c \
reg_dumper.h
-intel_lid_SOURCES = \
- lid.c \
- reg_dumper.h \
- util.c
-
intel_hotplug_LDADD = $(PCIACCESS_LIBS)
-intel_gtt_LDADD = $(PCIACCESS_LIBS)
-intel_lid_LDADD = $(PCIACCESS_LIBS)
AM_CFLAGS = $(PCIACCESS_CFLAGS) $(CWARNFLAGS) \
-I$(srcdir)/.. -DREG_DUMPER
diff --git a/src/reg_dumper/gtt.c b/src/reg_dumper/gtt.c
deleted file mode 100644
index 241e5e4d..00000000
--- a/src/reg_dumper/gtt.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright © 2008 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Eric Anholt <eric@anholt.net>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <pciaccess.h>
-#include <err.h>
-#include <unistd.h>
-
-#include "reg_dumper.h"
-#include "../i810_reg.h"
-
-#define INGTT(offset) (*(volatile uint32_t *)(gtt + (offset) / (KB(4) / 4)))
-
-int main(int argc, char **argv)
-{
- I830Rec i830;
- I830Ptr pI830 = &i830;
- int start, aper_size;
- unsigned char *gtt;
-
- intel_i830rec_init(pI830);
-
- if (!IS_I9XX(pI830)) {
- printf("Unsupported chipset for gtt dumper\n");
- exit(1);
- }
-
- if (IS_G4X(pI830) || IS_IGDNG(pI830))
- gtt = (unsigned char *)(pI830->mmio + MB(2));
- else if (IS_I965G(pI830))
- gtt = (unsigned char *)(pI830->mmio + KB(512));
- else {
- /* 915/945 chips has GTT range in bar 3 */
- int err = 0;
- err = pci_device_map_range(pI830->PciInfo,
- pI830->PciInfo->regions[3].base_addr,
- pI830->PciInfo->regions[3].size,
- PCI_DEV_MAP_FLAG_WRITABLE,
- (void **)&gtt);
- if (err != 0) {
- fprintf(stderr, "mapping GTT bar failed\n");
- exit(1);
- }
- }
-
- aper_size = pI830->PciInfo->regions[2].size;
-
- for (start = 0; start < aper_size; start += KB(4)) {
- uint32_t start_pte = INGTT(start);
- uint32_t end;
- int constant_length = 0;
- int linear_length = 0;
-
- /* Check if it's a linear sequence */
- for (end = start + KB(4); end < aper_size; end += KB(4)) {
- uint32_t end_pte = INGTT(end);
- if (end_pte == start_pte + (end - start))
- linear_length++;
- else
- break;
- }
- if (linear_length > 0) {
- printf("0x%08x - 0x%08x: linear from "
- "0x%08x to 0x%08x\n",
- start, end - KB(4),
- start_pte, start_pte + (end - start) - KB(4));
- start = end - KB(4);
- continue;
- }
-
- /* Check if it's a constant sequence */
- for (end = start + KB(4); end < aper_size; end += KB(4)) {
- uint32_t end_pte = INGTT(end);
- if (end_pte == start_pte)
- constant_length++;
- else
- break;
- }
- if (constant_length > 0) {
- printf("0x%08x - 0x%08x: constant 0x%08x\n",
- start, end - KB(4), start_pte);
- start = end - KB(4);
- continue;
- }
-
- printf("0x%08x: 0x%08x\n", start, start_pte);
- }
-
- return 0;
-}
diff --git a/src/reg_dumper/lid.c b/src/reg_dumper/lid.c
deleted file mode 100644
index 29e6cd56..00000000
--- a/src/reg_dumper/lid.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright © 2009 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Authors:
- * Zhenyu Wang <zhenyu.z.wang@intel.com>
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdarg.h>
-#include <pciaccess.h>
-#include <err.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <dirent.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-
-#include "reg_dumper.h"
-#include "../i810_reg.h"
-#include "../i830_bios.h"
-
-enum lid_status {
- LID_UNKNOWN = -1,
- LID_OPEN,
- LID_CLOSE,
-};
-
-#define ACPI_BUTTON "/proc/acpi/button/"
-#define ACPI_LID "/proc/acpi/button/lid/"
-
-static int i830_lvds_acpi_lid_state(void)
-{
- int fd;
- DIR *button_dir;
- DIR *lid_dir;
- struct dirent *lid_dent;
- char *state_name;
- char state[64];
- enum lid_status ret = LID_UNKNOWN;
-
- button_dir = opendir(ACPI_BUTTON);
- /* If acpi button driver is not loaded, bypass ACPI check method */
- if (button_dir == NULL)
- goto out;
- closedir(button_dir);
-
- lid_dir = opendir(ACPI_LID);
-
- /* no acpi lid object found */
- if (lid_dir == NULL)
- goto out;
-
- while (1) {
- lid_dent = readdir(lid_dir);
- if (lid_dent == NULL) {
- /* no LID object */
- closedir(lid_dir);
- goto out;
- }
- if (strcmp(lid_dent->d_name, ".") &&
- strcmp(lid_dent->d_name, "..")) {
- break;
- }
- }
- state_name = malloc(strlen(ACPI_LID) + strlen(lid_dent->d_name) + 7);
- memset(state_name, 0, sizeof(state_name));
- strcat(state_name, ACPI_LID);
- strcat(state_name, lid_dent->d_name);
- strcat(state_name, "/state");
-
- closedir(lid_dir);
-
- if ((fd = open(state_name, O_RDONLY)) == -1) {
- free(state_name);
- goto out;
- }
- free(state_name);
- if (read(fd, state, 64) == -1) {
- close(fd);
- goto out;
- }
- close(fd);
- if (strstr(state, "open"))
- ret = LID_OPEN;
- else if (strstr(state, "closed"))
- ret = LID_CLOSE;
- else /* "unsupported" */
- ret = LID_UNKNOWN;
-
-out:
- return ret;
-}
-
-int main(int argc, char **argv)
-{
- I830Rec i830;
- I830Ptr pI830 = &i830;
- int swf14, acpi_lid;
-
- intel_i830rec_init(pI830);
-
- while (1) {
- swf14 = INREG(SWF14);
-
- printf("Intel LVDS Lid status:\n");
- printf("\tSWF14(0x%x) : %s\n", swf14,
- swf14 & SWF14_LID_SWITCH_EN ? "close" : "open");
-
- acpi_lid = i830_lvds_acpi_lid_state();
- switch (acpi_lid) {
- case LID_UNKNOWN:
- printf("\tACPI Lid state : unknown\n");
- break;
- case LID_OPEN:
- printf("\tACPI Lid state : open\n");
- break;
- case LID_CLOSE:
- printf("\tACPI Lid state : close\n");
- break;
- }
- sleep(2);
- }
- return 0;
-}