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

TOMOYO Linux Cross Reference
Linux/arch/x86/realmode/rm/wakemain.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/x86/realmode/rm/wakemain.c (Architecture mips) and /arch/i386/realmode/rm/wakemain.c (Architecture i386)


  1 // SPDX-License-Identifier: GPL-2.0                 1 
  2 #include "wakeup.h"                               
  3 #include "boot.h"                                 
  4                                                   
  5 static void udelay(int loops)                     
  6 {                                                 
  7         while (loops--)                           
  8                 io_delay();     /* Approximate    
  9 }                                                 
 10                                                   
 11 static void beep(unsigned int hz)                 
 12 {                                                 
 13         u8 enable;                                
 14                                                   
 15         if (!hz) {                                
 16                 enable = 0x00;          /* Tur    
 17         } else {                                  
 18                 u16 div = 1193181/hz;             
 19                                                   
 20                 outb(0xb6, 0x43);       /* Ctr    
 21                 io_delay();                       
 22                 outb(div, 0x42);        /* LSB    
 23                 io_delay();                       
 24                 outb(div >> 8, 0x42);   /* MSB    
 25                 io_delay();                       
 26                                                   
 27                 enable = 0x03;          /* Tur    
 28         }                                         
 29         inb(0x61);              /* Dummy read     
 30         io_delay();                               
 31         outb(enable, 0x61);     /* Enable time    
 32         io_delay();                               
 33 }                                                 
 34                                                   
 35 #define DOT_HZ          880                       
 36 #define DASH_HZ         587                       
 37 #define US_PER_DOT      125000                    
 38                                                   
 39 /* Okay, this is totally silly, but it's kind     
 40 static void send_morse(const char *pattern)       
 41 {                                                 
 42         char s;                                   
 43                                                   
 44         while ((s = *pattern++)) {                
 45                 switch (s) {                      
 46                 case '.':                         
 47                         beep(DOT_HZ);             
 48                         udelay(US_PER_DOT);       
 49                         beep(0);                  
 50                         udelay(US_PER_DOT);       
 51                         break;                    
 52                 case '-':                         
 53                         beep(DASH_HZ);            
 54                         udelay(US_PER_DOT * 3)    
 55                         beep(0);                  
 56                         udelay(US_PER_DOT);       
 57                         break;                    
 58                 default:        /* Assume it's    
 59                         udelay(US_PER_DOT * 3)    
 60                         break;                    
 61                 }                                 
 62         }                                         
 63 }                                                 
 64                                                   
 65 struct port_io_ops pio_ops;                       
 66                                                   
 67 void main(void)                                   
 68 {                                                 
 69         init_default_io_ops();                    
 70                                                   
 71         /* Kill machine if structures are wron    
 72         if (wakeup_header.real_magic != 0x1234    
 73                 while (1)                         
 74                         ;                         
 75                                                   
 76         if (wakeup_header.realmode_flags & 4)     
 77                 send_morse("...-");               
 78                                                   
 79         if (wakeup_header.realmode_flags & 1)     
 80                 asm volatile("lcallw   $0xc000    
 81                                                   
 82         if (wakeup_header.realmode_flags & 2)     
 83                 /* Need to call BIOS */           
 84                 probe_cards(0);                   
 85                 set_mode(wakeup_header.video_m    
 86         }                                         
 87 }                                                 
 88                                                   

~ [ 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