Deleted Added
full compact
ofw_machdep.c (257992) ofw_machdep.c (257993)
1/*-
2 * Copyright (C) 1996 Wolfgang Solfrank.
3 * Copyright (C) 1996 TooLs GmbH.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $NetBSD: ofw_machdep.c,v 1.5 2000/05/23 13:25:43 tsubai Exp $
32 */
33
34#include <sys/cdefs.h>
1/*-
2 * Copyright (C) 1996 Wolfgang Solfrank.
3 * Copyright (C) 1996 TooLs GmbH.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 18 unchanged lines hidden (view full) ---

27 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * $NetBSD: ofw_machdep.c,v 1.5 2000/05/23 13:25:43 tsubai Exp $
32 */
33
34#include <sys/cdefs.h>
35__FBSDID("$FreeBSD: head/sys/powerpc/ofw/ofw_machdep.c 257992 2013-11-11 15:23:35Z nwhitehorn $");
35__FBSDID("$FreeBSD: head/sys/powerpc/ofw/ofw_machdep.c 257993 2013-11-11 15:43:21Z nwhitehorn $");
36
37#include <sys/param.h>
38#include <sys/bus.h>
39#include <sys/systm.h>
40#include <sys/conf.h>
41#include <sys/disk.h>
42#include <sys/fcntl.h>
43#include <sys/malloc.h>

--- 14 unchanged lines hidden (view full) ---

58#include <machine/cpu.h>
59#include <machine/md_var.h>
60#include <machine/platform.h>
61#include <machine/ofw_machdep.h>
62
63static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ];
64static struct mem_region OFfree[PHYS_AVAIL_SZ];
65
36
37#include <sys/param.h>
38#include <sys/bus.h>
39#include <sys/systm.h>
40#include <sys/conf.h>
41#include <sys/disk.h>
42#include <sys/fcntl.h>
43#include <sys/malloc.h>

--- 14 unchanged lines hidden (view full) ---

58#include <machine/cpu.h>
59#include <machine/md_var.h>
60#include <machine/platform.h>
61#include <machine/ofw_machdep.h>
62
63static struct mem_region OFmem[PHYS_AVAIL_SZ], OFavail[PHYS_AVAIL_SZ];
64static struct mem_region OFfree[PHYS_AVAIL_SZ];
65
66static int apple_hacks;
67
68#ifdef AIM
66extern register_t ofmsr[5];
67extern void *openfirmware_entry;
68static void *fdt;
69int ofw_real_mode;
69extern register_t ofmsr[5];
70extern void *openfirmware_entry;
71static void *fdt;
72int ofw_real_mode;
70static int apple_hacks;
71
72int ofwcall(void *);
73static int openfirmware(void *args);
74
75/*
76 * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback.
77 */
78register_t ofw_sprg0_save;

--- 30 unchanged lines hidden (view full) ---

109 * Note that SPRG1-3 contents are irrelevant. They are scratch
110 * registers used in the early portion of trap handling when
111 * interrupts are disabled.
112 *
113 * PCPU data cannot be used until this routine is called !
114 */
115 __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save));
116}
73
74int ofwcall(void *);
75static int openfirmware(void *args);
76
77/*
78 * Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback.
79 */
80register_t ofw_sprg0_save;

--- 30 unchanged lines hidden (view full) ---

111 * Note that SPRG1-3 contents are irrelevant. They are scratch
112 * registers used in the early portion of trap handling when
113 * interrupts are disabled.
114 *
115 * PCPU data cannot be used until this routine is called !
116 */
117 __asm __volatile("mtsprg0 %0" :: "r"(ofw_sprg0_save));
118}
119#endif
117
118/*
119 * Memory region utilities: determine if two regions overlap,
120 * and merge two overlapping regions into one
121 */
122static int
123memr_overlap(struct mem_region *r1, struct mem_region *r2)
124{

--- 306 unchanged lines hidden (view full) ---

431 fsz++;
432 }
433 }
434
435 *availp = OFfree;
436 *availsz = fsz;
437}
438
120
121/*
122 * Memory region utilities: determine if two regions overlap,
123 * and merge two overlapping regions into one
124 */
125static int
126memr_overlap(struct mem_region *r1, struct mem_region *r2)
127{

--- 306 unchanged lines hidden (view full) ---

434 fsz++;
435 }
436 }
437
438 *availp = OFfree;
439 *availsz = fsz;
440}
441
442#ifdef AIM
439void
440OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *))
441{
442 if (ofmsr[0] & PSL_DR)
443 ofw_real_mode = 0;
444 else
445 ofw_real_mode = 1;
446

--- 155 unchanged lines hidden (view full) ---

602 args.nargs = 1;
603 args.nreturns = 0;
604 args.arg = (cell_t)(uintptr_t)"reset-all";
605 openfirmware_core(&args); /* Don't do rendezvous! */
606
607 for (;;); /* just in case */
608}
609
443void
444OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *))
445{
446 if (ofmsr[0] & PSL_DR)
447 ofw_real_mode = 0;
448 else
449 ofw_real_mode = 1;
450

--- 155 unchanged lines hidden (view full) ---

606 args.nargs = 1;
607 args.nreturns = 0;
608 args.arg = (cell_t)(uintptr_t)"reset-all";
609 openfirmware_core(&args); /* Don't do rendezvous! */
610
611 for (;;); /* just in case */
612}
613
614#endif /* AIM */
615
610void
611OF_getetheraddr(device_t dev, u_char *addr)
612{
613 phandle_t node;
614
615 node = ofw_bus_get_node(dev);
616 OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN);
617}

--- 141 unchanged lines hidden ---
616void
617OF_getetheraddr(device_t dev, u_char *addr)
618{
619 phandle_t node;
620
621 node = ofw_bus_get_node(dev);
622 OF_getprop(node, "local-mac-address", addr, ETHER_ADDR_LEN);
623}

--- 141 unchanged lines hidden ---