📄 setup.c
字号:
/* Check for Core99 */ ic = of_find_node_by_name(NULL, "uni-n"); if (!ic) ic = of_find_node_by_name(NULL, "u3"); if (!ic) ic = of_find_node_by_name(NULL, "u4"); if (ic) { of_node_put(ic); smp_ops = &core99_smp_ops; }#ifdef CONFIG_PPC32 else { /* * We have to set bits in cpu_possible_map here since the * secondary CPU(s) aren't in the device tree, and * setup_per_cpu_areas only allocates per-cpu data for * CPUs in the cpu_possible_map. */ int cpu; for (cpu = 1; cpu < 4 && cpu < NR_CPUS; ++cpu) cpu_set(cpu, cpu_possible_map); smp_ops = &psurge_smp_ops; }#endif#endif /* CONFIG_SMP */#ifdef CONFIG_ADB if (strstr(cmd_line, "adb_sync")) { extern int __adb_probe_sync; __adb_probe_sync = 1; }#endif /* CONFIG_ADB */}#ifdef CONFIG_SCSIvoid note_scsi_host(struct device_node *node, void *host){}EXPORT_SYMBOL(note_scsi_host);#endifstatic int initializing = 1;static int pmac_late_init(void){ if (!machine_is(powermac)) return -ENODEV; initializing = 0; /* this is udbg (which is __init) and we can later use it during * cpu hotplug (in smp_core99_kick_cpu) */ ppc_md.progress = NULL; return 0;}late_initcall(pmac_late_init);/* * This is __init_refok because we check for "initializing" before * touching any of the __init sensitive things and "initializing" * will be false after __init time. This can't be __init because it * can be called whenever a disk is first accessed. */void __init_refok note_bootable_part(dev_t dev, int part, int goodness){ char *p; if (!initializing) return; if ((goodness <= current_root_goodness) && ROOT_DEV != DEFAULT_ROOT_DEVICE) return; p = strstr(boot_command_line, "root="); if (p != NULL && (p == boot_command_line || p[-1] == ' ')) return; ROOT_DEV = dev + part; current_root_goodness = goodness;}#ifdef CONFIG_ADB_CUDAstatic void cuda_restart(void){ struct adb_request req; 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()#endifstatic void pmac_restart(char *cmd){ switch (sys_ctrler) { case SYS_CTRLER_CUDA: cuda_restart(); break; case SYS_CTRLER_PMU: pmu_restart(); break; case SYS_CTRLER_SMU: smu_restart(); break; default: ; }}static void pmac_power_off(void){ switch (sys_ctrler) { case SYS_CTRLER_CUDA: cuda_shutdown(); break; case SYS_CTRLER_PMU: pmu_shutdown(); break; case SYS_CTRLER_SMU: smu_shutdown(); break; default: ; }}static voidpmac_halt(void){ pmac_power_off();}/* * Early initialization. */static void __init pmac_init_early(void){ /* Enable early btext debug if requested */ if (strstr(cmd_line, "btextdbg")) { udbg_adb_init_early(); register_early_udbg_console(); } /* Probe motherboard chipset */ pmac_feature_init(); /* Initialize debug stuff */ udbg_scc_init(!!strstr(cmd_line, "sccdbg")); udbg_adb_init(!!strstr(cmd_line, "btextdbg"));#ifdef CONFIG_PPC64 iommu_init_early_dart();#endif}static int __init pmac_declare_of_platform_devices(void){ struct device_node *np; if (machine_is(chrp)) return -1; if (!machine_is(powermac)) return 0; np = of_find_node_by_name(NULL, "valkyrie"); if (np) of_platform_device_create(np, "valkyrie", NULL); np = of_find_node_by_name(NULL, "platinum"); if (np) of_platform_device_create(np, "platinum", NULL); np = of_find_node_by_type(NULL, "smu"); if (np) { of_platform_device_create(np, "smu", NULL); of_node_put(np); } return 0;}device_initcall(pmac_declare_of_platform_devices);/* * Called very early, MMU is off, device-tree isn't unflattened */static int __init pmac_probe(void){ unsigned long root = of_get_flat_dt_root(); if (!of_flat_dt_is_compatible(root, "Power Macintosh") && !of_flat_dt_is_compatible(root, "MacRISC")) return 0;#ifdef CONFIG_PPC64 /* * 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_dart_table(); hpte_init_native();#endif#ifdef CONFIG_PPC32 /* isa_io_base gets set in pmac_pci_init */ ISA_DMA_THRESHOLD = ~0L; DMA_MODE_READ = 1; DMA_MODE_WRITE = 2;#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) */#endif /* CONFIG_PPC32 */#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/* Move that to pci.c */static int pmac_pci_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 && (of_device_is_compatible(node, "u3-agp") || of_device_is_compatible(node, "u4-pcie"))) return PCI_PROBE_NORMAL; return PCI_PROBE_DEVTREE;}#ifdef CONFIG_HOTPLUG_CPU/* access per cpu vars from generic smp.c */DECLARE_PER_CPU(int, cpu_state);static void pmac_cpu_die(void){ /* * turn off as much as possible, we'll be * kicked out as this will only be invoked * on core99 platforms for now ... */ printk(KERN_INFO "CPU#%d offline\n", smp_processor_id()); __get_cpu_var(cpu_state) = CPU_DEAD; smp_wmb(); /* * during the path that leads here preemption is disabled, * reenable it now so that when coming up preempt count is * zero correctly */ preempt_enable(); /* * hard-disable interrupts for the non-NAP case, the NAP code * needs to re-enable interrupts (but soft-disables them) */ hard_irq_disable(); while (1) { /* let's not take timer interrupts too often ... */ set_dec(0x7fffffff); /* should always be true at this point */ if (cpu_has_feature(CPU_FTR_CAN_NAP)) power4_cpu_offline_powersave(); else { HMT_low(); HMT_very_low(); } }}#endif /* CONFIG_HOTPLUG_CPU */#endif /* CONFIG_PPC64 */define_machine(powermac) { .name = "PowerMac", .probe = pmac_probe, .setup_arch = pmac_setup_arch, .init_early = pmac_init_early, .show_cpuinfo = pmac_show_cpuinfo, .init_IRQ = pmac_pic_init, .get_irq = NULL, /* changed later */ .pci_irq_fixup = pmac_pci_irq_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, .progress = udbg_progress,#ifdef CONFIG_PPC64 .pci_probe_mode = pmac_pci_probe_mode, .power_save = power4_idle, .enable_pmcs = power4_enable_pmcs,#ifdef CONFIG_KEXEC .machine_kexec = default_machine_kexec, .machine_kexec_prepare = default_machine_kexec_prepare, .machine_crash_shutdown = default_machine_crash_shutdown,#endif#endif /* CONFIG_PPC64 */#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#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64) .cpu_die = pmac_cpu_die,#endif};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -