;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RDOS operating system ; Copyright (C) 1988-2000, Leif Ekblad ; ; This program is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2 of the License, or ; (at your option) any later version. The only exception to this rule ; is for commercial usage in embedded systems. For information on ; usage in commercial embedded systems, contact embedded@rdos.net ; ; This program is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with this program; if not, write to the Free Software ; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ; ; The author of this program may be contacted at leif@rdos.net ; ; ACPIBASE.ASM ; Basic ACPI support functions not available from RDOS device-driver interface ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; INCLUDE ..\..\kernel\user.def INCLUDE ..\..\kernel\os.def INCLUDE ..\..\kernel\os.inc INCLUDE ..\..\kernel\user.inc INCLUDE ..\..\kernel\driver.def INCLUDE ..\..\kernel\os\system.def .386p _TEXT SEGMENT byte public 'CODE' assume cs:_TEXT ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: CheckRsdp ; ; DESCRIPTION: Check for an RSDP ; ; PARAMETERS: DS:SI Base address to check ; ; RETURNS: NC OK ; EAX Physical address ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; rsd1 DB 'RSD ' rsd2 DB 'PTR ' CheckRsdp Proc near mov eax,dword ptr cs:rsd1 cmp eax,[si] jne check_rsdp_fail ; mov eax,dword ptr cs:rsd2 cmp eax,[si+4] jne check_rsdp_fail ; push cx push si ; xor al,al mov cx,20 check_rsdp_loop: add al,[si] inc si loop check_rsdp_loop ; pop si pop cx ; or al,al jnz check_rsdp_fail ; clc jmp check_rsdp_done check_rsdp_fail: stc check_rsdp_done: ret CheckRsdp Endp ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; NAME: GetRsdp ; ; DESCRIPTION: Get the RSDP ; ; RETURNS: EAX Physical address or 0 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; public AcpiOsGetRootPointer_ AcpiOsGetRootPointer_ Proc near push ds push es push ebx push ecx push edx push esi push edi push bp ; mov eax,1000h AllocateBigLinear AllocateGdt mov ecx,1000h CreateDataSelector16 mov eax,7h SetPhysicalPage mov ds,bx ; mov esi,40Eh mov si,[si] movzx esi,si shl esi,4 ; mov eax,esi and ax,0F000h or al,7 SetPhysicalPage and si,0FFFh ; mov cx,40h get_rsdp_bda: call CheckRsdp jnc get_rsdp_ok ; add si,10h loop get_rsdp_bda ; mov edi,0E0000h mov bp,20h get_rsdp_bios: mov eax,edi and ax,0F000h or al,7 SetPhysicalPage ; mov esi,edi and si,0FFFh ; mov cx,100h get_rsdp_bios_page: call CheckRsdp jnc get_rsdp_ok ; add si,10h loop get_rsdp_bios_page ; add edi,1000h sub bp,1 jnz get_rsdp_bios ; xor eax,eax jmp get_rsdp_done get_rsdp_ok: GetPhysicalPage and ax,0F000h or ax,si get_rsdp_done: push eax xor eax,eax mov ds,ax SetPhysicalPage mov ecx,1000h FreeLinear FreeGdt pop eax ; pop bp pop edi pop esi pop edx pop ecx pop ebx pop es pop ds ret AcpiOsGetRootPointer_ Endp _TEXT ENDS END