/ src / drivers / intel / gma / text_fb / gma-gfx_init.adb
gma-gfx_init.adb
 1  -- SPDX-License-Identifier: GPL-2.0-only
 2  
 3  with HW.GFX;
 4  with HW.GFX.GMA;
 5  with HW.GFX.GMA.Display_Probing;
 6  
 7  use HW.GFX;
 8  use HW.GFX.GMA;
 9  use HW.GFX.GMA.Display_Probing;
10  
11  with GMA.Mainboard;
12  
13  package body GMA.GFX_Init
14  is
15     configs : Pipe_Configs;
16  
17     procedure gfxinit (lightup_ok : out Interfaces.C.int)
18     is
19        ports : Port_List;
20  
21        success : boolean;
22  
23        -- from pc80/vga driver
24        procedure vga_io_init;
25        pragma Import (C, vga_io_init, "vga_io_init");
26        procedure vga_textmode_init;
27        pragma Import (C, vga_textmode_init, "vga_textmode_init");
28     begin
29        lightup_ok := 0;
30  
31        HW.GFX.GMA.Initialize (Success => success);
32  
33        if success then
34           ports := Mainboard.ports;
35           HW.GFX.GMA.Display_Probing.Scan_Ports
36             (Configs  => configs,
37              Ports    => ports,
38              Max_Pipe => Primary);
39  
40           if configs (Primary).Port /= Disabled then
41              HW.GFX.GMA.Power_Up_VGA;
42              vga_io_init;
43              vga_textmode_init;
44  
45              -- override probed framebuffer config
46              configs (Primary).Framebuffer.Width    := 640;
47              configs (Primary).Framebuffer.Height   := 400;
48              configs (Primary).Framebuffer.Offset   :=
49                 VGA_PLANE_FRAMEBUFFER_OFFSET;
50  
51              pragma Debug (HW.GFX.GMA.Dump_Configs (configs));
52              HW.GFX.GMA.Update_Outputs (configs);
53  
54              lightup_ok := 1;
55           end if;
56        end if;
57     end gfxinit;
58  
59     procedure gfxstop
60     is
61     begin
62        if configs (Primary).Port /= Disabled then
63           for i in Pipe_Index loop
64              configs (i).Port := Disabled;
65           end loop;
66           HW.GFX.GMA.Update_Outputs (configs);
67        end if;
68     end gfxstop;
69  
70  end GMA.GFX_Init;