coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ioapic.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <device/device.h>
4 #include "chip.h"
5 #include <arch/ioapic.h>
6 
7 static void ioapic_init(struct device *dev)
8 {
10 
11  if (!dev->enabled || !config)
12  return;
13 
14  setup_ioapic(config->base, config->apicid);
15 }
16 
17 static void ioapic_read_resources(struct device *dev)
18 {
20  struct resource *res;
21 
22  res = new_resource(dev, 0);
23  res->base = (resource_t)(uintptr_t)config->base;
24  res->size = 0x1000;
26 }
27 
28 static struct device_operations ioapic_operations = {
30  .set_resources = noop_set_resources,
31  .init = ioapic_init,
32 };
33 
34 static void enable_dev(struct device *dev)
35 {
36  dev->ops = &ioapic_operations;
37 }
38 
40  CHIP_NAME("IOAPIC")
41  .enable_dev = enable_dev,
42 };
void setup_ioapic(void *ioapic_base, u8 ioapic_id)
Definition: ioapic.c:160
struct resource * new_resource(struct device *dev, unsigned int index)
See if a resource structure already exists for a given index and if not allocate one.
Definition: device_util.c:346
static struct device_operations ioapic_operations
Definition: ioapic.c:28
static void enable_dev(struct device *dev)
Definition: ioapic.c:34
struct chip_operations drivers_generic_ioapic_ops
Definition: ioapic.c:39
static void ioapic_read_resources(struct device *dev)
Definition: ioapic.c:17
static void ioapic_init(struct device *dev)
Definition: ioapic.c:7
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_set_resources(struct device *dev)
Definition: device.h:74
enum board_config config
Definition: memory.c:448
#define IORESOURCE_MEM
Definition: resource.h:10
#define IORESOURCE_ASSIGNED
Definition: resource.h:34
u64 resource_t
Definition: resource.h:43
#define IORESOURCE_FIXED
Definition: resource.h:36
unsigned long uintptr_t
Definition: stdint.h:21
void(* read_resources)(struct device *dev)
Definition: device.h:39
Definition: device.h:107
struct device_operations * ops
Definition: device.h:143
DEVTREE_CONST void * chip_info
Definition: device.h:164
unsigned int enabled
Definition: device.h:122
resource_t base
Definition: resource.h:45