summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-01-11 16:57:31 +0200
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-01-11 16:57:31 +0200
commitf5723a42a5c0c7bfda01497ce233362720ffa994 (patch)
tree29be8ffa9c90c97db45e8f2cc9efbb95779b5268
parent8e414e3adbdef9b98b6f56b853fe056aff373aa1 (diff)
lot of code clean up and tool behavior now changed, POSTing all secondary vgalrmi-for-children
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
-rw-r--r--posttool.c61
1 files changed, 13 insertions, 48 deletions
diff --git a/posttool.c b/posttool.c
index 15e92d5..5909690 100644
--- a/posttool.c
+++ b/posttool.c
@@ -1,4 +1,6 @@
/*
+Hacked on by Tiago Vignatti <tiago.vignatti@nokia.com>
+ported to new lrmi interface
Hacked on by Dave Airlie <airlied@redhat.com>
ported to libpciaccess, and vgaaccess
@@ -10,74 +12,34 @@ version 2
*/
#include <pciaccess.h>
-#include <assert.h>
#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/io.h>
#include <sys/kd.h>
#include <sys/stat.h>
-#include <sys/mman.h>
-#include <errno.h>
#include <libx86.h>
-#define access_ptr_register(reg_frame,reg) (reg_frame -> reg)
-#define access_seg_register(reg_frame,es) reg_frame.es
-#define real_mode_int(interrupt,reg_frame_ptr) !LRMI_int(interrupt,reg_frame_ptr)
-
-#define DPMS_STATE_ON 0x0000
-#define DPMS_STATE_STANDBY 0x0100
-#define DPMS_STATE_SUSPEND 0x0200
-#define DPMS_STATE_OFF 0x0400
-#define DPMS_STATE_LOW 0x0800
-
-/* 1 on first boot, 0 on suspend/resume */
-int boot_flag;
-
-int vbetool_init (void) {
- ioperm(0, 1024, 1);
- iopl(3);
-
- pci_system_init();
- pci_device_vgaarb_init();
-
- return 0;
-}
-
-#ifndef S2RAM
int main(int argc, char *argv[])
{
- if (argc < 2) {
- fprintf(stderr,"usage: posttool <bootflag>: bootflag = 0 for s/r, 1 for bootup\n");
- return 0;
- }
- boot_flag = atoi(argv[1]);
-
- vbetool_init();
- /* Again, we don't really want to do this while X is in
- control */
+ ioperm(0, 1024, 1);
+ iopl(3);
+
int err = check_console();
if (err) {
return err;
}
+ pci_system_init();
+ pci_device_vgaarb_init();
+
return do_post();
}
-#endif
int do_post(void)
{
- struct pci_dev *p;
- unsigned int c;
- int error;
struct pci_id_match dev_match = {
PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
(0x03 << 16), 0xff000, 0 };
- struct pci_device *dev, *first_dev = NULL;
+ struct pci_device *dev;
struct pci_device_iterator *iter;
xf86Int10InfoPtr pInt;
@@ -94,8 +56,11 @@ int do_post(void)
pInt->dev = dev;
LRMI_init(pInt);
- if (pci_device_is_boot_vga(pInt->dev))
+ if (pci_device_is_boot_vga(pInt->dev)) {
+ fprintf(stderr,"not posting first vga device: %d:%d:%d\n",
+ dev->bus, dev->dev, dev->func);
return pInt;
+ }
fprintf(stderr,"posting %d:%d:%d\n", dev->bus, dev->dev, dev->func);
pInt->num = 0xe6;