···114114/* Re-Start the CPU with the passed device tree node. */115115extern int prom_restartcpu(int cpunode);116116117117-/* PROM memory allocation facilities... */118118-119119-/* Allocated at possibly the given virtual address a chunk of the120120- * indicated size.121121- */122122-extern char *prom_alloc(char *virt_hint, unsigned int size);123123-124124-/* Free a previously allocated chunk. */125125-extern void prom_free(char *virt_addr, unsigned int size);126126-127117/* Sun4/sun4c specific memory-management startup hook. */128118129119/* Map the passed segment in the given context at the passed
···11-/*22- * palloc.c: Memory allocation from the Sun PROM.33- *44- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)55- */66-77-#include <asm/openprom.h>88-#include <asm/oplib.h>99-1010-/* You should not call these routines after memory management1111- * has been initialized in the kernel, if fact you should not1212- * use these if at all possible in the kernel. They are mainly1313- * to be used for a bootloader for temporary allocations which1414- * it will free before jumping into the kernel it has loaded.1515- *1616- * Also, these routines don't work on V0 proms, only V2 and later.1717- */1818-1919-/* Allocate a chunk of memory of size 'num_bytes' giving a suggestion2020- * of virtual_hint as the preferred virtual base address of this chunk.2121- * There are no guarantees that you will get the allocation, or that2222- * the prom will abide by your "hint". So check your return value.2323- */2424-char *2525-prom_alloc(char *virtual_hint, unsigned int num_bytes)2626-{2727- if(prom_vers == PROM_V0) return (char *) 0x0;2828- if(num_bytes == 0x0) return (char *) 0x0;2929- return (*(romvec->pv_v2devops.v2_dumb_mem_alloc))(virtual_hint, num_bytes);3030-}3131-3232-/* Free a previously allocated chunk back to the prom at virtual address3333- * 'vaddr' of size 'num_bytes'. NOTE: This vaddr is not the hint you3434- * used for the allocation, but the virtual address the prom actually3535- * returned to you. They may be have been the same, they may have not,3636- * doesn't matter.3737- */3838-void3939-prom_free(char *vaddr, unsigned int num_bytes)4040-{4141- if((prom_vers == PROM_V0) || (num_bytes == 0x0)) return;4242- (*(romvec->pv_v2devops.v2_dumb_mem_free))(vaddr, num_bytes);4343-}