setup.c 17.4 KB
Newer Older
1
/*
2
 *  Powermac setup and early boot code plus other random bits.
3 4 5 6 7
 *
 *  PowerPC version
 *    Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
 *
 *  Adapted for Power Macintosh by Paul Mackerras
8
 *    Copyright (C) 1996 Paul Mackerras (paulus@samba.org)
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
 *
 *  Derived from "arch/alpha/kernel/setup.c"
 *    Copyright (C) 1995 Linus Torvalds
 *
 *  Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.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.
 *
 */

/*
 * bootup setup stuff..
 */

#include <linux/config.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/stddef.h>
#include <linux/unistd.h>
#include <linux/ptrace.h>
#include <linux/slab.h>
#include <linux/user.h>
#include <linux/a.out.h>
#include <linux/tty.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/major.h>
#include <linux/initrd.h>
#include <linux/vt_kern.h>
#include <linux/console.h>
#include <linux/ide.h>
#include <linux/pci.h>
#include <linux/adb.h>
#include <linux/cuda.h>
#include <linux/pmu.h>
#include <linux/irq.h>
#include <linux/seq_file.h>
#include <linux/root_dev.h>
#include <linux/bitops.h>
#include <linux/suspend.h>

#include <asm/reg.h>
#include <asm/sections.h>
#include <asm/prom.h>
#include <asm/system.h>
#include <asm/pgtable.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#include <asm/ohare.h>
#include <asm/mediabay.h>
#include <asm/machdep.h>
#include <asm/dma.h>
#include <asm/cputable.h>
#include <asm/btext.h>
#include <asm/pmac_feature.h>
#include <asm/time.h>
#include <asm/of_device.h>
#include <asm/mmu_context.h>
74 75 76 77
#include <asm/iommu.h>
#include <asm/smu.h>
#include <asm/pmc.h>
#include <asm/mpic.h>
78

79
#include "pmac.h"
80 81 82 83 84 85 86 87 88

#undef SHOW_GATWICK_IRQS

unsigned char drive_info;

int ppc_override_l2cr = 0;
int ppc_override_l2cr_value;
int has_l2cache = 0;

89 90
int pmac_newworld = 1;

91 92 93
static int current_root_goodness = -1;

extern int pmac_newworld;
94
extern struct machdep_calls pmac_md;
95 96 97

#define DEFAULT_ROOT_DEVICE Root_SDA1	/* sda1 - slightly silly choice */

98 99 100
#ifdef CONFIG_PPC64
#include <asm/udbg.h>
int sccdbg;
101 102
#endif

103 104
extern void zs_kgdb_hook(int tty_num);

105
sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
106 107 108 109 110 111
EXPORT_SYMBOL(sys_ctrler);

#ifdef CONFIG_PMAC_SMU
unsigned long smu_cmdbuf_abs;
EXPORT_SYMBOL(smu_cmdbuf_abs);
#endif
112 113 114 115 116 117

#ifdef CONFIG_SMP
extern struct smp_ops_t psurge_smp_ops;
extern struct smp_ops_t core99_smp_ops;
#endif /* CONFIG_SMP */

118
static void pmac_show_cpuinfo(struct seq_file *m)
119 120 121 122
{
	struct device_node *np;
	char *pp;
	int plen;
123 124
	int mbmodel;
	unsigned int mbflags;
125 126
	char* mbname;

127 128 129 130 131 132
	mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
				    PMAC_MB_INFO_MODEL, 0);
	mbflags = pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL,
				    PMAC_MB_INFO_FLAGS, 0);
	if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME,
			      (long) &mbname) != 0)
133 134 135 136
		mbname = "Unknown";

	/* find motherboard type */
	seq_printf(m, "machine\t\t: ");
