arch/x86/kernel/devicetree.c

Source file repositories/reference/linux-study-clean/arch/x86/kernel/devicetree.c

File Facts

System
Linux kernel
Corpus path
arch/x86/kernel/devicetree.c
Extension
.c
Size
7902 bytes
Lines
367
Domain
Architecture Layer
Bucket
arch/x86
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

device_initcall(add_bus_probe);

#ifdef CONFIG_PCI
struct device_node *pcibios_get_phb_of_node(struct pci_bus *bus)
{
	struct device_node *np;

	for_each_node_by_type(np, "pci") {
		const void *prop;
		unsigned int bus_min;

		prop = of_get_property(np, "bus-range", NULL);
		if (!prop)
			continue;
		bus_min = be32_to_cpup(prop);
		if (bus->number == bus_min)
			return np;
	}
	return NULL;
}

static int x86_of_pci_irq_enable(struct pci_dev *dev)
{
	u32 virq;
	int ret;
	u8 pin;

	ret = pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
	if (ret)
		return pcibios_err_to_errno(ret);
	if (!pin)
		return 0;

	virq = of_irq_parse_and_map_pci(dev, 0, 0);
	if (virq == 0)
		return -EINVAL;
	dev->irq = virq;
	return 0;
}

static void x86_of_pci_irq_disable(struct pci_dev *dev)
{
}

void x86_of_pci_init(void)
{
	pcibios_enable_irq = x86_of_pci_irq_enable;
	pcibios_disable_irq = x86_of_pci_irq_disable;
}
#endif

static void __init dtb_setup_hpet(void)
{
#ifdef CONFIG_HPET_TIMER
	struct device_node *dn;
	struct resource r;
	int ret;

	dn = of_find_compatible_node(NULL, NULL, "intel,ce4100-hpet");
	if (!dn)
		return;
	ret = of_address_to_resource(dn, 0, &r);
	if (ret) {
		WARN_ON(1);
		return;
	}
	hpet_address = r.start;
#endif
}

#if defined(CONFIG_X86_64) && defined(CONFIG_SMP)

#define WAKEUP_MAILBOX_SIZE	0x1000
#define WAKEUP_MAILBOX_ALIGN	0x1000

/** dtb_wakeup_mailbox_setup() - Parse the wakeup mailbox from the device tree
 *
 * Look for the presence of a wakeup mailbox in the DeviceTree. The mailbox is
 * expected to follow the structure and operation described in the Multiprocessor
 * Wakeup Structure of the ACPI specification.
 */
static void __init dtb_wakeup_mailbox_setup(void)
{
	struct device_node *node;
	struct resource res;

	node = of_find_compatible_node(NULL, NULL, "intel,wakeup-mailbox");
	if (!node)
		return;

Annotation

Implementation Notes