summaryrefslogtreecommitdiff
path: root/src/drivers/intel/gma/text_fb/gma.adb
blob: 6453571d8ceafc956234fdde9294410ee162b509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
with HW.GFX;
with HW.GFX.GMA;
with HW.GFX.GMA.Display_Probing;

use HW.GFX;
use HW.GFX.GMA;
use HW.GFX.GMA.Display_Probing;

with GMA.Mainboard;

package body GMA
is

   function fill_lb_framebuffer
     (framebuffer : in out lb_framebuffer)
      return Interfaces.C.int
   is
      use type Interfaces.C.int;
   begin
      return -1;
   end fill_lb_framebuffer;

   ----------------------------------------------------------------------------

   procedure gfxinit
     (mmio_base   : in     word64;
      linear_fb   : in     word64;
      phys_fb     : in     word32;
      lightup_ok  :    out Interfaces.C.int)
   is
      ports : Port_List;
      configs : Pipe_Configs;

      success : boolean;

      -- from pc80/vga driver
      procedure vga_io_init;
      pragma Import (C, vga_io_init, "vga_io_init");
      procedure vga_textmode_init;
      pragma Import (C, vga_textmode_init, "vga_textmode_init");
   begin
      lightup_ok := 0;

      HW.GFX.GMA.Initialize
        (MMIO_Base   => mmio_base,
         Success     => success);

      if success then
         ports := Mainboard.ports;
         HW.GFX.GMA.Display_Probing.Scan_Ports
           (Configs  => configs,
            Ports    => ports,
            Max_Pipe => Primary);

         if configs (Primary).Port /= Disabled then
            vga_io_init;
            vga_textmode_init;

            configs (Primary).Framebuffer :=
              (Width    => 640,
               Height   => 400,
               BPC      => Auto_BPC,   -- ignored for VGA plane
               Stride   => 320,        -- ignored
               Offset   => VGA_PLANE_FRAMEBUFFER_OFFSET);

            HW.GFX.GMA.Dump_Configs (configs);
            HW.GFX.GMA.Update_Outputs (configs);

            lightup_ok := 1;
         end if;
      end if;
   end gfxinit;

end GMA;