137
	np = of_find_node_by_path("/");
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
	if (np != NULL) {
		pp = (char *) get_property(np, "model", NULL);
		if (pp != NULL)
			seq_printf(m, "%s\n", pp);
		else
			seq_printf(m, "PowerMac\n");
		pp = (char *) get_property(np, "compatible", &plen);
		if (pp != NULL) {
			seq_printf(m, "motherboard\t:");
			while (plen > 0) {
				int l = strlen(pp) + 1;
				seq_printf(m, " %s", pp);
				plen -= l;
				pp += l;
			}
			seq_printf(m, "\n");
		}
155
		of_node_put(np);
156 157 158 159 160 161 162 163
	} else
		seq_printf(m, "PowerMac\n");

	/* print parsed model */
	seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
	seq_printf(m, "pmac flags\t: %08x\n", mbflags);

	/* find l2 cache info */
164 165 166 167
	np = of_find_node_by_name(NULL, "l2-cache");
	if (np == NULL)
		np = of_find_node_by_type(NULL, "cache");
	if (np != NULL) {
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
		unsigned int *ic = (unsigned int *)
			get_property(np, "i-cache-size", NULL);
		unsigned int *dc = (unsigned int *)
			get_property(np, "d-cache-size", NULL);
		seq_printf(m, "L2 cache\t:");
		has_l2cache = 1;
		if (get_property(np, "cache-unified", NULL) != 0 && dc) {
			seq_printf(m, " %dK unified", *dc / 1024);
		} else {
			if (ic)
				seq_printf(m, " %dK instruction", *ic / 1024);
			if (dc)
				seq_printf(m, "%s %dK data",
					   (ic? " +": ""), *dc / 1024);
		}
		pp = get_property(np, "ram-type", NULL);
		if (pp)
			seq_printf(m, " %s", pp);
		seq_printf(m, "\n");
187
		of_node_put(np);
188 189 190 191 192 193 194
	}

	/* Indicate newworld/oldworld */
	seq_printf(m, "pmac-generation\t: %s\n",
		   pmac_newworld ? "NewWorld" : "OldWorld");
}

195
static void pmac_show_percpuinfo(struct seq_file *m, int i)
196 197 198 199 200 201
{
#ifdef CONFIG_CPU_FREQ_PMAC
	extern unsigned int pmac_get_one_cpufreq(int i);
	unsigned int freq = pmac_get_one_cpufreq(i);
	if (freq != 0) {
		seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
202
		return;
203 204
	}
#endif /* CONFIG_CPU_FREQ_PMAC */
205
#ifdef CONFIG_PPC32
206
	of_show_percpuinfo(m, i);
207
#endif
208 209
}

210 211 212 213 214 215 216 217 218 219
#ifndef CONFIG_ADB_CUDA
int find_via_cuda(void)
{
	if (!find_devices("via-cuda"))
		return 0;
	printk("WARNING ! Your machine is CUDA-based but your kernel\n");
	printk("          wasn't compiled with CONFIG_ADB_CUDA option !\n");
	return 0;
}
#endif
220

221 222
#ifndef CONFIG_ADB_PMU
int find_via_pmu(void)
223
{
224 225 226 227 228 229 230
	if (!find_devices("via-pmu"))
		return 0;
	printk("WARNING ! Your machine is PMU-based but your kernel\n");
	printk("          wasn't compiled with CONFIG_ADB_PMU option !\n");
	return;
}
#endif
231

232 233 234 235 236 237 238
#ifndef CONFIG_PMAC_SMU
int smu_init(void)
{
	/* should check and warn if SMU is present */
	return 0;
}
#endif
239

240 241
#ifdef CONFIG_PPC32
static volatile u32 *sysctrl_regs;
242

243 244
static void __init ohare_init(void)
{
245 246 247 248
	/* this area has the CPU identification register
	   and some registers used by smp boards */
	sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);

249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264
	/*
	 * Turn on the L2 cache.
	 * We assume that we have a PSX memory controller iff
	 * we have an ohare I/O controller.
	 */
	if (find_devices("ohare") != NULL) {
		if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
			if (sysctrl_regs[4] & 0x10)
				sysctrl_regs[4] |= 0x04000020;
			else
				sysctrl_regs[4] |= 0x04000000;
			if(has_l2cache)
				printk(KERN_INFO "Level 2 cache enabled\n");
		}
	}
}
265

