Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ VERSION?=$(DATE)_$(REV)
all: $(BUILD)/ec.rom
$(info Built $(VERSION) for $(BOARD))

CFLAGS = -Isrc/

# Include common source
COMMON_DIR=src/common
INCLUDE += $(COMMON_DIR)/common.mk
CFLAGS=-I$(COMMON_DIR)/include -D__FIRMWARE_VERSION__=$(VERSION)
CFLAGS += -I$(COMMON_DIR)/include -D__FIRMWARE_VERSION__=$(VERSION)
include $(COMMON_DIR)/common.mk
SRC += $(foreach src, $(common-y), $(COMMON_DIR)/$(src))

Expand All @@ -51,6 +53,8 @@ CFLAGS+=-I$(EC_DIR)/include
include $(EC_DIR)/ec.mk
SRC += $(foreach src, $(ec-y), $(EC_DIR)/$(src))

include src/drivers/Makefile.mk

# The EC will define the architecture
# Include the architecture's source
ARCH_DIR=src/arch/$(ARCH)
Expand Down
17 changes: 11 additions & 6 deletions docs/security.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# Firmware security

The firmware security feature can be configured by setting `CONFIG_SECURITY=1`
in the `src/board/system76/[board]/board.mk` file. This feature prevents
in the `src/board/system76/<board>/board.mk` file. This feature prevents
programming the EC firmware at runtime, unless the EC is unlocked with the
`system76-ectool security unlock` command. After this, on the next reboot, the
EC will respond to the SPI and reset commands. On boards where the `ME_WE` GPIO
exists, it will be set high when the EC security state is unlocked.
EC will respond to the SPI and reset commands.

This feature will drive the `ME_WE` pin high when the state is unlocked. On
Intel hosts, this pin is connected to `HDA_SDO` and will disable security
policies set in the flash descriptor.

- `HDA_SDO`: Flash Descriptor Security Override

Other firmware components can use this state to perform their own locking and
unlocking primitives. For example, in `coreboot`, flash regions may be locked
when the EC security state is locked. In `EDK2`, a physical presence dialog may
be shown when the EC security state is unlocked.
unlocking primitives. For example, in coreboot, flash regions may be locked
when the EC security state is locked. In the UEFI payload, a physical presence
dialog may be shown when the EC security state is unlocked.
4 changes: 2 additions & 2 deletions src/board/system76/addw1/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/addw2/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/addw3/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ CONFIG_POWER_LIMIT_AC = 280
CONFIG_POWER_LIMIT_DC = 55

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/addw4/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ CONFIG_POWER_LIMIT_AC = 230
CONFIG_POWER_LIMIT_DC = 45

# Enable DGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/bonw14/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
9 changes: 4 additions & 5 deletions src/board/system76/bonw15-b/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,16 @@ CONFIG_CHARGER_CHARGE_VOLTAGE = 17400
CONFIG_CHARGER_INPUT_CURRENT = 16920

# Set USB-PD parameters
CONFIG_HAVE_USBPD = y
CONFIG_USBPD_TPS65987 = y
CONFIG_I2C_USBPD = I2C_1
CONFIG_DRIVERS_USBPD_TPS65987 = y
CONFIG_USBPD_I2C = 1

# Set CPU power limits in watts
CONFIG_POWER_LIMIT_AC = 330
CONFIG_POWER_LIMIT_DC = 55

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
9 changes: 4 additions & 5 deletions src/board/system76/bonw15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ CONFIG_CHARGER_CHARGE_VOLTAGE = 17400
CONFIG_CHARGER_INPUT_CURRENT = 16920

# Set USB-PD parameters
CONFIG_HAVE_USBPD = y
CONFIG_USBPD_TPS65987 = y
CONFIG_I2C_USBPD = I2C_1
CONFIG_DRIVERS_USBPD_TPS65987 = y
CONFIG_USBPD_I2C = 1

# Set CPU power limits in watts
CONFIG_POWER_LIMIT_AC = 330
CONFIG_POWER_LIMIT_DC = 55

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
2 changes: 1 addition & 1 deletion src/board/system76/common/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

#include <board/acpi.h>
#include <board/battery.h>
#include <board/dgpu.h>
#include <board/fan.h>
#include <board/gpio.h>
#include <board/kbled.h>
#include <board/lid.h>
#include <board/pwm.h>
#include <common/debug.h>
#include <common/macro.h>
#include <drivers/dgpu/dgpu.h>

#if CONFIG_PLATFORM_INTEL
#include <board/peci.h>
Expand Down
18 changes: 0 additions & 18 deletions src/board/system76/common/common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
board-common-y += acpi.c
board-common-y += battery.c
board-common-y += config.c
board-common-$(CONFIG_HAVE_DGPU) += dgpu.c
board-common-y += ecpm.c
board-common-$(CONFIG_BUS_ESPI) += espi.c
board-common-y += fan.c
Expand All @@ -19,7 +18,6 @@ board-common-y += pnp.c
board-common-y += ps2.c
board-common-y += pwm.c
board-common-y += scratch.c
board-common-$(CONFIG_SECURITY) += security.c
board-common-y += smbus.c
board-common-y += smfi.c
board-common-y += stdio.c
Expand All @@ -41,10 +39,6 @@ CFLAGS += -DI2C_SMBUS=$(CONFIG_I2C_SMBUS)
# Uncomment to enable I2C debug on 0x76
#CFLAGS+=-DI2C_DEBUGGER=0x76

