coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ramstage.c
Go to the documentation of this file.
1
/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3
#include <
bootstate.h
>
4
#include <arch/mmio.h>
5
#include <
delay.h
>
6
#include <
bootmode.h
>
7
#include <
device/device.h
>
8
#include <
device/pci.h
>
9
#include <soc/pci_devs.h>
10
#include <
drivers/intel/gma/i915_reg.h
>
11
12
static
void
panel_power_on
(
uintptr_t
igd_bar)
13
{
14
setbits32
((
void
*)(igd_bar +
PCH_PP_CONTROL
),
PANEL_POWER_ON
);
15
}
16
17
static
void
panel_reset_assert
(
uintptr_t
igd_bar)
18
{
19
clrsetbits32
((
void
*)(igd_bar +
PCH_GPIOB
),
20
GPIO_CLOCK_VAL_OUT
,
21
GPIO_CLOCK_DIR_MASK
|
GPIO_CLOCK_DIR_OUT
|
GPIO_CLOCK_VAL_MASK
);
22
}
23
24
static
void
panel_reset_deassert
(
uintptr_t
igd_bar)
25
{
26
const
uint32_t
data32 =
GPIO_CLOCK_VAL_OUT
|
27
GPIO_CLOCK_DIR_MASK
|
GPIO_CLOCK_DIR_OUT
|
GPIO_CLOCK_VAL_MASK
;
28
setbits32
((
void
*)(igd_bar +
PCH_GPIOB
), data32);
29
}
30
31
/*
32
* Bugzzy uses panel-built-in touch screen, it needs to set panel power and
33
* reset signal to high for touch screen to work.
34
* On user mode, coreboot doesn't initialize graphics since there is no screen
35
* display before OS. We would add this WA to initialize required signals on
36
* user mode.
37
*/
38
static
void
wa_init_display_signal
(
void
*unused)
39
{
40
struct
device
*igd_dev =
pcidev_path_on_root
(
SA_DEVFN_IGD
);
41
uintptr_t
igd_bar;
42
43
if
(
display_init_required
() || !igd_dev)
44
return
;
45
46
igd_bar =
find_resource
(igd_dev,
PCI_BASE_ADDRESS_0
)->
base
;
47
if
(!igd_bar)
48
return
;
49
50
panel_power_on
(igd_bar);
51
mdelay
(20);
52
panel_reset_deassert
(igd_bar);
53
mdelay
(2);
54
panel_reset_assert
(igd_bar);
55
mdelay
(2);
56
panel_reset_deassert
(igd_bar);
57
}
58
59
BOOT_STATE_INIT_ENTRY
(
BS_POST_DEVICE
,
BS_ON_ENTRY
,
wa_init_display_signal
,
NULL
);
bootmode.h
display_init_required
int display_init_required(void)
Definition:
bootmode.c:22
bootstate.h
BS_POST_DEVICE
@ BS_POST_DEVICE
Definition:
bootstate.h:84
BS_ON_ENTRY
@ BS_ON_ENTRY
Definition:
bootstate.h:95
delay.h
mdelay
void mdelay(unsigned int msecs)
Definition:
delay.c:2
pcidev_path_on_root
DEVTREE_CONST struct device * pcidev_path_on_root(pci_devfn_t devfn)
Definition:
device_const.c:255
find_resource
struct resource * find_resource(const struct device *dev, unsigned int index)
Return an existing resource structure for a given index.
Definition:
device_util.c:394
BOOT_STATE_INIT_ENTRY
BOOT_STATE_INIT_ENTRY(BS_DEV_INIT, BS_ON_EXIT, init_store, NULL)
i915_reg.h
PCH_GPIOB
#define PCH_GPIOB
Definition:
i915_reg.h:3317
GPIO_CLOCK_VAL_MASK
#define GPIO_CLOCK_VAL_MASK
Definition:
i915_reg.h:812
GPIO_CLOCK_DIR_MASK
#define GPIO_CLOCK_DIR_MASK
Definition:
i915_reg.h:809
PCH_PP_CONTROL
#define PCH_PP_CONTROL
Definition:
i915_reg.h:3754
GPIO_CLOCK_DIR_OUT
#define GPIO_CLOCK_DIR_OUT
Definition:
i915_reg.h:811
PANEL_POWER_ON
#define PANEL_POWER_ON
Definition:
i915_reg.h:3761
GPIO_CLOCK_VAL_OUT
#define GPIO_CLOCK_VAL_OUT
Definition:
i915_reg.h:813
device.h
setbits32
#define setbits32(addr, set)
Definition:
mmio.h:21
clrsetbits32
#define clrsetbits32(addr, clear, set)
Definition:
mmio.h:16
panel_reset_deassert
static void panel_reset_deassert(uintptr_t igd_bar)
Definition:
ramstage.c:24
wa_init_display_signal
static void wa_init_display_signal(void *unused)
Definition:
ramstage.c:38
panel_reset_assert
static void panel_reset_assert(uintptr_t igd_bar)
Definition:
ramstage.c:17
panel_power_on
static void panel_power_on(uintptr_t igd_bar)
Definition:
ramstage.c:12
pci.h
PCI_BASE_ADDRESS_0
#define PCI_BASE_ADDRESS_0
Definition:
pci_def.h:63
SA_DEVFN_IGD
#define SA_DEVFN_IGD
Definition:
pci_devs.h:32
NULL
#define NULL
Definition:
stddef.h:19
uint32_t
unsigned int uint32_t
Definition:
stdint.h:14
uintptr_t
unsigned long uintptr_t
Definition:
stdint.h:21
device
Definition:
device.h:107
resource::base
resource_t base
Definition:
resource.h:45
src
mainboard
google
dedede
variants
bugzzy
ramstage.c
Generated by
1.9.1