266 267
static void __init l2cr_init(void)
{
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
	/* Checks "l2cr-value" property in the registry */
	if (cpu_has_feature(CPU_FTR_L2CR)) {
		struct device_node *np = find_devices("cpus");
		if (np == 0)
			np = find_type_devices("cpu");
		if (np != 0) {
			unsigned int *l2cr = (unsigned int *)
				get_property(np, "l2cr-value", NULL);
			if (l2cr != 0) {
				ppc_override_l2cr = 1;
				ppc_override_l2cr_value = *l2cr;
				_set_L2CR(0);
				_set_L2CR(ppc_override_l2cr_value);
			}
		}
	}

	if (ppc_override_l2cr)
286 287 288 289
		printk(KERN_INFO "L2CR overridden (0x%x), "
		       "backside cache is %s\n",
		       ppc_override_l2cr_value,
		       (ppc_override_l2cr_value & 0x80000000)
290
				? "enabled" : "disabled");
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338
}
#endif

void __init pmac_setup_arch(void)
{
	struct device_node *cpu;
	int *fp;
	unsigned long pvr;

	pvr = PVR_VER(mfspr(SPRN_PVR));

	/* Set loops_per_jiffy to a half-way reasonable value,
	   for use until calibrate_delay gets called. */
	loops_per_jiffy = 50000000 / HZ;
	cpu = of_find_node_by_type(NULL, "cpu");
	if (cpu != NULL) {
		fp = (int *) get_property(cpu, "clock-frequency", NULL);
		if (fp != NULL) {
			if (pvr >= 0x30 && pvr < 0x80)
				/* PPC970 etc. */
				loops_per_jiffy = *fp / (3 * HZ);
			else if (pvr == 4 || pvr >= 8)
				/* 604, G3, G4 etc. */
				loops_per_jiffy = *fp / HZ;
			else
				/* 601, 603, etc. */
				loops_per_jiffy = *fp / (2 * HZ);
		}
		of_node_put(cpu);
	}

	/* Lookup PCI hosts */
	pmac_pci_init();

#ifdef CONFIG_PPC32
	ohare_init();
	l2cr_init();
#endif /* CONFIG_PPC32 */

#ifdef CONFIG_PPC64
	/* Probe motherboard chipset */
	/* this is done earlier in setup_arch for 32-bit */
	pmac_feature_init();

	/* We can NAP */
	powersave_nap = 1;
	printk(KERN_INFO "Using native/NAP idle loop\n");
#endif
339 340 341 342 343 344 345

#ifdef CONFIG_KGDB
	zs_kgdb_hook(0);
#endif

	find_via_cuda();
	find_via_pmu();
346 347
	smu_init();

348 349 350
#ifdef CONFIG_NVRAM
	pmac_nvram_init();
#endif
351 352

#ifdef CONFIG_PPC32
353 354 355 356 357 358
#ifdef CONFIG_BLK_DEV_INITRD
	if (initrd_start)
		ROOT_DEV = Root_RAM0;
	else
#endif
		ROOT_DEV = DEFAULT_ROOT_DEVICE;
359
#endif
360 361 362 363

#ifdef CONFIG_SMP
	/* Check for Core99 */
	if (find_devices("uni-n") || find_devices("u3"))
364
		smp_ops = &core99_smp_ops;
365
#ifdef CONFIG_PPC32
366
	else
367
		smp_ops = &psurge_smp_ops;
368
#endif
369 370 371
#endif /* CONFIG_SMP */
}

372 373
char *bootpath;
char *bootdevice;
374 375 376 377 378 379
void *boot_host;
int boot_target;
int boot_part;
extern dev_t boot_dev;

