arch/powerpc/platforms/pasemi/setup.c

Source file repositories/reference/linux-study-clean/arch/powerpc/platforms/pasemi/setup.c

File Facts

System
Linux kernel
Corpus path
arch/powerpc/platforms/pasemi/setup.c
Extension
.c
Size
10748 bytes
Lines
457
Domain
Architecture Layer
Bucket
arch/powerpc
Inferred role
Architecture Layer: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

struct mce_regs {
	char *name;
	void __iomem *addr;
};

static struct mce_regs mce_regs[MAX_MCE_REGS];
static int num_mce_regs;
static int nmi_virq = 0;


static void __noreturn pas_restart(char *cmd)
{
	/* Need to put others cpu in hold loop so they're not sleeping */
	smp_send_stop();
	udelay(10000);
	printk("Restarting...\n");
	while (1)
		out_le32(reset_reg, 0x6000000);
}

#ifdef CONFIG_PPC_PASEMI_NEMO
static void pas_shutdown(void)
{
	/* Set the PLD bit that makes the SB600 think the power button is being pressed */
	void __iomem *pld_map = ioremap(0xf5000000,4096);
	while (1)
		out_8(pld_map+7,0x01);
}

/* RTC platform device structure as is not in device tree */
static struct resource rtc_resource[] = {{
	.name = "rtc",
	.start = 0x70,
	.end = 0x71,
	.flags = IORESOURCE_IO,
}, {
	.name = "rtc",
	.start = 8,
	.end = 8,
	.flags = IORESOURCE_IRQ,
}};

static inline void nemo_init_rtc(void)
{
	platform_device_register_simple("rtc_cmos", -1, rtc_resource, 2);
}

#else

static inline void nemo_init_rtc(void)
{
}
#endif

#ifdef CONFIG_SMP
static arch_spinlock_t timebase_lock;
static unsigned long timebase;

static void pas_give_timebase(void)
{
	unsigned long flags;

	local_irq_save(flags);
	hard_irq_disable();
	arch_spin_lock(&timebase_lock);
	mtspr(SPRN_TBCTL, TBCTL_FREEZE);
	isync();
	timebase = get_tb();
	arch_spin_unlock(&timebase_lock);

	while (timebase)
		barrier();
	mtspr(SPRN_TBCTL, TBCTL_RESTART);
	local_irq_restore(flags);
}

static void pas_take_timebase(void)
{
	while (!timebase)
		smp_rmb();

	arch_spin_lock(&timebase_lock);
	set_tb(timebase >> 32, timebase & 0xffffffff);
	timebase = 0;
	arch_spin_unlock(&timebase_lock);
}

static struct smp_ops_t pas_smp_ops = {
	.probe		= smp_mpic_probe,
	.message_pass	= smp_mpic_message_pass,

Annotation

Implementation Notes