coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
soc.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <bootmode.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <soc/nvidia/tegra/dc.h>
7 #include <soc/display.h>
8 #include <soc/sdram.h>
9 #include <symbols.h>
10 
11 #include "chip.h"
12 
13 /* this sucks, but for now, fb size/location are hardcoded.
14  * Will break if we get 2. Sigh.
15  * We assume it's all multiples of MiB for MMUs sake.
16  */
17 static void soc_read_resources(struct device *dev)
18 {
19  u32 lcdbase = fb_base_mb();
20  unsigned long fb_size = FB_SIZE_MB;
21 
23  (sdram_max_addressable_mb() - fb_size)*KiB -
25  mmio_resource(dev, 1, lcdbase*KiB, fb_size*KiB);
26 
27  u32 sdram_end_mb = sdram_size_mb() + (uintptr_t)_dram/MiB;
28 
29  if (sdram_end_mb > sdram_max_addressable_mb())
31  (sdram_end_mb - sdram_max_addressable_mb())*KiB);
32 }
33 
34 static void soc_init(struct device *dev)
35 {
37  display_startup(dev);
38  else
39  printk(BIOS_INFO, "Skipping display init.\n");
40  printk(BIOS_INFO, "CPU: Tegra124\n");
41 }
42 
43 static struct device_operations soc_ops = {
45  .set_resources = noop_set_resources,
46  .init = soc_init,
47 };
48 
49 static void enable_tegra124_dev(struct device *dev)
50 {
51  dev->ops = &soc_ops;
52 }
53 
55  CHIP_NAME("SOC Nvidia Tegra124")
56  .enable_dev = enable_tegra124_dev,
57 };
int display_init_required(void)
Definition: bootmode.c:22
#define MiB
Definition: helpers.h:76
#define KiB
Definition: helpers.h:75
size_t sdram_size_mb(void)
Definition: sdram.c:24
#define printk(level,...)
Definition: stdlib.h:16
unsigned int fb_base_mb(void)
Definition: display.c:190
static void display_startup(void)
Definition: mainboard.c:207
#define CHIP_NAME(X)
Definition: device.h:32
static void noop_set_resources(struct device *dev)
Definition: device.h:74
#define ram_resource(dev, idx, basek, sizek)
Definition: device.h:321
#define mmio_resource(dev, idx, basek, sizek)
Definition: device.h:334
u8 _dram[]
#define BIOS_INFO
BIOS_INFO - Expected events.
Definition: loglevel.h:113
uintptr_t sdram_max_addressable_mb(void)
Definition: sdram.c:630
struct chip_operations soc_nvidia_tegra124_ops
Definition: soc.c:54
static void soc_read_resources(struct device *dev)
Definition: soc.c:17
static struct device_operations soc_ops
Definition: soc.c:43
static void enable_tegra124_dev(struct device *dev)
Definition: soc.c:49
static void soc_init(struct device *dev)
Definition: soc.c:34
#define FB_SIZE_MB
Definition: display.h:11
uint32_t u32
Definition: stdint.h:51
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