#ifdef CONFIG_SCSI
380
void __init note_scsi_host(struct device_node *node, void *host)
381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
{
	int l;
	char *p;

	l = strlen(node->full_name);
	if (bootpath != NULL && bootdevice != NULL
	    && strncmp(node->full_name, bootdevice, l) == 0
	    && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
		boot_host = host;
		/*
		 * There's a bug in OF 1.0.5.  (Why am I not surprised.)
		 * If you pass a path like scsi/sd@1:0 to canon, it returns
		 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
		 * That is, the scsi target number doesn't get preserved.
		 * So we pick the target number out of bootpath and use that.
		 */
		p = strstr(bootpath, "/sd@");
		if (p != NULL) {
			p += 4;
			boot_target = simple_strtoul(p, NULL, 10);
			p = strchr(p, ':');
			if (p != NULL)
				boot_part = simple_strtoul(p + 1, NULL, 10);
		}
	}
}
407
EXPORT_SYMBOL(note_scsi_host);
408 409 410
#endif

#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
411
static dev_t __init find_ide_boot(void)
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427
{
	char *p;
	int n;
	dev_t __init pmac_find_ide_boot(char *bootdevice, int n);

	if (bootdevice == NULL)
		return 0;
	p = strrchr(bootdevice, '/');
	if (p == NULL)
		return 0;
	n = p - bootdevice;

	return pmac_find_ide_boot(bootdevice, n);
}
#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */

428
static void __init find_boot_device(void)
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
{
#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
	boot_dev = find_ide_boot();
#endif
}

/* TODO: Merge the suspend-to-ram with the common code !!!
 * currently, this is a stub implementation for suspend-to-disk
 * only
 */

#ifdef CONFIG_SOFTWARE_SUSPEND

static int pmac_pm_prepare(suspend_state_t state)
{
	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

	return 0;
}

static int pmac_pm_enter(suspend_state_t state)
{
	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

	/* Giveup the lazy FPU & vec so we don't have to back them
	 * up from the low level code
	 */
	enable_kernel_fp();

#ifdef CONFIG_ALTIVEC
459
	if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484
		enable_kernel_altivec();
#endif /* CONFIG_ALTIVEC */

	return 0;
}

static int pmac_pm_finish(suspend_state_t state)
{
	printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);

	/* Restore userland MMU context */
	set_context(current->active_mm->context, current->active_mm->pgd);

	return 0;
}

static struct pm_ops pmac_pm_ops = {
	.pm_disk_mode	= PM_DISK_SHUTDOWN,
	.prepare	= pmac_pm_prepare,
	.enter		= pmac_pm_enter,
	.finish		= pmac_pm_finish,
};

#endif /* CONFIG_SOFTWARE_SUSPEND */

485 486
static int initializing = 1;

487 488 489 490 491 492 493 494 495 496 497 498
static int pmac_late_init(void)
{
	initializing = 0;
#ifdef CONFIG_SOFTWARE_SUSPEND
	pm_set_ops(&pmac_pm_ops);
#endif /* CONFIG_SOFTWARE_SUSPEND */
	return 0;
}

late_initcall(pmac_late_init);

/* can't be __init - can be called whenever a disk is first accessed */
499
void note_bootable_part(dev_t dev, int part, int goodness)
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
{
	static int found_boot = 0;
	char *p;

	if (!initializing)
		return;
	if ((goodness <= current_root_goodness) &&
	    ROOT_DEV != DEFAULT_ROOT_DEVICE)
		return;
	p = strstr(saved_command_line, "root=");
	if (p != NULL && (p == saved_command_line || p[-1] == ' '))
		return;

	if (!found_boot) {
		find_boot_device();
		found_boot = 1;
	}
	if (!boot_dev || dev == boot_dev) {
		ROOT_DEV = dev + part;
		boot_dev = 0;
		current_root_goodness = goodness;
	}
}

#ifdef CONFIG_ADB_CUDA
525 526
static void cuda_restart(void)
{
527 528
	struct adb_request req;

529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559
	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM);
	for (;;)
		cuda_poll();
}

