Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 456220
Collapse All | Expand All

(-)a/hw/xfree86/common/xf86.h (+1 lines)
Lines 55-60 Link Here
55
extern _X_EXPORT int xf86DoConfigure;
55
extern _X_EXPORT int xf86DoConfigure;
56
extern _X_EXPORT int xf86DoShowOptions;
56
extern _X_EXPORT int xf86DoShowOptions;
57
extern _X_EXPORT Bool xf86DoConfigurePass1;
57
extern _X_EXPORT Bool xf86DoConfigurePass1;
58
extern _X_EXPORT Bool xorgHWAccess;
58
59
59
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
60
extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
60
61
(-)a/hw/xfree86/common/xf86Bus.c (-11 lines)
Lines 127-143 Link Here
127
     * instance of the hardware found.
127
     * instance of the hardware found.
128
     */
128
     */
129
    for (i = 0; i < xf86NumDrivers; i++) {
129
    for (i = 0; i < xf86NumDrivers; i++) {
130
        xorgHWFlags flags;
131
132
        if (!xorgHWAccess) {
133
            if (!xf86DriverList[i]->driverFunc
134
                || !xf86DriverList[i]->driverFunc(NULL,
135
                                                  GET_REQUIRED_HW_INTERFACES,
136
                                                  &flags)
137
                || NEED_IO_ENABLED(flags))
138
                continue;
139
        }
140
141
        xf86CallDriverProbe(xf86DriverList[i], FALSE);
130
        xf86CallDriverProbe(xf86DriverList[i], FALSE);
142
    }
131
    }
143
132
(-)a/hw/xfree86/common/xf86Configure.c (-26 / +1 lines)
Lines 545-585 Link Here
545
545
546
    free(vlist);
546
    free(vlist);
547
547
548
    for (i = 0; i < xf86NumDrivers; i++) {
548
    xorgHWAccess = xf86EnableIO();
549
        xorgHWFlags flags;
550
551
        if (!xf86DriverList[i]->driverFunc
552
            || !xf86DriverList[i]->driverFunc(NULL,
553
                                              GET_REQUIRED_HW_INTERFACES,
554
                                              &flags)
555
            || NEED_IO_ENABLED(flags)) {
556
            xorgHWAccess = TRUE;
557
            break;
558
        }
559
    }
560
    /* Enable full I/O access */
561
    if (xorgHWAccess) {
562
        if (!xf86EnableIO())
563
            /* oops, we have failed */
564
            xorgHWAccess = FALSE;
565
    }
566
549
567
    /* Create XF86Config file structure */
550
    /* Create XF86Config file structure */
568
    xf86config = calloc(1, sizeof(XF86ConfigRec));
551
    xf86config = calloc(1, sizeof(XF86ConfigRec));
569
552
570
    /* Call all of the probe functions, reporting the results. */
553
    /* Call all of the probe functions, reporting the results. */
571
    for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
554
    for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
572
        xorgHWFlags flags;
573
        Bool found_screen;
555
        Bool found_screen;
574
        DriverRec *const drv = xf86DriverList[CurrentDriver];
556
        DriverRec *const drv = xf86DriverList[CurrentDriver];
575
557
576
        if (!xorgHWAccess) {
577
            if (!drv->driverFunc
578
                || !drv->driverFunc(NULL, GET_REQUIRED_HW_INTERFACES, &flags)
579
                || NEED_IO_ENABLED(flags))
580
                continue;
581
        }
582
583
        found_screen = xf86CallDriverProbe(drv, TRUE);
558
        found_screen = xf86CallDriverProbe(drv, TRUE);
