Commit b32d4b59 authored by Richard Henderson's avatar Richard Henderson

Merge are.twiddle.net:/home/rth/BK/linus-2.5

into are.twiddle.net:/home/rth/BK/axp-2.5
parents 621ce5a8 1c05f11e
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include <linux/types.h> #include <linux/types.h>
#include <linux/ipc.h> #include <linux/ipc.h>
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/uio.h>
#include <asm/fpu.h> #include <asm/fpu.h>
#include <asm/io.h> #include <asm/io.h>
......
...@@ -251,6 +251,27 @@ get_mem_size_limit(char *s) ...@@ -251,6 +251,27 @@ get_mem_size_limit(char *s)
return end >> PAGE_SHIFT; /* Return the PFN of the limit. */ return end >> PAGE_SHIFT; /* Return the PFN of the limit. */
} }
#ifdef CONFIG_BLK_DEV_INITRD
void * __init
move_initrd(unsigned long mem_limit)
{
void *start;
unsigned long size;
size = initrd_end - initrd_start;
start = __alloc_bootmem(size, PAGE_SIZE, 0);
if (!start || __pa(start) + size > mem_limit) {
initrd_start = initrd_end = 0;
return NULL;
}
memmove(start, (void *)initrd_start, size);
initrd_start = (unsigned long)start;
initrd_end = initrd_start + size;
printk("initrd moved to %p\n", start);
return start;
}
#endif
#ifndef CONFIG_DISCONTIGMEM #ifndef CONFIG_DISCONTIGMEM
static void __init static void __init
setup_memory(void *kernel_end) setup_memory(void *kernel_end)
...@@ -379,11 +400,11 @@ setup_memory(void *kernel_end) ...@@ -379,11 +400,11 @@ setup_memory(void *kernel_end)
(void *) initrd_start, INITRD_SIZE); (void *) initrd_start, INITRD_SIZE);
if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) { if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) {
if (!move_initrd(PFN_PHYS(max_low_pfn)))
printk("initrd extends beyond end of memory " printk("initrd extends beyond end of memory "
"(0x%08lx > 0x%p)\ndisabling initrd\n", "(0x%08lx > 0x%p)\ndisabling initrd\n",
initrd_end, initrd_end,
phys_to_virt(PFN_PHYS(max_low_pfn))); phys_to_virt(PFN_PHYS(max_low_pfn)));
initrd_start = initrd_end = 0;
} else { } else {
reserve_bootmem(virt_to_phys((void *)initrd_start), reserve_bootmem(virt_to_phys((void *)initrd_start),
INITRD_SIZE); INITRD_SIZE);
......
...@@ -76,12 +76,14 @@ nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin) ...@@ -76,12 +76,14 @@ nautilus_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
void void
nautilus_kill_arch(int mode) nautilus_kill_arch(int mode)
{ {
struct pci_bus *bus = pci_isa_hose->bus;
switch (mode) { switch (mode) {
case LINUX_REBOOT_CMD_RESTART: case LINUX_REBOOT_CMD_RESTART:
if (! alpha_using_srm) { if (! alpha_using_srm) {
u8 t8; u8 t8;
pcibios_read_config_byte(0, 0x38, 0x43, &t8); pci_bus_read_config_byte(bus, 0x38, 0x43, &t8);
pcibios_write_config_byte(0, 0x38, 0x43, t8 | 0x80); pci_bus_write_config_byte(bus, 0x38, 0x43, t8 | 0x80);
outb(1, 0x92); outb(1, 0x92);
outb(0, 0x92); outb(0, 0x92);
/* NOTREACHED */ /* NOTREACHED */
...@@ -91,7 +93,7 @@ nautilus_kill_arch(int mode) ...@@ -91,7 +93,7 @@ nautilus_kill_arch(int mode)
case LINUX_REBOOT_CMD_POWER_OFF: case LINUX_REBOOT_CMD_POWER_OFF:
{ {
u32 pmuport; u32 pmuport;
pcibios_read_config_dword(0, 0x88, 0x10, &pmuport); pci_bus_read_config_dword(bus, 0x88, 0x10, &pmuport);
pmuport &= 0xfffe; pmuport &= 0xfffe;
outl(0xffff, pmuport); /* clear pending events */ outl(0xffff, pmuport); /* clear pending events */
outw(0x2000, pmuport+4); /* power off */ outw(0x2000, pmuport+4); /* power off */
......
...@@ -77,7 +77,7 @@ alphabook1_init_arch(void) ...@@ -77,7 +77,7 @@ alphabook1_init_arch(void)
static void __init static void __init
sio_pci_route(void) sio_pci_route(void)
{ {
pcibios_write_config_dword(0, PCI_DEVFN(7, 0), 0x60, pci_bus_write_config_dword(pci_isa_hose->bus, PCI_DEVFN(7, 0), 0x60,
alpha_mv.sys.sio.route_tab); alpha_mv.sys.sio.route_tab);
} }
......
...@@ -357,18 +357,23 @@ mem_init(void) ...@@ -357,18 +357,23 @@ mem_init(void)
#endif /* CONFIG_DISCONTIGMEM */ #endif /* CONFIG_DISCONTIGMEM */
void void
free_initmem (void) free_reserved_mem(void *start, void *end)
{ {
extern char __init_begin, __init_end; void *__start = start;
unsigned long addr; for (; __start < end; __start += PAGE_SIZE) {
ClearPageReserved(virt_to_page(__start));
addr = (unsigned long)(&__init_begin); set_page_count(virt_to_page(__start), 1);
for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) { free_page((long)__start);
ClearPageReserved(virt_to_page(addr));
set_page_count(virt_to_page(addr), 1);
free_page(addr);
totalram_pages++; totalram_pages++;
} }
}
void
free_initmem(void)
{
extern char __init_begin, __init_end;
free_reserved_mem(&__init_begin, &__init_end);
printk ("Freeing unused kernel memory: %ldk freed\n", printk ("Freeing unused kernel memory: %ldk freed\n",
(&__init_end - &__init_begin) >> 10); (&__init_end - &__init_begin) >> 10);
} }
...@@ -377,13 +382,7 @@ free_initmem (void) ...@@ -377,13 +382,7 @@ free_initmem (void)
void void
free_initrd_mem(unsigned long start, unsigned long end) free_initrd_mem(unsigned long start, unsigned long end)
{ {
unsigned long __start = start; free_reserved_mem((void *)start, (void *)end);
for (; start < end; start += PAGE_SIZE) { printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
ClearPageReserved(virt_to_page(start));
set_page_count(virt_to_page(start), 1);
free_page(start);
totalram_pages++;
}
printk ("Freeing initrd memory: %ldk freed\n", (end - __start) >> 10);
} }
#endif #endif
...@@ -249,16 +249,18 @@ setup_memory(void *kernel_end) ...@@ -249,16 +249,18 @@ setup_memory(void *kernel_end)
#ifdef CONFIG_BLK_DEV_INITRD #ifdef CONFIG_BLK_DEV_INITRD
initrd_start = INITRD_START; initrd_start = INITRD_START;
if (initrd_start) { if (initrd_start) {
extern void *move_initrd(unsigned long);
initrd_end = initrd_start+INITRD_SIZE; initrd_end = initrd_start+INITRD_SIZE;
printk("Initial ramdisk at: 0x%p (%lu bytes)\n", printk("Initial ramdisk at: 0x%p (%lu bytes)\n",
(void *) initrd_start, INITRD_SIZE); (void *) initrd_start, INITRD_SIZE);
if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) { if ((void *)initrd_end > phys_to_virt(PFN_PHYS(max_low_pfn))) {
if (!move_initrd(PFN_PHYS(max_low_pfn)))
printk("initrd extends beyond end of memory " printk("initrd extends beyond end of memory "
"(0x%08lx > 0x%p)\ndisabling initrd\n", "(0x%08lx > 0x%p)\ndisabling initrd\n",
initrd_end, initrd_end,
phys_to_virt(PFN_PHYS(max_low_pfn))); phys_to_virt(PFN_PHYS(max_low_pfn)));
initrd_start = initrd_end = 0;
} else { } else {
reserve_bootmem_node(NODE_DATA(KVADDR_TO_NID(initrd_start)), reserve_bootmem_node(NODE_DATA(KVADDR_TO_NID(initrd_start)),
virt_to_phys((void *)initrd_start), virt_to_phys((void *)initrd_start),
......
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