static void cuda_shutdown(void)
{
	struct adb_request req;

	cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN);
	for (;;)
		cuda_poll();
}

#else
#define cuda_restart()
#define cuda_shutdown()
#endif

#ifndef CONFIG_ADB_PMU
#define pmu_restart()
#define pmu_shutdown()
#endif

#ifndef CONFIG_PMAC_SMU
#define smu_restart()
#define smu_shutdown()
#endif

static void pmac_restart(char *cmd)
{
560 561
	switch (sys_ctrler) {
	case SYS_CTRLER_CUDA:
562
		cuda_restart();
563 564 565 566
		break;
	case SYS_CTRLER_PMU:
		pmu_restart();
		break;
567 568 569
	case SYS_CTRLER_SMU:
		smu_restart();
		break;
570 571 572 573
	default: ;
	}
}

574
static void pmac_power_off(void)
575 576 577
{
	switch (sys_ctrler) {
	case SYS_CTRLER_CUDA:
578
		cuda_shutdown();
579 580 581 582
		break;
	case SYS_CTRLER_PMU:
		pmu_shutdown();
		break;
583 584 585
	case SYS_CTRLER_SMU:
		smu_shutdown();
		break;
586 587 588 589 590 591 592 593 594 595
	default: ;
	}
}

static void
pmac_halt(void)
{
	pmac_power_off();
}

596
#ifdef CONFIG_PPC32
597
void __init pmac_init(void)
598
{
599
	/* isa_io_base gets set in pmac_pci_init */
600 601 602 603 604 605
	isa_mem_base = PMAC_ISA_MEM_BASE;
	pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
	ISA_DMA_THRESHOLD = ~0L;
	DMA_MODE_READ = 1;
	DMA_MODE_WRITE = 2;

606
	ppc_md = pmac_md;
607 608 609 610 611 612 613 614 615 616 617

#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
#ifdef CONFIG_BLK_DEV_IDE_PMAC
        ppc_ide_md.ide_init_hwif	= pmac_ide_init_hwif_ports;
        ppc_ide_md.default_io_base	= pmac_ide_get_base;
#endif /* CONFIG_BLK_DEV_IDE_PMAC */
#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */

	if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);

}
618
#endif
619

620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644
/* 
 * Early initialization.
 */
static void __init pmac_init_early(void)
{
#ifdef CONFIG_PPC64
	/* Initialize hash table, from now on, we can take hash faults
	 * and call ioremap
	 */
	hpte_init_native();

	/* Init SCC */
	if (strstr(cmd_line, "sccdbg")) {
		sccdbg = 1;
		udbg_init_scc(NULL);
	}

	/* Setup interrupt mapping options */
	ppc64_interrupt_controller = IC_OPEN_PIC;

	iommu_init_early_u3();
#endif
}

static void __init pmac_progress(char *s, unsigned short hex)
645
{
646 647 648 649 650 651 652 653
#ifdef CONFIG_PPC64
	if (sccdbg) {
		udbg_puts(s);
		udbg_puts("\n");
		return;
	}
#endif
#ifdef CONFIG_BOOTX_TEXT
654 655 656 657 658
	if (boot_text_mapped) {
		btext_drawstring(s);
		btext_drawchar('\n');
	}
#endif /* CONFIG_BOOTX_TEXT */
659
}
660

661 662 663 664 665 666 667 668 669 670
/*
 * pmac has no legacy IO, anything calling this function has to
 * fail or bad things will happen
 */
static int pmac_check_legacy_ioport(unsigned int baseport)
{
	return -ENODEV;
}