584
        if (found_screen && drv->Identify) {
559
        if (found_screen && drv->Identify) {
585
            (*drv->Identify) (0);
560
            (*drv->Identify) (0);
(-)a/hw/xfree86/common/xf86Init.c (-13 / +12 lines)
Lines 530-552 Link Here
530
         */
530
         */
531
531
532
        for (i = 0; i < xf86NumDrivers; i++) {
532
        for (i = 0; i < xf86NumDrivers; i++) {
533
            xorgHWFlags flags = HW_IO;
534
533
            if (xf86DriverList[i]->Identify != NULL)
535
            if (xf86DriverList[i]->Identify != NULL)
534
                xf86DriverList[i]->Identify(0);
536
                xf86DriverList[i]->Identify(0);
535
537
536
            if (!xorgHWAccess || !xorgHWOpenConsole) {
538
            if (xf86DriverList[i]->driverFunc)
537
                xorgHWFlags flags;
539
                xf86DriverList[i]->driverFunc(NULL,
540
                                              GET_REQUIRED_HW_INTERFACES,
541
                                              &flags);
542
543
            /* this is "do we want it" at this point */
544
            if (NEED_IO_ENABLED(flags))
545
                xorgHWAccess = TRUE;
538
546
539
                if (!xf86DriverList[i]->driverFunc
547
            if (!(flags & HW_SKIP_CONSOLE))
540
                    || !xf86DriverList[i]->driverFunc(NULL,
548
                xorgHWOpenConsole = TRUE;
541
                                                      GET_REQUIRED_HW_INTERFACES,
542
                                                      &flags))
543
                    flags = HW_IO;
544
545
                if (NEED_IO_ENABLED(flags))
546
                    xorgHWAccess = TRUE;
547
                if (!(flags & HW_SKIP_CONSOLE))
548
                    xorgHWOpenConsole = TRUE;
549
            }
550
        }
549
        }
551
550
552
        if (xorgHWOpenConsole)
551
        if (xorgHWOpenConsole)
(-)a/hw/xfree86/common/xf86Priv.h (-1 lines)
Lines 91-97 Link Here
91
extern _X_EXPORT const char *xf86VisualNames[];
91
extern _X_EXPORT const char *xf86VisualNames[];
92
extern _X_EXPORT int xf86Verbose;       /* verbosity level */
92
extern _X_EXPORT int xf86Verbose;       /* verbosity level */
93
extern _X_EXPORT int xf86LogVerbose;    /* log file verbosity level */
93
extern _X_EXPORT int xf86LogVerbose;    /* log file verbosity level */
94
extern _X_EXPORT Bool xorgHWAccess;
95
94
96
extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
95
extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
97
96
(-)a/hw/xfree86/os-support/linux/lnx_video.c (-39 / +50 lines)
Lines 479-523 Link Here
479
#define __NR_pciconfig_iobase	200
479
#define __NR_pciconfig_iobase	200
480
#endif
480
#endif
481
481
482
#endif
482
static Bool
483
483
hwEnableIO(void)
484
Bool
485
xf86EnableIO(void)
486
{
484
{
487
#if defined(__powerpc__)
488
    int fd;
485
    int fd;
489
    unsigned int ioBase_phys;
486
    unsigned int ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
490
#endif
491
492
    if (ExtendedEnabled)
493
        return TRUE;
494
495
#if defined(__powerpc__)
496
    ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
497
487
498
    fd = open("/dev/mem", O_RDWR);
488
    fd = open("/dev/mem", O_RDWR);
499
    if (ioBase == NULL) {
489
    if (ioBase == NULL) {
500
        ioBase = (volatile unsigned char *) mmap(0, 0x20000,
490
        ioBase = (volatile unsigned char *) mmap(0, 0x20000,
501
                                                 PROT_READ | PROT_WRITE,
491
                                                 PROT_READ | PROT_WRITE,
502
                                                 MAP_SHARED, fd, ioBase_phys);
492
                                                 MAP_SHARED, fd, ioBase_phys);
503
/* Should this be fatal or just a warning? */
504
#if 0
505
        if (ioBase == MAP_FAILED) {
506
            xf86Msg(X_WARNING,
507
                    "xf86EnableIOPorts: Failed to map iobase (%s)\n",
508
                    strerror(errno));
509
            return FALSE;
510
        }
511
#endif
512
    }
493
    }
513
    close(fd);
494
    close(fd);
514
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__arm__) && !defined(__m32r__) && !defined(__nds32__)
495
496
    return ioBase != MAP_FAILED;
497
}
498
499
static void
500
hwDisableIO(void)
501
{
502
    munmap(ioBase, 0x20000);
503
    ioBase = NULL;
504
}
505
506
#elif defined(__i386__) || defined(__x86_64__) || defined(__ia64__) || \
507
      defined(__alpha__)
508
509
static Bool
510
hwEnableIO(void)
511
{
515
    if (ioperm(0, 1024, 1) || iopl(3)) {
512
    if (ioperm(0, 1024, 1) || iopl(3)) {
516
        if (errno == ENODEV)
513
        ErrorF("xf86EnableIOPorts: failed to set IOPL for I/O (%s)\n",
517
            ErrorF("xf86EnableIOPorts: no I/O ports found\n");
514
               strerror(errno));
518
        else
519
            FatalError("xf86EnableIOPorts: failed to set IOPL"
520
                       " for I/O (%s)\n", strerror(errno));
521
        return FALSE;
515
        return FALSE;
522
    }
516
    }
523
#if !defined(__alpha__)
517
#if !defined(__alpha__)
Lines 526-552 Link Here
526
    ioperm(0x40, 4, 0);         /* trap access to the timer chip */
520
    ioperm(0x40, 4, 0);         /* trap access to the timer chip */
527
    ioperm(0x60, 4, 0);         /* trap access to the keyboard controller */
521
    ioperm(0x60, 4, 0);         /* trap access to the keyboard controller */
528
#endif
522
#endif
529
#endif
530
    ExtendedEnabled = TRUE;
531
523
532
    return TRUE;
524
    return TRUE;
533
}
525
}
534
526
527
static void
528
hwDisableIO(void)
529
{
530
    iopl(0);
531
    ioperm(0, 1024, 0);
532
}
533
534
#else /* non-IO architectures */
535
536
#define hwEnableIO() TRUE
537
#define hwDisableIO() do {} while (0)
538
539
#endif
540
541
Bool
542
xf86EnableIO(void)
543
{
544
    if (ExtendedEnabled)
545
        return TRUE;
546
547
    ExtendedEnabled = hwEnableIO();
548
549
    return ExtendedEnabled;
550
}
551
535
void
552
void
536
xf86DisableIO(void)
553
xf86DisableIO(void)
537
{
554
{
538
    if (!ExtendedEnabled)
555
    if (!ExtendedEnabled)
539
        return;
556
        return;
540
#if defined(__powerpc__)
541
    munmap(ioBase, 0x20000);
542
    ioBase = NULL;
543
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__) && !defined(__arm__) && !defined(__s390__) && !defined(__m32r__) && !defined(__nds32__)
544
    iopl(0);
545
    ioperm(0, 1024, 0);
546
#endif
547
    ExtendedEnabled = FALSE;
548
557
549
    return;
558
    hwDisableIO();
559
560
    ExtendedEnabled = FALSE;
550
}
561
}
551
562
552
#if defined (__alpha__)
563
#if defined (__alpha__)

Return to bug 456220