ifeq ($(CONFIG_SECURITY),y)
CFLAGS+=-DCONFIG_SECURITY=1
endif

ifeq ($(CONFIG_PLATFORM_INTEL),y)
board-common-y += peci.c
board-common-y += power/intel.c
Expand All @@ -69,11 +63,6 @@ CFLAGS += -DCONFIG_PECI_OVER_ESPI=1
endif
endif

ifeq ($(CONFIG_HAVE_DGPU),y)
CFLAGS += -DCONFIG_HAVE_DGPU=1
CFLAGS += -DI2C_DGPU=$(CONFIG_I2C_DGPU)
endif

# Include system76 common source
SYSTEM76_COMMON_DIR=src/board/system76/common
INCLUDE += $(SYSTEM76_COMMON_DIR)/common.mk
Expand Down Expand Up @@ -117,13 +106,6 @@ CFLAGS += -DCHARGER_PSYS_GAIN=$(CONFIG_CHARGER_PSYS_GAIN)
endif
endif

# Add USB-PD
ifeq ($(CONFIG_HAVE_USBPD),y)
CFLAGS += -DCONFIG_HAVE_USBPD=1
board-common-$(CONFIG_USBPD_TPS65987) += usbpd/tps65987.c
CFLAGS += -DI2C_USBPD=$(CONFIG_I2C_USBPD)
endif

# Add keyboard
ifndef KEYBOARD
$(error KEYBOARD is not set by the board)
Expand Down
2 changes: 1 addition & 1 deletion src/board/system76/common/fan.c
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/fan.h>
#include <board/dgpu.h>
#include <board/power.h>
#include <common/debug.h>
#include <common/macro.h>
#include <drivers/dgpu/dgpu.h>
#include <ec/pwm.h>

#if CONFIG_PLATFORM_INTEL
Expand Down
13 changes: 0 additions & 13 deletions src/board/system76/common/include/board/security.h

This file was deleted.

6 changes: 3 additions & 3 deletions src/board/system76/common/kbled/bonw14.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@
void kbled_init(void) {
kbled_kind = KBLED_RGB;

i2c_reset(&I2C_DGPU, true);
i2c_reset(&DGPU_I2C, true);

// Force SMBUS B design to 100kHZ
SCLKTSB = 0b10;
}

void kbled_reset(void) {
uint8_t value = 0xE4;
int16_t res = i2c_set(&I2C_DGPU, 0x2D, 0xA0, &value, 1);
int16_t res = i2c_set(&DGPU_I2C, 0x2D, 0xA0, &value, 1);
DEBUG("kbled_reset 0x2D: %d\n", res);

//value = 0xC4;
//res = i2c_set(&I2C_DGPU, 0x66, 0xA0, &value, 1);
//res = i2c_set(&DGPU_I2C, 0x66, 0xA0, &value, 1);
//DEBUG("kbled_reset 0x66: %d\n", res);

// Set brightness and color
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/common/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include <arch/time.h>
#include <board/battery.h>
#include <board/board.h>
#include <board/dgpu.h>
#include <board/ecpm.h>
#include <board/fan.h>
#include <board/gpio.h>
Expand All @@ -24,10 +23,11 @@
#include <board/pwm.h>
#include <board/smbus.h>
#include <board/smfi.h>
#include <board/usbpd.h>
#include <common/debug.h>
#include <common/macro.h>
#include <common/version.h>
#include <drivers/dgpu/dgpu.h>
#include <drivers/usbpd/usbpd.h>
#include <ec/ec.h>

#if CONFIG_PLATFORM_INTEL
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/common/power/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
#include <board/pmc.h>
#include <board/pnp.h>
#include <board/wireless.h>
#include <board/usbpd.h>
#include <common/debug.h>
#include <drivers/usbpd/usbpd.h>

#if CONFIG_BUS_ESPI
#include <ec/espi.h>
#include <board/espi.h>
#endif

#if CONFIG_SECURITY
#include <board/security.h>
#include <drivers/security/security.h>
#endif // CONFIG_SECURITY

#define GPIO_SET_DEBUG(G, V) \
Expand Down
2 changes: 1 addition & 1 deletion src/board/system76/common/scratch.c
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: GPL-3.0-only

#include <board/dgpu.h>
#include <board/fan.h>
#include <board/smfi.h>
#include <common/macro.h>
#include <drivers/dgpu/dgpu.h>
#include <ec/pwm.h>
#include <ec/scratch.h>

Expand Down
2 changes: 1 addition & 1 deletion src/board/system76/common/smfi.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <board/scratch.h>

#if CONFIG_SECURITY
#include <board/security.h>
#include <drivers/security/security.h>
#endif // CONFIG_SECURITY
#endif // !defined(__SCRATCH__)

Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/galp5/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ CONFIG_POWER_LIMIT_AC = 65
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/gaze15/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/gaze16-3050/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/gaze16-3060-b/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/gaze16-3060/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
4 changes: 2 additions & 2 deletions src/board/system76/gaze17-3050/board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ CONFIG_POWER_LIMIT_AC = 180
CONFIG_POWER_LIMIT_DC = 45

# Enable dGPU support
CONFIG_HAVE_DGPU = y
CONFIG_I2C_DGPU = I2C_1
CONFIG_DRIVERS_DGPU_NVIDIA = y
CONFIG_DGPU_I2C = 1

# Fan configs
CONFIG_FAN1_PWM = DCR2
Expand Down
Loading