static int __init pmac_declare_of_platform_devices(void)
671
{
672
	struct device_node *np, *npp;
673 674 675 676 677 678 679 680 681 682

	np = find_devices("uni-n");
	if (np) {
		for (np = np->child; np != NULL; np = np->sibling)
			if (strncmp(np->name, "i2c", 3) == 0) {
				of_platform_device_create(np, "uni-n-i2c",
							  NULL);
				break;
			}
	}
683 684 685 686 687 688 689
	np = find_devices("valkyrie");
	if (np)
		of_platform_device_create(np, "valkyrie", NULL);
	np = find_devices("platinum");
	if (np)
		of_platform_device_create(np, "platinum", NULL);

690 691 692
	npp = of_find_node_by_name(NULL, "u3");
	if (npp) {
		for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
693
			if (strncmp(np->name, "i2c", 3) == 0) {
694 695
				of_platform_device_create(np, "u3-i2c", NULL);
				of_node_put(np);
696 697
				break;
			}
698 699
		}
		of_node_put(npp);
700
	}
701 702 703 704 705
        np = of_find_node_by_type(NULL, "smu");
        if (np) {
		of_platform_device_create(np, "smu", NULL);
		of_node_put(np);
	}
706 707 708 709 710

	return 0;
}

device_initcall(pmac_declare_of_platform_devices);
711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789

/*
 * Called very early, MMU is off, device-tree isn't unflattened
 */
static int __init pmac_probe(int platform)
{
#ifdef CONFIG_PPC64
	if (platform != PLATFORM_POWERMAC)
		return 0;

	/*
	 * On U3, the DART (iommu) must be allocated now since it
	 * has an impact on htab_initialize (due to the large page it
	 * occupies having to be broken up so the DART itself is not
	 * part of the cacheable linar mapping
	 */
	alloc_u3_dart_table();
#endif

#ifdef CONFIG_PMAC_SMU
	/*
	 * SMU based G5s need some memory below 2Gb, at least the current
	 * driver needs that. We have to allocate it now. We allocate 4k
	 * (1 small page) for now.
	 */
	smu_cmdbuf_abs = lmb_alloc_base(4096, 4096, 0x80000000UL);
#endif /* CONFIG_PMAC_SMU */

	return 1;
}

#ifdef CONFIG_PPC64
static int pmac_probe_mode(struct pci_bus *bus)
{
	struct device_node *node = bus->sysdata;

	/* We need to use normal PCI probing for the AGP bus,
	   since the device for the AGP bridge isn't in the tree. */
	if (bus->self == NULL && device_is_compatible(node, "u3-agp"))
		return PCI_PROBE_NORMAL;

	return PCI_PROBE_DEVTREE;
}
#endif

struct machdep_calls __initdata pmac_md = {
#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
	.cpu_die		= generic_mach_cpu_die,
#endif
	.probe			= pmac_probe,
	.setup_arch		= pmac_setup_arch,
	.init_early		= pmac_init_early,
	.show_cpuinfo		= pmac_show_cpuinfo,
	.show_percpuinfo	= pmac_show_percpuinfo,
	.init_IRQ		= pmac_pic_init,
	.get_irq		= mpic_get_irq,	/* changed later */
	.pcibios_fixup		= pmac_pcibios_fixup,
	.restart		= pmac_restart,
	.power_off		= pmac_power_off,
	.halt			= pmac_halt,
	.time_init		= pmac_time_init,
	.get_boot_time		= pmac_get_boot_time,
	.set_rtc_time		= pmac_set_rtc_time,
	.get_rtc_time		= pmac_get_rtc_time,
	.calibrate_decr		= pmac_calibrate_decr,
	.feature_call		= pmac_do_feature_call,
	.check_legacy_ioport	= pmac_check_legacy_ioport,
	.progress		= pmac_progress,
#ifdef CONFIG_PPC64
	.pci_probe_mode		= pmac_probe_mode,
	.idle_loop		= native_idle,
	.enable_pmcs		= power4_enable_pmcs,
#endif
#ifdef CONFIG_PPC32
	.pcibios_enable_device_hook = pmac_pci_enable_device_hook,
	.pcibios_after_init	= pmac_pcibios_after_init,
	.phys_mem_access_prot	= pci_phys_mem_access_prot,
#endif
};