[Pm-utils] [PATCH] parse video quirks in uswsusp sleep module

Victor Lowther victor.lowther at gmail.com
Sun Mar 16 18:15:09 PDT 2008


On Mon, 2008-03-17 at 01:55 +0100, Michael Biebl wrote:
> 2008/3/17, Victor Lowther <victor.lowther at gmail.com>:
> > Not really. :)  The behaviour that 99video uses is to set the acpi_sleep
> >  flag based on quirks no matter the state of QUIRK_NONE.  This patch
> >  brings the uswsusp code in line with that logic.
> 
> acpi flags are quirks just like vbe post. QUIRK_NONE should skip all quirks.
> 
> >  Whether this is correct behaviour is another question, but the logic
> >  99video uses has been that way for a long time and I don't want to mess
> >  with it without good cause.
> 
> Not really that long.
> The last officially release version (0.99.4) didn't have support for
> QUIRK_NONE yet.
> You added support for QUIRK_NONE on 28.02.
> Your initial version skipped 99video completely.
> On 01.03 (two weeks ago), you restructured 99video and since then acpi
> flags were not skipped any more (the commit log doesn't tell why)

I stand corrected. I did not get the quirk_none logic from preexisting
pm-utils code. I apoligise for the confusion.

> There is imho no good reason, why we should treat acpi flags special.
> Imho we should fix 99video.

After a bit more thinking, I remember where I got that logic -- from
s2ram-x86.c in the uswsusp source code.  Specifically, this bit:
/* line 249 */
int s2ram_hacks(void)
{
        int ret = 0;

        ret = set_acpi_video_mode(flags & (S3_BIOS | S3_MODE));

        if (ret)
                return ret;

        if (flags & VBE_SAVE) {
                int size;
                vbetool_init();
                printf("Calling save_state\n");
                vbe_buffer = __save_state(&size);
        }
        if (flags & VBE_MODE) {
                vbetool_init();
                printf("Calling get_mode\n");
                vbe_mode = __get_mode();
        }
        if (flags & RADEON_OFF) {
                map_radeon_cntl_mem();
                printf("Calling radeon_cmd_light(0)\n");
                radeon_cmd_light(0);
        }
        if (flags & PCI_SAVE) {
                pacc = pci_alloc();     /* Get the pci_access structure
*/
                pci_init(pacc);         /* Initialize the PCI library */

                if (find_vga()) {
                        printf("saving PCI config of device %02x:%02x.%d
\n",
                                vga_dev.bus, vga_dev.dev, vga_dev.func);
                        save_vga_pci();
                } else
                        /* pci_save requested, no VGA device found =>
abort */
                        return 1;
        }
        if (fb_nosuspend)
                printf("ATTENTION: --nofbsuspend is a debugging tool
only.\n"
                        "\tIf your machine needs this to work, please
report "
                        "this as a bug.\n");
        else
                suspend_fbcon();

        return 0;
}
/* end of s2ram code */

The only hacks that are not guarded by if (flags & FLAG_VALUE) are the
set_acpi_video_mode() hack and the suspend_fbcon() hack.

In s2ram_main.c, s2ram_hacks() is called unconditionally at line 92 or
thereabouts. 

There is where that logic came from.  I should have documented that in
the commit message.  

> Michael
-- 
Victor Lowther
Ubuntu Certified Professional



More information about the Pm-utils mailing list