~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/x86/boot/video-mode.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/boot/video-mode.c (Version linux-6.12-rc7) and /arch/sparc/boot/video-mode.c (Version linux-5.6.19)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 
  2 /* -*- linux-c -*- ---------------------------    
  3  *                                                
  4  *   Copyright (C) 1991, 1992 Linus Torvalds      
  5  *   Copyright 2007-2008 rPath, Inc. - All Rig    
  6  *                                                
  7  * -------------------------------------------    
  8                                                   
  9 /*                                                
 10  * arch/i386/boot/video-mode.c                    
 11  *                                                
 12  * Set the video mode.  This is separated out     
 13  * file in order to be shared with the ACPI wa    
 14  */                                               
 15                                                   
 16 #include "boot.h"                                 
 17 #include "video.h"                                
 18 #include "vesa.h"                                 
 19                                                   
 20 #include <uapi/asm/boot.h>                        
 21                                                   
 22 /*                                                
 23  * Common variables                               
 24  */                                               
 25 int adapter;            /* 0=CGA/MDA/HGC, 1=EG    
 26 int force_x, force_y;   /* Don't query the BIO    
 27 int do_restore;         /* Screen contents cha    
 28 int graphic_mode;       /* Graphic mode with l    
 29                                                   
 30 /* Probe the video drivers and have them gener    
 31 void probe_cards(int unsafe)                      
 32 {                                                 
 33         struct card_info *card;                   
 34         static u8 probed[2];                      
 35                                                   
 36         if (probed[unsafe])                       
 37                 return;                           
 38                                                   
 39         probed[unsafe] = 1;                       
 40                                                   
 41         for (card = video_cards; card < video_    
 42                 if (card->unsafe == unsafe) {     
 43                         if (card->probe)          
 44                                 card->nmodes =    
 45                         else                      
 46                                 card->nmodes =    
 47                 }                                 
 48         }                                         
 49 }                                                 
 50                                                   
 51 /* Test if a mode is defined */                   
 52 int mode_defined(u16 mode)                        
 53 {                                                 
 54         struct card_info *card;                   
 55         struct mode_info *mi;                     
 56         int i;                                    
 57                                                   
 58         for (card = video_cards; card < video_    
 59                 mi = card->modes;                 
 60                 for (i = 0; i < card->nmodes;     
 61                         if (mi->mode == mode)     
 62                                 return 1;         
 63                 }                                 
 64         }                                         
 65                                                   
 66         return 0;                                 
 67 }                                                 
 68                                                   
 69 /* Set mode (without recalc) */                   
 70 static int raw_set_mode(u16 mode, u16 *real_mo    
 71 {                                                 
 72         int nmode, i;                             
 73         struct card_info *card;                   
 74         struct mode_info *mi;                     
 75                                                   
 76         /* Drop the recalc bit if set */          
 77         mode &= ~VIDEO_RECALC;                    
 78                                                   
 79         /* Scan for mode based on fixed ID, po    
 80         nmode = 0;                                
 81         for (card = video_cards; card < video_    
 82                 mi = card->modes;                 
 83                 for (i = 0; i < card->nmodes;     
 84                         int visible = mi->x ||    
 85                                                   
 86                         if ((mode == nmode &&     
 87                             mode == mi->mode |    
 88                             mode == (mi->y <<     
 89                                 *real_mode = m    
 90                                 return card->s    
 91                         }                         
 92                                                   
 93                         if (visible)              
 94                                 nmode++;          
 95                 }                                 
 96         }                                         
 97                                                   
 98         /* Nothing found?  Is it an "exception    
 99         for (card = video_cards; card < video_    
100                 if (mode >= card->xmode_first     
101                     mode < card->xmode_first+c    
102                         struct mode_info mix;     
103                         *real_mode = mix.mode     
104                         mix.x = mix.y = 0;        
105                         return card->set_mode(    
106                 }                                 
107         }                                         
108                                                   
109         /* Otherwise, failure... */               
110         return -1;                                
111 }                                                 
112                                                   
113 /*                                                
114  * Recalculate the vertical video cutoff (hack    
115  */                                               
116 static void vga_recalc_vertical(void)             
117 {                                                 
118         unsigned int font_size, rows;             
119         u16 crtc;                                 
120         u8 pt, ov;                                
121                                                   
122         set_fs(0);                                
123         font_size = rdfs8(0x485); /* BIOS: fon    
124         rows = force_y ? force_y : rdfs8(0x484    
125                                                   
126         rows *= font_size;      /* Visible sca    
127         rows--;                 /* ... minus o    
128                                                   
129         crtc = vga_crtc();                        
130                                                   
131         pt = in_idx(crtc, 0x11);                  
132         pt &= ~0x80;            /* Unlock CR0-    
133         out_idx(pt, crtc, 0x11);                  
134                                                   
135         out_idx((u8)rows, crtc, 0x12); /* Lowe    
136                                                   
137         ov = in_idx(crtc, 0x07); /* Overflow r    
138         ov &= 0xbd;                               
139         ov |= (rows >> (8-1)) & 0x02;             
140         ov |= (rows >> (9-6)) & 0x40;             
141         out_idx(ov, crtc, 0x07);                  
142 }                                                 
143                                                   
144 /* Set mode (with recalc if specified) */         
145 int set_mode(u16 mode)                            
146 {                                                 
147         int rv;                                   
148         u16 real_mode;                            
149                                                   
150         /* Very special mode numbers... */        
151         if (mode == VIDEO_CURRENT_MODE)           
152                 return 0;       /* Nothing to     
153         else if (mode == NORMAL_VGA)              
154                 mode = VIDEO_80x25;               
155         else if (mode == EXTENDED_VGA)            
156                 mode = VIDEO_8POINT;              
157                                                   
158         rv = raw_set_mode(mode, &real_mode);      
159         if (rv)                                   
160                 return rv;                        
161                                                   
162         if (mode & VIDEO_RECALC)                  
163                 vga_recalc_vertical();            
164                                                   
165         /* Save the canonical mode number for     
166            an alias, size specification or men    
167 #ifndef _WAKEUP                                   
168         boot_params.hdr.vid_mode = real_mode;     
169 #endif                                            
170         return 0;                                 
171 }                                                 
172                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php