Commit 7107bb3b authored by Andy Grover's avatar Andy Grover Committed by Linus Torvalds

[PATCH] ACPI patch 3/9

This patch updates the acpi IA32 arch-specific files. Part of this is
taking what was acpitable.c and implementing it with better integration
with the rest of the ACPI code.
parent 40c05507
This diff is collapsed.
.text
#include <linux/linkage.h>
#include <asm/segment.h>
ALIGN
wakeup_start:
wakeup_code:
wakeup_code_start = .
.code16
cli
cld
# setup data segment
movw %cs, %ax
addw $(wakeup_data - wakeup_code) >> 4, %ax
movw %ax, %ds
# set up page table
movl (real_save_cr3 - wakeup_data), %eax
movl %eax, %cr3
# make sure %cr4 is set correctly (features, etc)
movl (real_save_cr4 - wakeup_data), %eax
movl %eax, %cr4
# need a gdt
lgdt real_save_gdt - wakeup_data
movl %cr0, %eax
orl $0x80000001, %eax
movl %eax, %cr0
ljmpl $__KERNEL_CS,$SYMBOL_NAME(wakeup_pmode_return)
.code32
ALIGN
.org 0x100
wakeup_data:
.word 0
real_save_gdt: .word 0
.long 0
real_save_cr3: .long 0
real_save_cr4: .long 0
.org 0x300
wakeup_stack:
wakeup_end:
wakeup_pmode_return:
# restore data segment
movl $__KERNEL_DS, %eax
movw %ax, %ds
movw %ax, %es
# and restore the stack
movw %ax, %ss
movl saved_esp, %esp
# restore other segment registers
xorl %eax, %eax
movw %ax, %fs
movw %ax, %gs
# reload the gdt, as we need the full 32 bit address
lgdt saved_gdt
lidt saved_idt
lldt saved_ldt
# restore the other general registers
movl saved_ebx, %ebx
movl saved_edi, %edi
movl saved_esi, %esi
movl saved_ebp, %ebp
# jump to place where we left off
movl saved_eip,%eax
jmp *%eax
##
# acpi_copy_wakeup_routine
#
# Copy the above routine to low memory.
#
# Parameters:
# %eax: place to copy wakeup routine to
#
# Returned address is location of code in low memory (past data and stack)
#
ENTRY(acpi_copy_wakeup_routine)
pushl %esi
pushl %edi
sgdt saved_gdt
sidt saved_idt
sldt saved_ldt
str saved_tss
movl %eax, %edi
leal wakeup_start, %esi
movl $(wakeup_end - wakeup_start) >> 2, %ecx
rep ; movsl
movl %cr3, %edx
movl %edx, real_save_cr3 - wakeup_start (%eax)
movl %cr4, %edx
movl %edx, real_save_cr4 - wakeup_start (%eax)
sgdt real_save_gdt - wakeup_start (%eax)
# restore the regs we used
popl %edi
popl %esi
ret
.data
ALIGN
# saved registers
saved_gdt: .long 0,0
saved_idt: .long 0,0
saved_ldt: .long 0
saved_tss: .long 0
saved_cr0: .long 0
ENTRY(saved_ebp) .long 0
ENTRY(saved_esi) .long 0
ENTRY(saved_edi) .long 0
ENTRY(saved_ebx) .long 0
ENTRY(saved_eip) .long 0
ENTRY(saved_esp) .long 0
/*
* asm-i386/acpi.h
*
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
* Copyright (C) 2001 Patrick Mochel <mochel@osdl.org>
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*
* 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.
*
* 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
*
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
#ifndef _ASM_ACPI_H
#define _ASM_ACPI_H
#ifdef __KERNEL__
#ifdef CONFIG_ACPI_BOOT
/* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */
#define FIX_ACPI_PAGES 4
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
extern int acpi_find_rsdp (unsigned long *phys_addr);
extern int acpi_parse_madt (unsigned long phys_addr, unsigned long size);
#endif /*CONFIG_ACPI_BOOT*/
#ifdef CONFIG_ACPI_PCI
int acpi_get_interrupt_model (int *type);
#endif /*CONFIG_ACPI_PCI*/
#ifdef CONFIG_ACPI_SLEEP
extern unsigned long saved_eip;
extern unsigned long saved_esp;
extern unsigned long saved_ebp;
extern unsigned long saved_ebx;
extern unsigned long saved_esi;
extern unsigned long saved_edi;
static inline void acpi_save_register_state(unsigned long return_point)
{
saved_eip = return_point;
asm volatile ("movl %%esp,(%0)" : "=m" (saved_esp));
asm volatile ("movl %%ebp,(%0)" : "=m" (saved_ebp));
asm volatile ("movl %%ebx,(%0)" : "=m" (saved_ebx));
asm volatile ("movl %%edi,(%0)" : "=m" (saved_edi));
asm volatile ("movl %%esi,(%0)" : "=m" (saved_esi));
}
#define acpi_restore_register_state() do {} while (0)
/* routines for saving/restoring kernel state */
extern int acpi_save_state_mem(void);
extern int acpi_save_state_disk(void);
extern void acpi_restore_state_mem(void);
extern unsigned long acpi_wakeup_address;
/* early initialization routine */
extern void acpi_reserve_bootmem(void);
#endif /*CONFIG_ACPI_SLEEP*/
#endif /*__KERNEL__*/
#endif /*_ASM_ACPI_H*/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment