wok-current annotate linld/stuff/src/A20.ASM @ rev 20119

slitaz-base-files (333), slitaz-boot-scripts (445), slitaz-configs (313), slitaz-tools (1025), tazbug (152), tazinst (93), tazirc (22), tazlito (469), tazpanel (617), tazweb (208): revision of german messages
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Oct 14 10:45:51 2017 +0200 (2017-10-14)
parents 23fc786c04e8
children 2373992ff751
rev   line source
pascal@19515 1 ;***************************************************************
pascal@19515 2 ;****** This file is distributed under GPL
pascal@19515 3 ;***************************************************************
pascal@19515 4 ideal
pascal@19515 5 %crefref
pascal@19515 6 %noincl
pascal@19515 7 %nomacs
pascal@19636 8 p8086
pascal@19515 9
pascal@19515 10 group DGROUP _TEXT,_DATA
pascal@19515 11 assume cs:DGROUP,ds:DGROUP
pascal@19515 12
pascal@19515 13 segment _DATA byte public use16 'DATA'
pascal@19515 14
pascal@19515 15 global die:near
pascal@19515 16 enable_a20_methods:
pascal@19515 17 dw _enable_a20_fast, _enable_a20_kbd, _enable_a20_xmm, die
pascal@19580 18 msg_a20 db "Can't use A20",0
pascal@19515 19
pascal@19515 20 ends _DATA
pascal@19515 21
pascal@19515 22 segment _TEXT byte public use16 'CODE'
pascal@19515 23
pascal@19515 24 global xmm_driver:near
pascal@19515 25 global _enable_a20_xmm:near
pascal@19515 26
pascal@19515 27 ;***************************************************************
pascal@19515 28 ;void enable_a20_kbd();
pascal@19515 29 ;***************************************************************
pascal@19515 30 proc _enable_a20_kbd near
pascal@19515 31
pascal@19515 32 call @@empty_8042
pascal@19515 33 mov al,0D1h ; command write
pascal@19515 34 out 64h,al
pascal@19515 35 call @@empty_8042
pascal@19515 36 mov al,0DFh ; A20 on
pascal@19515 37 out 60h,al
pascal@19515 38
pascal@19515 39 ; This routine checks that the keyboard command queue is empty
pascal@19515 40 ; (after emptying the output buffers)
pascal@19515 41 ; Some machines have delusions that the keyboard buffer is always full
pascal@19515 42 ; with no keyboard attached...
pascal@19515 43 ; If there is no keyboard controller, we will usually get 0xff
pascal@19515 44 ; to all the reads. With each IO taking a microsecond and
pascal@19515 45 ; a timeout of 100,000 iterations, this can take about half a
pascal@19515 46 ; second ("delay" == out to port 0x80). That should be ok,
pascal@19515 47 ; and should also be plenty of time for a real keyboard controller
pascal@19515 48 ; to empty.
pascal@19515 49
pascal@19515 50 @@empty_8042:
pascal@19515 51 xor cx,cx ; 64K iterations
pascal@19515 52 @@loop:
pascal@19515 53 call @@delay ; 8042 status port
pascal@19580 54 in al,64h
pascal@19580 55 test al,3 ; is output or input full?
pascal@19580 56 jz @@break ; no - break loop
pascal@19515 57 test al,1 ;
pascal@19515 58 jz @@no_output
pascal@19515 59 call @@delay ; yes: read it
pascal@19515 60 in al,60h ;
pascal@19515 61 @@no_output:
pascal@19515 62 loop @@loop
pascal@19515 63 @@break:
pascal@19515 64 ret
pascal@19515 65
pascal@19515 66 @@delay: out 80h,al
pascal@19515 67 ret
pascal@19515 68
pascal@19515 69 endp _enable_a20_kbd
pascal@19515 70
pascal@19515 71 ;***************************************************************
pascal@19515 72 ;void enable_a20_fast();
pascal@19515 73 ;***************************************************************
pascal@19515 74 proc _enable_a20_fast near
pascal@19515 75
pascal@19515 76 ; You must preserve the other bits here. Otherwise embarrasing things
pascal@19515 77 ; like laptops powering off on boot happen. Corrected version by Kira
pascal@19515 78 ; Brown from Linux 2.2
pascal@19515 79 in al,92h ;
pascal@19515 80 or al,02h ; "fast A20" version
pascal@19515 81 out 92h,al ; some chips have only this
pascal@19515 82 ret
pascal@19515 83
pascal@19515 84 endp _enable_a20_fast
pascal@19515 85
pascal@19515 86 ;***************************************************************
pascal@19580 87 ;void enable_a20_or_die();
pascal@19580 88 ;***************************************************************
pascal@19580 89 global _enable_a20_or_die:near
pascal@19580 90 proc _enable_a20_or_die near
pascal@19580 91
pascal@19580 92 push si
pascal@19580 93 mov si,offset enable_a20_methods
pascal@19580 94 jmp @@check
pascal@19580 95 @@loop:
pascal@19580 96 lodsw
pascal@19580 97 mov bx,offset msg_a20
pascal@19580 98 call ax
pascal@19580 99 @@check:
pascal@19580 100 ;call _check_a20
pascal@19580 101 ;***************************************************************
pascal@19515 102 ;int check_a20();
pascal@19515 103 ;***************************************************************
pascal@19580 104 ;proc _check_a20 near
pascal@19515 105
pascal@19515 106 ; From linux kernel setup.S:
pascal@19515 107 ; wait until a20 really *is* enabled; it can take a fair amount of
pascal@19515 108 ; time on certain systems; Toshiba Tecras are known to have this
pascal@19515 109 ; problem.
pascal@19515 110
pascal@19515 111 push ds es
pascal@19515 112 xor bx,bx
pascal@19515 113 mov ds,bx
pascal@19515 114 mov cx,0FFFFh
pascal@19515 115 mov es,cx
pascal@19515 116 a20lp:
pascal@19515 117 cli
pascal@19515 118 mov ax,0AA55h
pascal@19515 119 xchg al,[bx]
pascal@19515 120 xchg ah,[es:bx+10h]
pascal@19515 121 xchg al,[bx]
pascal@19515 122 xchg ah,[es:bx+10h]
pascal@19515 123 cmp al,55h
pascal@19515 124 sti
pascal@19515 125 a20ko:
pascal@19515 126 loopne a20lp
pascal@19515 127 xchg ax,cx
pascal@19515 128 pop es ds
pascal@19580 129 ;ret
pascal@19515 130
pascal@19580 131 ;endp _check_a20
pascal@19515 132
pascal@19515 133 jne @@loop
pascal@19515 134 pop si
pascal@19515 135 ret
pascal@19515 136
pascal@19515 137 endp _enable_a20_or_die
pascal@19515 138
pascal@19515 139 ends _TEXT
pascal@19515 140
pascal@19515 141 end
pascal@19515 142
pascal@19515 143 ;###### END OF FILE ############################################