1-- SPDX-License-Identifier: GPL-2.0-only 2 3with HW.GFX; 4with HW.GFX.GMA; 5with HW.GFX.GMA.Display_Probing; 6 7use HW.GFX; 8use HW.GFX.GMA; 9use HW.GFX.GMA.Display_Probing; 10 11with GMA.Mainboard; 12 13package body GMA.GFX_Init 14is 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 70end GMA.GFX_Init; 71