Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17056
-gerrit
commit d6ba0c232d59fd935e252b96271d00ba2eb9cb66
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Tue Oct 18 14:25:25 2016 -0700
intel/skylake: Add support to enable wake-on-usb attach/detach
Three things are required to enable wake-on-usb:
1. 5V to USB ports should be enabled in S3.
2. ASL file needs to have appropriate wake bit set.
3. XHCI controller should have the wake on attach/detach bit set for the
corresponding port in PORTSCN register.
Only part missing was #3.
This CL adds support to allow mainboard to define a bitmap in
devicetree corresponding to the ports that it wants to enable
wake-on-usb feature. Based on the bitmap, wake on attach/detach bits in
PORTSCN would be set by xhci.asl for the appropriate ports.
BUG=chrome-os-partner:58734
BRANCH=None
TEST=Verified that with port 5 enabled, chell wakes up from S3 on usb
attach/detach.
Change-Id: I40a22a450e52f74a0ab93ebb8170555d834ebdaf
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/soc/intel/skylake/acpi.c | 4 +++
src/soc/intel/skylake/acpi/globalnvs.asl | 2 ++
src/soc/intel/skylake/acpi/xhci.asl | 51 ++++++++++++++++++++++++++++++++
src/soc/intel/skylake/chip.h | 6 ++++
src/soc/intel/skylake/include/soc/nvs.h | 4 ++-
src/soc/intel/skylake/include/soc/usb.h | 7 +++++
6 files changed, 73 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index 28a0a6e..d83c74b 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -198,6 +198,10 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
/* Fill in the Wifi Region id */
gnvs->cid1 = wifi_regulatory_domain();
+
+ /* Set USB2/USB3 wake enable bitmaps. */
+ gnvs->u2we = config->usb2_wake_enable_bitmap;
+ gnvs->u3we = config->usb3_wake_enable_bitmap;
}
unsigned long acpi_fill_mcfg(unsigned long current)
diff --git a/src/soc/intel/skylake/acpi/globalnvs.asl b/src/soc/intel/skylake/acpi/globalnvs.asl
index 2bff7d3..ab3c63c 100644
--- a/src/soc/intel/skylake/acpi/globalnvs.asl
+++ b/src/soc/intel/skylake/acpi/globalnvs.asl
@@ -64,6 +64,8 @@ Field (GNVS, ByteAcc, NoLock, Preserve)
NHLA, 64, // 0x31 - NHLT Address
NHLL, 32, // 0x39 - NHLT Length
CID1, 16, // 0x3d - Wifi Country Identifier
+ U2WE, 16, // 0x3f - USB2 Wake Enable Bitmap
+ U3WE, 8, // 0x41 - USB3 Wake Enable Bitmap
/* ChromeOS specific */
Offset (0x100),
diff --git a/src/soc/intel/skylake/acpi/xhci.asl b/src/soc/intel/skylake/acpi/xhci.asl
index 1a1c6e3..96f3b6a 100644
--- a/src/soc/intel/skylake/acpi/xhci.asl
+++ b/src/soc/intel/skylake/acpi/xhci.asl
@@ -15,6 +15,55 @@
* GNU General Public License for more details.
*/
+/*
+ * USB Port Wake Enable (UPWE) on usb attach/detach
+ * Arg0 - Port Number
+ * Arg1 - Port 1 Status and control offset
+ * Arg2 - xHCI Memory-mapped address
+ */
+Method (UPWE, 3, Serialized)
+{
+ /* Local0 = Arg1 + ((Arg0 - 1) * 0x10) */
+ Add (Arg1, Multiply (Subtract (Arg0, 1), 0x10), Local0)
+
+ /* Map ((XMEM << 16) + Local0 in PSCR */
+ OperationRegion (PSCR, SystemMemory,
+ Add (ShiftLeft (Arg2, 16), Local0), 0x10)
+ Field (PSCR, AnyAcc, NoLock, Preserve)
+ {
+ , 25,
+ UPCE, 1,
+ UPDE, 1,
+ }
+ Store (One, UPCE)
+ Store (One, UPDE)
+}
+
+/*
+ * USB Wake Enable Setup (UWES)
+ * Arg0 - Port enable bitmap
+ * Arg1 - Port 1 Status and control offset
+ * Arg2 - xHCI Memory-mapped address
+ */
+Method (UWES, 3, Serialized)
+{
+ Store (Arg0, Local0)
+
+ While (One) {
+ FindSetRightBit (Local0, Local1)
+ If (LEqual (Local1, Zero)) {
+ Break
+ }
+ UPWE (Local1, Arg1, Arg2)
+ /*
+ * Clear the lowest set bit in Local0 since it was
+ * processed.
+ * Local0 = Local0 & (Local0 - 1)
+ */
+ And (Local0, Subtract (Local0, 1), Local0)
+ }
+}
+
/* XHCI Controller 0:14.0 */
Device (XHCI)
@@ -26,6 +75,8 @@ Device (XHCI)
Method (_DSW, 3)
{
Store (Arg0, PMEE)
+ UWES (And (\U2WE, 0x3FF), 0x480, XMEM)
+ UWES (And (\U3WE, 0x3F), 0x540, XMEM)
}
Name (_S3D, 3) /* D3 supported in S3 */
diff --git a/src/soc/intel/skylake/chip.h b/src/soc/intel/skylake/chip.h
index 00393b2..5a4e85b 100644
--- a/src/soc/intel/skylake/chip.h
+++ b/src/soc/intel/skylake/chip.h
@@ -395,6 +395,12 @@ struct soc_intel_skylake_config {
/* Use custom SD card detect GPIO configuration */
struct acpi_gpio sdcard_cd_gpio;
+
+ /* Wake Enable Bitmap for USB2 ports */
+ u16 usb2_wake_enable_bitmap;
+
+ /* Wake Enable Bitmap for USB3 ports */
+ u8 usb3_wake_enable_bitmap;
};
typedef struct soc_intel_skylake_config config_t;
diff --git a/src/soc/intel/skylake/include/soc/nvs.h b/src/soc/intel/skylake/include/soc/nvs.h
index f9d5b71..cb3b2c6 100644
--- a/src/soc/intel/skylake/include/soc/nvs.h
+++ b/src/soc/intel/skylake/include/soc/nvs.h
@@ -54,7 +54,9 @@ typedef struct {
u64 nhla; /* 0x31 - NHLT Address */
u32 nhll; /* 0x39 - NHLT Length */
u16 cid1; /* 0x3d - Wifi Country Identifier */
- u8 unused[193];
+ u16 u2we; /* 0x3f - USB2 Wake Enable Bitmap */
+ u8 u3we; /* 0x41 - USB3 Wake Enable Bitmap */
+ u8 unused[190];
/* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos;
diff --git a/src/soc/intel/skylake/include/soc/usb.h b/src/soc/intel/skylake/include/soc/usb.h
index e5b0495..a18e79c 100644
--- a/src/soc/intel/skylake/include/soc/usb.h
+++ b/src/soc/intel/skylake/include/soc/usb.h
@@ -169,4 +169,11 @@ struct usb3_port_config {
.tx_downscale_amp = 0x00, \
}
+/*
+ * Set bit corresponding to USB port in wake enable bitmap. Bit 0 corresponds
+ * to Port 1, Bit n corresponds to Port (n+1). This bitmap is later used to
+ * decide what ports need to set PORTSCN/PORTSCXUSB3 register bits.
+ */
+#define USB_PORT_WAKE_ENABLE(x) (1 << (x - 1))
+
#endif
Jonathan Neuschäfer (j.neuschaefer(a)gmx.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17057
-gerrit
commit e479645f0c95789b011179929d6842e39b8c0afd
Author: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
Date: Wed Oct 19 02:18:53 2016 +0200
riscv: Move SBI call implementations under arch/riscv/
Change-Id: Icce96ab3f41ae0f34bd86e30f9ff17c30317854e
Signed-off-by: Jonathan Neuschäfer <j.neuschaefer(a)gmx.net>
---
src/arch/riscv/Makefile.inc | 2 +
src/arch/riscv/include/mcall.h | 70 ++++++++++++++++
src/arch/riscv/include/spike_util.h | 70 ----------------
src/arch/riscv/mcall.c | 100 +++++++++++++++++++++++
src/arch/riscv/trap_handler.c | 2 +-
src/mainboard/emulation/qemu-riscv/Makefile.inc | 3 -
src/mainboard/emulation/qemu-riscv/qemu_util.c | 100 -----------------------
src/mainboard/emulation/spike-riscv/Makefile.inc | 3 -
src/mainboard/emulation/spike-riscv/spike_util.c | 100 -----------------------
src/mainboard/emulation/spike-riscv/uart.c | 1 -
10 files changed, 173 insertions(+), 278 deletions(-)
diff --git a/src/arch/riscv/Makefile.inc b/src/arch/riscv/Makefile.inc
index 4bab459..1ddfe19 100644
--- a/src/arch/riscv/Makefile.inc
+++ b/src/arch/riscv/Makefile.inc
@@ -34,6 +34,7 @@ $(call src-to-obj,bootblock,$(dir)/id.S): $(obj)/build.h
bootblock-y = bootblock.S stages.c
bootblock-y += trap_util.S
bootblock-y += trap_handler.c
+bootblock-y += mcall.c
bootblock-y += virtual_memory.c
bootblock-y += boot.c
bootblock-y += misc.c
@@ -90,6 +91,7 @@ ifeq ($(CONFIG_ARCH_RAMSTAGE_RISCV),y)
ramstage-y =
ramstage-y += trap_handler.c
+ramstage-y += mcall.c
ramstage-y += virtual_memory.c
ramstage-y += stages.c
ramstage-y += misc.c
diff --git a/src/arch/riscv/include/mcall.h b/src/arch/riscv/include/mcall.h
new file mode 100644
index 0000000..a43b9cf
--- /dev/null
+++ b/src/arch/riscv/include/mcall.h
@@ -0,0 +1,70 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2013 The ChromiumOS Authors
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef _MCALL_H
+#define _MCALL_H
+
+#include <arch/encoding.h>
+#include <atomic.h>
+#include <stdint.h>
+
+#define HLS_SIZE 64
+#define MENTRY_FRAME_SIZE HLS_SIZE
+
+typedef struct {
+ unsigned long base;
+ unsigned long size;
+ unsigned long node_id;
+} memory_block_info;
+
+typedef struct {
+ unsigned long dev;
+ unsigned long cmd;
+ unsigned long data;
+ unsigned long sbi_private_data;
+} sbi_device_message;
+
+
+typedef struct {
+ sbi_device_message* device_request_queue_head;
+ unsigned long device_request_queue_size;
+ sbi_device_message* device_response_queue_head;
+ sbi_device_message* device_response_queue_tail;
+
+ int hart_id;
+ int ipi_pending;
+} hls_t;
+
+#define MACHINE_STACK_TOP() ({ \
+ register uintptr_t sp asm ("sp"); \
+ (void*)((sp + RISCV_PGSIZE) & -RISCV_PGSIZE); })
+
+// hart-local storage, at top of stack
+#define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE))
+#define OTHER_HLS(id) ((hls_t*)((void*)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id)))
+
+#define MACHINE_STACK_SIZE RISCV_PGSIZE
+
+uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *p);
+uintptr_t mcall_console_putchar(uint8_t ch);
+uintptr_t mcall_dev_req(sbi_device_message *m);
+uintptr_t mcall_dev_resp(void);
+uintptr_t mcall_set_timer(unsigned long long when);
+uintptr_t mcall_clear_ipi(void);
+uintptr_t mcall_send_ipi(uintptr_t recipient);
+uintptr_t mcall_shutdown(void);
+void hls_init(uint32_t hart_id); // need to call this before launching linux
+
+#endif
diff --git a/src/arch/riscv/include/spike_util.h b/src/arch/riscv/include/spike_util.h
deleted file mode 100644
index 175ee6c..0000000
--- a/src/arch/riscv/include/spike_util.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * This file is part of the coreboot project.
- *
- * Copyright (C) 2013 The ChromiumOS Authors
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- */
-
-#ifndef _SPIKE_UTIL_H
-#define _SPIKE_UTIL_H
-
-#include <arch/encoding.h>
-#include <atomic.h>
-#include <stdint.h>
-
-#define HLS_SIZE 64
-#define MENTRY_FRAME_SIZE HLS_SIZE
-
-typedef struct {
- unsigned long base;
- unsigned long size;
- unsigned long node_id;
-} memory_block_info;
-
-typedef struct {
- unsigned long dev;
- unsigned long cmd;
- unsigned long data;
- unsigned long sbi_private_data;
-} sbi_device_message;
-
-
-typedef struct {
- sbi_device_message* device_request_queue_head;
- unsigned long device_request_queue_size;
- sbi_device_message* device_response_queue_head;
- sbi_device_message* device_response_queue_tail;
-
- int hart_id;
- int ipi_pending;
-} hls_t;
-
-#define MACHINE_STACK_TOP() ({ \
- register uintptr_t sp asm ("sp"); \
- (void*)((sp + RISCV_PGSIZE) & -RISCV_PGSIZE); })
-
-// hart-local storage, at top of stack
-#define HLS() ((hls_t*)(MACHINE_STACK_TOP() - HLS_SIZE))
-#define OTHER_HLS(id) ((hls_t*)((void*)HLS() + RISCV_PGSIZE * ((id) - HLS()->hart_id)))
-
-#define MACHINE_STACK_SIZE RISCV_PGSIZE
-
-uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *p);
-uintptr_t mcall_console_putchar(uint8_t ch);
-uintptr_t mcall_dev_req(sbi_device_message *m);
-uintptr_t mcall_dev_resp(void);
-uintptr_t mcall_set_timer(unsigned long long when);
-uintptr_t mcall_clear_ipi(void);
-uintptr_t mcall_send_ipi(uintptr_t recipient);
-uintptr_t mcall_shutdown(void);
-void hls_init(uint32_t hart_id); // need to call this before launching linux
-
-#endif
diff --git a/src/arch/riscv/mcall.c b/src/arch/riscv/mcall.c
new file mode 100644
index 0000000..b571fbc
--- /dev/null
+++ b/src/arch/riscv/mcall.c
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2013, The Regents of the University of California (Regents).
+ * All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the Regents nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ * IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+ * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
+ * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
+ * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
+ * HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
+ * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#include <arch/barrier.h>
+#include <arch/errno.h>
+#include <atomic.h>
+#include <console/console.h>
+#include <mcall.h>
+#include <string.h>
+#include <vm.h>
+
+uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *info)
+{
+ if (id == 0) {
+ mprv_write_ulong(&info->base, 2U*GiB);
+
+ /* TODO: Return the correct value */
+ mprv_write_ulong(&info->size, 1*GiB);
+ return 0;
+ }
+
+ return -1;
+}
+
+uintptr_t mcall_send_ipi(uintptr_t recipient)
+{
+ die("mcall_send_ipi is currently not implemented");
+ return 0;
+}
+
+uintptr_t mcall_clear_ipi(void)
+{
+ // only clear SSIP if no other events are pending
+ if (HLS()->device_response_queue_head == NULL) {
+ clear_csr(mip, MIP_SSIP);
+ mb();
+ }
+
+ return atomic_swap(&HLS()->ipi_pending, 0);
+}
+
+uintptr_t mcall_shutdown(void)
+{
+ die("mcall_shutdown is currently not implemented");
+ return 0;
+}
+
+uintptr_t mcall_set_timer(unsigned long long when)
+{
+ printk(BIOS_DEBUG, "mcall_set_timer is currently not implemented, ignoring\n");
+ return 0;
+}
+
+uintptr_t mcall_dev_req(sbi_device_message *m)
+{
+ die("mcall_dev_req is currently not implemented");
+ return 0;
+}
+
+uintptr_t mcall_dev_resp(void)
+{
+ die("mcall_dev_resp is currently not implemented");
+ return 0;
+}
+
+void hls_init(uint32_t hart_id)
+{
+ memset(HLS(), 0, sizeof(*HLS()));
+ HLS()->hart_id = hart_id;
+}
+
+uintptr_t mcall_console_putchar(uint8_t ch)
+{
+ do_putchar(ch);
+ return 0;
+}
diff --git a/src/arch/riscv/trap_handler.c b/src/arch/riscv/trap_handler.c
index ad49928..8a7b513 100644
--- a/src/arch/riscv/trap_handler.c
+++ b/src/arch/riscv/trap_handler.c
@@ -17,7 +17,7 @@
#include <arch/exception.h>
#include <arch/sbi.h>
#include <console/console.h>
-#include <spike_util.h>
+#include <mcall.h>
#include <string.h>
#include <vm.h>
diff --git a/src/mainboard/emulation/qemu-riscv/Makefile.inc b/src/mainboard/emulation/qemu-riscv/Makefile.inc
index 4fbe401..36f1fca 100644
--- a/src/mainboard/emulation/qemu-riscv/Makefile.inc
+++ b/src/mainboard/emulation/qemu-riscv/Makefile.inc
@@ -13,14 +13,11 @@
## GNU General Public License for more details.
bootblock-y += uart.c
-bootblock-y += qemu_util.c
bootblock-y += rom_media.c
romstage-y += romstage.c
-romstage-y += qemu_util.c
romstage-y += uart.c
romstage-y += rom_media.c
ramstage-y += uart.c
-ramstage-y += qemu_util.c
ramstage-y += rom_media.c
bootblock-y += memlayout.ld
diff --git a/src/mainboard/emulation/qemu-riscv/qemu_util.c b/src/mainboard/emulation/qemu-riscv/qemu_util.c
deleted file mode 100644
index c97a61f..0000000
--- a/src/mainboard/emulation/qemu-riscv/qemu_util.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2013, The Regents of the University of California (Regents).
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Regents nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
- * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
- * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
- * HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
- * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <arch/barrier.h>
-#include <arch/errno.h>
-#include <atomic.h>
-#include <console/console.h>
-#include <spike_util.h>
-#include <string.h>
-#include <vm.h>
-
-uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *info)
-{
- if (id == 0) {
- mprv_write_ulong(&info->base, 2U*GiB);
-
- /* TODO: Return the correct value */
- mprv_write_ulong(&info->size, 1*GiB);
- return 0;
- }
-
- return -1;
-}
-
-uintptr_t mcall_send_ipi(uintptr_t recipient)
-{
- die("mcall_send_ipi is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_clear_ipi(void)
-{
- // only clear SSIP if no other events are pending
- if (HLS()->device_response_queue_head == NULL) {
- clear_csr(mip, MIP_SSIP);
- mb();
- }
-
- return atomic_swap(&HLS()->ipi_pending, 0);
-}
-
-uintptr_t mcall_shutdown(void)
-{
- die("mcall_shutdown is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_set_timer(unsigned long long when)
-{
- printk(BIOS_DEBUG, "mcall_set_timer is currently not implemented, ignoring\n");
- return 0;
-}
-
-uintptr_t mcall_dev_req(sbi_device_message *m)
-{
- die("mcall_dev_req is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_dev_resp(void)
-{
- die("mcall_dev_resp is currently not implemented");
- return 0;
-}
-
-void hls_init(uint32_t hart_id)
-{
- memset(HLS(), 0, sizeof(*HLS()));
- HLS()->hart_id = hart_id;
-}
-
-uintptr_t mcall_console_putchar(uint8_t ch)
-{
- do_putchar(ch);
- return 0;
-}
diff --git a/src/mainboard/emulation/spike-riscv/Makefile.inc b/src/mainboard/emulation/spike-riscv/Makefile.inc
index e3c9481..36f1fca 100644
--- a/src/mainboard/emulation/spike-riscv/Makefile.inc
+++ b/src/mainboard/emulation/spike-riscv/Makefile.inc
@@ -13,14 +13,11 @@
## GNU General Public License for more details.
bootblock-y += uart.c
-bootblock-y += spike_util.c
bootblock-y += rom_media.c
romstage-y += romstage.c
romstage-y += uart.c
-romstage-y += spike_util.c
romstage-y += rom_media.c
ramstage-y += uart.c
-ramstage-y += spike_util.c
ramstage-y += rom_media.c
bootblock-y += memlayout.ld
diff --git a/src/mainboard/emulation/spike-riscv/spike_util.c b/src/mainboard/emulation/spike-riscv/spike_util.c
deleted file mode 100644
index c97a61f..0000000
--- a/src/mainboard/emulation/spike-riscv/spike_util.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2013, The Regents of the University of California (Regents).
- * All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the Regents nor the
- * names of its contributors may be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
- * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING
- * OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS
- * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED
- * HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE
- * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
- */
-
-#include <arch/barrier.h>
-#include <arch/errno.h>
-#include <atomic.h>
-#include <console/console.h>
-#include <spike_util.h>
-#include <string.h>
-#include <vm.h>
-
-uintptr_t mcall_query_memory(uintptr_t id, memory_block_info *info)
-{
- if (id == 0) {
- mprv_write_ulong(&info->base, 2U*GiB);
-
- /* TODO: Return the correct value */
- mprv_write_ulong(&info->size, 1*GiB);
- return 0;
- }
-
- return -1;
-}
-
-uintptr_t mcall_send_ipi(uintptr_t recipient)
-{
- die("mcall_send_ipi is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_clear_ipi(void)
-{
- // only clear SSIP if no other events are pending
- if (HLS()->device_response_queue_head == NULL) {
- clear_csr(mip, MIP_SSIP);
- mb();
- }
-
- return atomic_swap(&HLS()->ipi_pending, 0);
-}
-
-uintptr_t mcall_shutdown(void)
-{
- die("mcall_shutdown is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_set_timer(unsigned long long when)
-{
- printk(BIOS_DEBUG, "mcall_set_timer is currently not implemented, ignoring\n");
- return 0;
-}
-
-uintptr_t mcall_dev_req(sbi_device_message *m)
-{
- die("mcall_dev_req is currently not implemented");
- return 0;
-}
-
-uintptr_t mcall_dev_resp(void)
-{
- die("mcall_dev_resp is currently not implemented");
- return 0;
-}
-
-void hls_init(uint32_t hart_id)
-{
- memset(HLS(), 0, sizeof(*HLS()));
- HLS()->hart_id = hart_id;
-}
-
-uintptr_t mcall_console_putchar(uint8_t ch)
-{
- do_putchar(ch);
- return 0;
-}
diff --git a/src/mainboard/emulation/spike-riscv/uart.c b/src/mainboard/emulation/spike-riscv/uart.c
index 8513849..57647fe 100644
--- a/src/mainboard/emulation/spike-riscv/uart.c
+++ b/src/mainboard/emulation/spike-riscv/uart.c
@@ -17,7 +17,6 @@
#include <console/uart.h>
#include <arch/io.h>
#include <boot/coreboot_tables.h>
-#include <spike_util.h>
uintptr_t uart_platform_base(int idx)
{
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17056
-gerrit
commit c20e4b714259c419efc99c698b6a59d937addf34
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Tue Oct 18 14:25:25 2016 -0700
intel/skylake: Add support to enable wake-on-usb attach/detach
Three things are required to enable wake-on-usb:
1. 5V to USB ports should be enabled in S3.
2. ASL file needs to have appropriate wake bit set.
3. XHCI controller should have the wake on attach/detach bit set for the
corresponding port in PORTSCN register.
Only part missing was #3.
This CL adds support to allow mainboard to define a bitmap in
devicetree corresponding to the ports that it wants to enable
wake-on-usb feature. Based on the bitmap, wake on attach/detach bits in
PORTSCN would be set by xhci.asl for the appropriate ports.
BUG=chrome-os-partner:58734
BRANCH=None
TEST=Verified that with port 5 enabled, chell wakes up from S3 on usb
attach/detach.
Change-Id: I40a22a450e52f74a0ab93ebb8170555d834ebdaf
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/soc/intel/skylake/acpi.c | 2 ++
src/soc/intel/skylake/acpi/globalnvs.asl | 1 +
src/soc/intel/skylake/acpi/xhci.asl | 37 ++++++++++++++++++++++++++++++++
src/soc/intel/skylake/chip.h | 3 +++
src/soc/intel/skylake/include/soc/nvs.h | 3 ++-
src/soc/intel/skylake/include/soc/usb.h | 2 ++
6 files changed, 47 insertions(+), 1 deletion(-)
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index 28a0a6e..b839b75 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -198,6 +198,8 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
/* Fill in the Wifi Region id */
gnvs->cid1 = wifi_regulatory_domain();
+
+ gnvs->uweb = config->usb_wake_enable_bitmap;
}
unsigned long acpi_fill_mcfg(unsigned long current)
diff --git a/src/soc/intel/skylake/acpi/globalnvs.asl b/src/soc/intel/skylake/acpi/globalnvs.asl
index 2bff7d3..6d95f0f 100644
--- a/src/soc/intel/skylake/acpi/globalnvs.asl
+++ b/src/soc/intel/skylake/acpi/globalnvs.asl
@@ -64,6 +64,7 @@ Field (GNVS, ByteAcc, NoLock, Preserve)
NHLA, 64, // 0x31 - NHLT Address
NHLL, 32, // 0x39 - NHLT Length
CID1, 16, // 0x3d - Wifi Country Identifier
+ UWEB, 16, // 0x3f - USB Wake Enable Bitmap
/* ChromeOS specific */
Offset (0x100),
diff --git a/src/soc/intel/skylake/acpi/xhci.asl b/src/soc/intel/skylake/acpi/xhci.asl
index 1a1c6e3..cab23e1 100644
--- a/src/soc/intel/skylake/acpi/xhci.asl
+++ b/src/soc/intel/skylake/acpi/xhci.asl
@@ -15,6 +15,30 @@
* GNU General Public License for more details.
*/
+/*
+ * Enable wake-up on USB attach/detach for given port.
+ * Arg0 - Port Number
+ * Arg1 - XHCI Memory-mapped address
+ */
+Method (UPWE, 2, Serialized)
+{
+ /*
+ * PORTSCN starts at offset 0x480 for port 1, 0x490 for port 2 and so
+ * on. Get the region base address by using port number.
+ */
+ Add (0x480, Multiply (Subtract (Arg0, 1), 0x10), Local0)
+ OperationRegion (PSCN, SystemMemory,
+ Add (ShiftLeft (Arg1, 16), Local0), 0x10)
+ Field (PSCN, AnyAcc, NoLock, Preserve)
+ {
+ , 25,
+ UPCE, 1,
+ UPDE, 1,
+ }
+ Store (One, UPCE)
+ Store (One, UPDE)
+}
+
/* XHCI Controller 0:14.0 */
Device (XHCI)
@@ -26,6 +50,19 @@ Device (XHCI)
Method (_DSW, 3)
{
Store (Arg0, PMEE)
+
+ /* Get USB Wake enable bitmask. Take only lower 10 bits. */
+ Store (\UWEB, Local0)
+ And (Local0, 0x3FF, Local0)
+
+ While (One) {
+ FindSetRightBit (Local0, Local1)
+ If (LEqual (Local1, Zero)) {
+ Break
+ }
+ UPWE (Local1, XMEM)
+ Store (And (Local0, Subtract (Local0, 1)), Local0)
+ }
}
Name (_S3D, 3) /* D3 supported in S3 */
diff --git a/src/soc/intel/skylake/chip.h b/src/soc/intel/skylake/chip.h
index 00393b2..ed9b8d4 100644
--- a/src/soc/intel/skylake/chip.h
+++ b/src/soc/intel/skylake/chip.h
@@ -395,6 +395,9 @@ struct soc_intel_skylake_config {
/* Use custom SD card detect GPIO configuration */
struct acpi_gpio sdcard_cd_gpio;
+
+ /* Wake Enable Bitmap for USB ports */
+ u16 usb_wake_enable_bitmap;
};
typedef struct soc_intel_skylake_config config_t;
diff --git a/src/soc/intel/skylake/include/soc/nvs.h b/src/soc/intel/skylake/include/soc/nvs.h
index f9d5b71..f89f82b 100644
--- a/src/soc/intel/skylake/include/soc/nvs.h
+++ b/src/soc/intel/skylake/include/soc/nvs.h
@@ -54,7 +54,8 @@ typedef struct {
u64 nhla; /* 0x31 - NHLT Address */
u32 nhll; /* 0x39 - NHLT Length */
u16 cid1; /* 0x3d - Wifi Country Identifier */
- u8 unused[193];
+ u16 uweb; /* 0x3f - USB Wake Enable Bitmap */
+ u8 unused[191];
/* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos;
diff --git a/src/soc/intel/skylake/include/soc/usb.h b/src/soc/intel/skylake/include/soc/usb.h
index e5b0495..f837366 100644
--- a/src/soc/intel/skylake/include/soc/usb.h
+++ b/src/soc/intel/skylake/include/soc/usb.h
@@ -169,4 +169,6 @@ struct usb3_port_config {
.tx_downscale_amp = 0x00, \
}
+#define USB2_PORT(x) (1 << (x - 1))
+
#endif
Furquan Shaikh (furquan(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17056
-gerrit
commit 8fd56615f7fe0b32e9dcdb6d408eee405acd165b
Author: Furquan Shaikh <furquan(a)chromium.org>
Date: Tue Oct 18 14:25:25 2016 -0700
intel/skylake: Add support to enable wake-on-usb attach/detach
Three things are required to enable wake-on-usb:
1. 5V to USB ports should be enabled in S3.
2. ASL file needs to have appropriate wake bit set.
3. XHCI controller should have the wake on attach/detach bit set for the
corresponding port in PORTSCN register.
Only part missing was #3.
This CL adds support to allow mainboard to define a bitmap in
devicetree corresponding to the ports that it wants to enable
wake-on-usb feature. Based on the bitmap, wake on attach/detach bits in
PORTSCN would be set by xhci.asl for the appropriate ports.
BUG=chrome-os-partner:58734
BRANCH=None
TEST=Verified that with port 5 enabled, chell wakes up from S3 on usb
attach/detach.
Change-Id: I40a22a450e52f74a0ab93ebb8170555d834ebdaf
Signed-off-by: Furquan Shaikh <furquan(a)chromium.org>
---
src/mainboard/google/chell/devicetree.cb | 3 +++
src/soc/intel/skylake/acpi.c | 2 ++
src/soc/intel/skylake/acpi/globalnvs.asl | 1 +
src/soc/intel/skylake/acpi/xhci.asl | 37 ++++++++++++++++++++++++++++++++
src/soc/intel/skylake/chip.h | 3 +++
src/soc/intel/skylake/include/soc/nvs.h | 3 ++-
src/soc/intel/skylake/include/soc/usb.h | 2 ++
7 files changed, 50 insertions(+), 1 deletion(-)
diff --git a/src/mainboard/google/chell/devicetree.cb b/src/mainboard/google/chell/devicetree.cb
index 230a9a6..9576516 100644
--- a/src/mainboard/google/chell/devicetree.cb
+++ b/src/mainboard/google/chell/devicetree.cb
@@ -186,6 +186,9 @@ chip soc/intel/skylake
# Send an extra VR mailbox command for the supported MPS IMVP8 model
register "SendVrMbxCmd" = "1"
+ # Wake for USB port 5
+ register "usb_wake_enable_bitmap" = "USB2_PORT(5)"
+
device cpu_cluster 0 on
device lapic 0 on end
end
diff --git a/src/soc/intel/skylake/acpi.c b/src/soc/intel/skylake/acpi.c
index 28a0a6e..b839b75 100644
--- a/src/soc/intel/skylake/acpi.c
+++ b/src/soc/intel/skylake/acpi.c
@@ -198,6 +198,8 @@ static void acpi_create_gnvs(global_nvs_t *gnvs)
/* Fill in the Wifi Region id */
gnvs->cid1 = wifi_regulatory_domain();
+
+ gnvs->uweb = config->usb_wake_enable_bitmap;
}
unsigned long acpi_fill_mcfg(unsigned long current)
diff --git a/src/soc/intel/skylake/acpi/globalnvs.asl b/src/soc/intel/skylake/acpi/globalnvs.asl
index 2bff7d3..6d95f0f 100644
--- a/src/soc/intel/skylake/acpi/globalnvs.asl
+++ b/src/soc/intel/skylake/acpi/globalnvs.asl
@@ -64,6 +64,7 @@ Field (GNVS, ByteAcc, NoLock, Preserve)
NHLA, 64, // 0x31 - NHLT Address
NHLL, 32, // 0x39 - NHLT Length
CID1, 16, // 0x3d - Wifi Country Identifier
+ UWEB, 16, // 0x3f - USB Wake Enable Bitmap
/* ChromeOS specific */
Offset (0x100),
diff --git a/src/soc/intel/skylake/acpi/xhci.asl b/src/soc/intel/skylake/acpi/xhci.asl
index 1a1c6e3..cab23e1 100644
--- a/src/soc/intel/skylake/acpi/xhci.asl
+++ b/src/soc/intel/skylake/acpi/xhci.asl
@@ -15,6 +15,30 @@
* GNU General Public License for more details.
*/
+/*
+ * Enable wake-up on USB attach/detach for given port.
+ * Arg0 - Port Number
+ * Arg1 - XHCI Memory-mapped address
+ */
+Method (UPWE, 2, Serialized)
+{
+ /*
+ * PORTSCN starts at offset 0x480 for port 1, 0x490 for port 2 and so
+ * on. Get the region base address by using port number.
+ */
+ Add (0x480, Multiply (Subtract (Arg0, 1), 0x10), Local0)
+ OperationRegion (PSCN, SystemMemory,
+ Add (ShiftLeft (Arg1, 16), Local0), 0x10)
+ Field (PSCN, AnyAcc, NoLock, Preserve)
+ {
+ , 25,
+ UPCE, 1,
+ UPDE, 1,
+ }
+ Store (One, UPCE)
+ Store (One, UPDE)
+}
+
/* XHCI Controller 0:14.0 */
Device (XHCI)
@@ -26,6 +50,19 @@ Device (XHCI)
Method (_DSW, 3)
{
Store (Arg0, PMEE)
+
+ /* Get USB Wake enable bitmask. Take only lower 10 bits. */
+ Store (\UWEB, Local0)
+ And (Local0, 0x3FF, Local0)
+
+ While (One) {
+ FindSetRightBit (Local0, Local1)
+ If (LEqual (Local1, Zero)) {
+ Break
+ }
+ UPWE (Local1, XMEM)
+ Store (And (Local0, Subtract (Local0, 1)), Local0)
+ }
}
Name (_S3D, 3) /* D3 supported in S3 */
diff --git a/src/soc/intel/skylake/chip.h b/src/soc/intel/skylake/chip.h
index 00393b2..ed9b8d4 100644
--- a/src/soc/intel/skylake/chip.h
+++ b/src/soc/intel/skylake/chip.h
@@ -395,6 +395,9 @@ struct soc_intel_skylake_config {
/* Use custom SD card detect GPIO configuration */
struct acpi_gpio sdcard_cd_gpio;
+
+ /* Wake Enable Bitmap for USB ports */
+ u16 usb_wake_enable_bitmap;
};
typedef struct soc_intel_skylake_config config_t;
diff --git a/src/soc/intel/skylake/include/soc/nvs.h b/src/soc/intel/skylake/include/soc/nvs.h
index f9d5b71..f89f82b 100644
--- a/src/soc/intel/skylake/include/soc/nvs.h
+++ b/src/soc/intel/skylake/include/soc/nvs.h
@@ -54,7 +54,8 @@ typedef struct {
u64 nhla; /* 0x31 - NHLT Address */
u32 nhll; /* 0x39 - NHLT Length */
u16 cid1; /* 0x3d - Wifi Country Identifier */
- u8 unused[193];
+ u16 uweb; /* 0x3f - USB Wake Enable Bitmap */
+ u8 unused[191];
/* ChromeOS specific (0x100 - 0xfff) */
chromeos_acpi_t chromeos;
diff --git a/src/soc/intel/skylake/include/soc/usb.h b/src/soc/intel/skylake/include/soc/usb.h
index e5b0495..f837366 100644
--- a/src/soc/intel/skylake/include/soc/usb.h
+++ b/src/soc/intel/skylake/include/soc/usb.h
@@ -169,4 +169,6 @@ struct usb3_port_config {
.tx_downscale_amp = 0x00, \
}
+#define USB2_PORT(x) (1 << (x - 1))
+
#endif
Daisuke Nojiri (dnojiri(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16746
-gerrit
commit 06700318abc0a640a950fea0fbee7041c1f4f448
Author: Daisuke Nojiri <dnojiri(a)chromium.org>
Date: Mon Sep 26 10:46:53 2016 -0700
mvmap2315: Skip uart_init when serial is disabled
When coreboot is built with CONFIG_CONSOLE_SERIAL not set, uart_init
does not exist, causing compilation to fail. This patch fixes it by
skipping uart_init when serial is disabled.
BUG=none
BRANCH=none
TEST=emerge-rotor coreboot
Change-Id: If7f475eae9008b392f8f1e5cb5568c93113ee3f1
Signed-off-by: Daisuke Nojiri <dnojiri(a)chromium.org>
---
src/soc/marvell/mvmap2315/bootblock.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/soc/marvell/mvmap2315/bootblock.c b/src/soc/marvell/mvmap2315/bootblock.c
index 6b0a333..57fd38c 100644
--- a/src/soc/marvell/mvmap2315/bootblock.c
+++ b/src/soc/marvell/mvmap2315/bootblock.c
@@ -93,9 +93,11 @@ void bootblock_soc_init(void)
printk(BIOS_DEBUG, "Powering up the AP core0.\n");
ap_start((void *)MVMAP2315_ROMSTAGE_BASE);
- /* initializing UART1 to free UART0 to be used by romstage */
- uart_num = 1;
- uart_init(uart_num);
+ /* Initializing UART1 to free UART0 to be used by AP */
+ if (IS_ENABLED(CONFIG_CONSOLE_SERIAL)) {
+ uart_num = 1;
+ uart_init(uart_num);
+ }
while (read32((void *)MVMAP2315_BOOTBLOCK_CB1) != 0x4)
;
the following patch was just integrated into master:
commit e74f5eaa432b6483da56c5e964a6f5fbf29cbaed
Author: Julius Werner <jwerner(a)chromium.org>
Date: Mon Oct 17 18:14:41 2016 -0700
rk3399: display: Use edid_set_framebuffer_bits_per_pixel() helper
This refactoring was already carried into RK3288 with commit 6911219
(edid: Add helper function to calculate bits-per-pixel dependent values)
but it seems that the code for RK3399 was copy&pasted from it too early
to pick this up. Fix that so that future Rockchip SoCs can copy&paste
the right thing.
Change-Id: I5050c58d18db38fffabc7666e67a622d4a828590
Signed-off-by: Julius Werner <jwerner(a)chromium.org>
Reviewed-on: https://review.coreboot.org/17050
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Reviewed-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
Reviewed-by: Patrick Georgi <pgeorgi(a)google.com>
See https://review.coreboot.org/17050 for details.
-gerrit
Patrick Georgi (pgeorgi(a)google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17055
-gerrit
commit d495199b2b828ac7784c8322c5671ca87a14e1a1
Author: Patrick Georgi <pgeorgi(a)chromium.org>
Date: Tue Oct 18 19:46:33 2016 +0200
intel/broadwell: "free" memory after use
While we stub out free(), tools like coverity scan have no idea, and it
might change in the future. So free it.
Change-Id: I1d93a6f45b64445662daa95b51128140ad0a87e2
Signed-off-by: Patrick Georgi <pgeorgi(a)chromium.org>
Found-by: Coverity Scan #1260716
---
src/soc/intel/broadwell/me.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/soc/intel/broadwell/me.c b/src/soc/intel/broadwell/me.c
index 893c19b..1b086ec 100644
--- a/src/soc/intel/broadwell/me.c
+++ b/src/soc/intel/broadwell/me.c
@@ -966,6 +966,7 @@ static int intel_me_read_mbp(me_bios_payload *mbp_data, device_t dev)
}
#undef ASSIGN_FIELD_PTR
+ free(mbp);
return ret;
}