cregit-Linux how code gets into the kernel

Release 4.14 arch/powerpc/boot/of.c

/*
 * Copyright (C) Paul Mackerras 1997.
 *
 * 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.
 */
#include <stdarg.h>
#include <stddef.h>
#include "types.h"
#include "elf.h"
#include "string.h"
#include "stdio.h"
#include "page.h"
#include "ops.h"

#include "of.h"

/* Value picked to match that used by yaboot */

#define PROG_START	0x01400000	
/* only used on 64-bit systems */

#define RAM_END		(512<<20)	
/* Fixme: use OF */

#define	ONE_MB		0x100000




static unsigned long claim_base;

void epapr_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
			 unsigned long r6, unsigned long r7);


static void *of_try_claim(unsigned long size) { unsigned long addr = 0; if (claim_base == 0) claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); for(; claim_base < RAM_END; claim_base += ONE_MB) { #ifdef DEBUG printf(" trying: 0x%08lx\n\r", claim_base); #endif addr = (unsigned long) of_claim(claim_base, size, 0); if (addr != PROM_ERROR) break; } if (addr == 0) return NULL; claim_base = PAGE_ALIGN(claim_base + size); return (void *)addr; }

Contributors

PersonTokensPropCommitsCommitProp
Mark A. Greer10193.52%120.00%
Benjamin Herrenschmidt32.78%120.00%
Geert Uytterhoeven21.85%120.00%
David Gibson10.93%120.00%
Cédric Le Goater10.93%120.00%
Total108100.00%5100.00%


static void of_image_hdr(const void *hdr) { const Elf64_Ehdr *elf64 = hdr; if (elf64->e_ident[EI_CLASS] == ELFCLASS64) { /* * Maintain a "magic" minimum address. This keeps some older * firmware platforms running. */ if (claim_base < PROG_START) claim_base = PROG_START; } }

Contributors

PersonTokensPropCommitsCommitProp
Mark A. Greer42100.00%1100.00%
Total42100.00%1100.00%


static void of_platform_init(unsigned long a1, unsigned long a2, void *promptr) { platform_ops.image_hdr = of_image_hdr; platform_ops.malloc = of_try_claim; platform_ops.exit = of_exit; platform_ops.vmlinux_alloc = of_vmlinux_alloc; dt_ops.finddevice = of_finddevice; dt_ops.getprop = of_getprop; dt_ops.setprop = of_setprop; of_console_init(); of_init(promptr); loader_info.promptr = promptr; if (a1 && a2 && a2 != 0xdeadbeef) { loader_info.initrd_addr = a1; loader_info.initrd_size = a2; } }

Contributors

PersonTokensPropCommitsCommitProp
Mark A. Greer4747.96%228.57%
David Gibson3737.76%342.86%
Paul Mackerras1212.24%114.29%
Benjamin Herrenschmidt22.04%114.29%
Total98100.00%7100.00%


void platform_init(unsigned long r3, unsigned long r4, unsigned long r5, unsigned long r6, unsigned long r7) { /* Detect OF vs. ePAPR boot */ if (r5) of_platform_init(r3, r4, (void *)r5); else epapr_platform_init(r3, r4, r5, r6, r7); }

Contributors

PersonTokensPropCommitsCommitProp
Benjamin Herrenschmidt57100.00%1100.00%
Total57100.00%1100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
Mark A. Greer20554.38%215.38%
Benjamin Herrenschmidt8622.81%215.38%
David Gibson5314.06%323.08%
Paul Mackerras143.71%215.38%
Todd Inglett112.92%17.69%
Olaf Hering51.33%17.69%
Geert Uytterhoeven20.53%17.69%
Cédric Le Goater10.27%17.69%
Total377100.00%13100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.