Patchwork i945 mainboard resources

login
register
about
Submitter Myles Watson
Date 2010-09-09 15:04:05
Message ID <AANLkTikhNGzGGj_5vorQP0advF8VyjbfyJsas4evVDfs@mail.gmail.com>
Download mbox | patch
Permalink /patch/1897/
State Accepted
Headers show

Comments

Myles Watson - 2010-09-09 15:04:05
I think we should get rid of HAVE_MAINBOARD_RESOURCES.

Here's a patch that does that for i945 boards.  The Roda board
provided add_mainboard_resources(), but it was never called because it
didn't select HAVE_MAINBOARD_RESOURCES in Kconfig.

Testing & suggestions welcome.

Signed-off-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Peter Stuge - 2010-09-10 22:01:24
Myles Watson wrote:
> I think we should get rid of HAVE_MAINBOARD_RESOURCES.
> 
> Here's a patch that does that for i945 boards.  The Roda board
> provided add_mainboard_resources(), but it was never called because it
> didn't select HAVE_MAINBOARD_RESOURCES in Kconfig.
> 
> Testing & suggestions welcome.
> 
> Signed-off-by: Myles Watson <mylesgw@gmail.com>

Acked-by: Peter Stuge <peter@stuge.se>

Maybe it's wise to get some feedback on testing before commit? On the
other hand, maybe not. I think this should work.


//Peter
Myles Watson - 2010-09-11 13:11:57
On Fri, Sep 10, 2010 at 4:01 PM, Peter Stuge <peter@stuge.se> wrote:
> Myles Watson wrote:
>> I think we should get rid of HAVE_MAINBOARD_RESOURCES.
>>
>> Here's a patch that does that for i945 boards.  The Roda board
>> provided add_mainboard_resources(), but it was never called because it
>> didn't select HAVE_MAINBOARD_RESOURCES in Kconfig.
>>
>> Testing & suggestions welcome.
>>
>> Signed-off-by: Myles Watson <mylesgw@gmail.com>
>
> Acked-by: Peter Stuge <peter@stuge.se>
Thanks.

> Maybe it's wise to get some feedback on testing before commit? On the
> other hand, maybe not. I think this should work.
Checking it in might get me quicker test feedback :)

I was hoping someone with a board would test it first, though.

Thanks,
Myles
Myles Watson - 2010-09-13 13:15:52
On Fri, Sep 10, 2010 at 4:01 PM, Peter Stuge <peter@stuge.se> wrote:
> Myles Watson wrote:
>> I think we should get rid of HAVE_MAINBOARD_RESOURCES.
>>
>> Here's a patch that does that for i945 boards.  The Roda board
>> provided add_mainboard_resources(), but it was never called because it
>> didn't select HAVE_MAINBOARD_RESOURCES in Kconfig.
>>
>> Testing & suggestions welcome.
>>
>> Signed-off-by: Myles Watson <mylesgw@gmail.com>
>
> Acked-by: Peter Stuge <peter@stuge.se>
Rev 5803.

Thanks,
Myles

Patch

Index: svn/src/mainboard/kontron/986lcd-m/Kconfig
===================================================================
--- svn.orig/src/mainboard/kontron/986lcd-m/Kconfig
+++ svn/src/mainboard/kontron/986lcd-m/Kconfig
@@ -15,7 +15,6 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_OPTION_TABLE
 	select HAVE_HARD_RESET
 	select HAVE_ACPI_RESUME
-	select HAVE_MAINBOARD_RESOURCES
 	select MMCONF_SUPPORT
 	select HAVE_SMI_HANDLER
 	select BOARD_ROMSIZE_KB_1024
Index: svn/src/mainboard/kontron/986lcd-m/mainboard.c
===================================================================
--- svn.orig/src/mainboard/kontron/986lcd-m/mainboard.c
+++ svn/src/mainboard/kontron/986lcd-m/mainboard.c
@@ -20,20 +20,13 @@ 
 #include <types.h>
 #include <device/device.h>
 #include <console/console.h>
-#include <boot/tables.h>
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
 #include <x86emu/x86emu.h>
 #endif
 #include <pc80/mc146818rtc.h>
 #include <arch/io.h>
-#include <arch/coreboot_tables.h>
 #include "chip.h"
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	return add_northbridge_resources(mem);
-}
-
 #if defined(CONFIG_PCI_OPTION_ROM_RUN_YABEL) && CONFIG_PCI_OPTION_ROM_RUN_YABEL
 static int int15_handler(void)
 {
Index: svn/src/northbridge/intel/i945/northbridge.c
===================================================================
--- svn.orig/src/northbridge/intel/i945/northbridge.c
+++ svn/src/northbridge/intel/i945/northbridge.c
@@ -70,20 +70,26 @@  static int get_pcie_bar(u32 *base, u32 *
 /* IDG memory */
 uint64_t uma_memory_base=0, uma_memory_size=0;
 
-int add_northbridge_resources(struct lb_memory *mem)
+static void add_fixed_resources(struct device *dev, int index)
 {
+	struct resource *resource;
 	u32 pcie_config_base, pcie_config_size;
 
 	printk(BIOS_DEBUG, "Adding UMA memory area\n");
-	lb_add_memory_range(mem, LB_MEM_RESERVED,
-		uma_memory_base, uma_memory_size);
-
-	printk(BIOS_DEBUG, "Adding PCIe config bar\n");
-	get_pcie_bar(&pcie_config_base, &pcie_config_size);
-	lb_add_memory_range(mem, LB_MEM_RESERVED,
-		pcie_config_base, pcie_config_size);
+	resource = new_resource(dev, index);
+	resource->base = (resource_t) uma_memory_base;
+	resource->size = (resource_t) uma_memory_size;
+	resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE |
+	    IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
 
-	return 0;
+	if (get_pcie_bar(&pcie_config_base, &pcie_config_size)) {
+		printk(BIOS_DEBUG, "Adding PCIe config bar\n");
+		resource = new_resource(dev, index+1);
+		resource->base = (resource_t) pcie_config_base;
+		resource->size = (resource_t) pcie_config_size;
+		resource->flags = IORESOURCE_MEM | IORESOURCE_RESERVE |
+		    IORESOURCE_FIXED | IORESOURCE_STORED | IORESOURCE_ASSIGNED;
+	}
 }
 
 static void ram_resource(device_t dev, unsigned long index, unsigned long basek,
@@ -208,6 +214,8 @@  static void pci_domain_set_resources(dev
 		ram_resource(dev, 5, 4096 * 1024, tomk - 4 * 1024 * 1024);
 	}
 
+	add_fixed_resources(dev, 6);
+
 	assign_resources(dev->link_list);
 
 #if CONFIG_WRITE_HIGH_TABLES==1
Index: svn/src/mainboard/getac/p470/Kconfig
===================================================================
--- svn.orig/src/mainboard/getac/p470/Kconfig
+++ svn/src/mainboard/getac/p470/Kconfig
@@ -36,7 +36,6 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_HARD_RESET
 	select HAVE_ACPI_RESUME
 	select HAVE_ACPI_SLIC
-	select HAVE_MAINBOARD_RESOURCES
 	select MMCONF_SUPPORT
 	select AP_IN_SIPI_WAIT
 	select UDELAY_LAPIC
Index: svn/src/mainboard/getac/p470/mainboard.c
===================================================================
--- svn.orig/src/mainboard/getac/p470/mainboard.c
+++ svn/src/mainboard/getac/p470/mainboard.c
@@ -98,11 +98,6 @@  static void mainboard_enable(device_t de
 	verb_setup();
 }
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	return add_northbridge_resources(mem);
-}
-
 struct chip_operations mainboard_ops = {
 	CHIP_NAME("Getac P470 Rugged Notebook")
 	.enable_dev = mainboard_enable,
Index: svn/src/mainboard/ibase/mb899/Kconfig
===================================================================
--- svn.orig/src/mainboard/ibase/mb899/Kconfig
+++ svn/src/mainboard/ibase/mb899/Kconfig
@@ -15,7 +15,6 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_HARD_RESET
 	select HAVE_OPTION_TABLE
 	select HAVE_ACPI_RESUME
-	select HAVE_MAINBOARD_RESOURCES
 	select MMCONF_SUPPORT
 	select HAVE_SMI_HANDLER
 	select BOARD_ROMSIZE_KB_512
Index: svn/src/mainboard/ibase/mb899/mainboard.c
===================================================================
--- svn.orig/src/mainboard/ibase/mb899/mainboard.c
+++ svn/src/mainboard/ibase/mb899/mainboard.c
@@ -29,11 +29,6 @@ 
 #include <arch/coreboot_tables.h>
 #include "chip.h"
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	return add_northbridge_resources(mem);
-}
-
 #if CONFIG_PCI_OPTION_ROM_RUN_YABEL
 static int int15_handler(void)
 {
Index: svn/src/mainboard/intel/d945gclf/Kconfig
===================================================================
--- svn.orig/src/mainboard/intel/d945gclf/Kconfig
+++ svn/src/mainboard/intel/d945gclf/Kconfig
@@ -36,7 +36,6 @@  config BOARD_SPECIFIC_OPTIONS # dummy
 	select HAVE_MP_TABLE
 	select HAVE_ACPI_TABLES
 	select HAVE_ACPI_RESUME
-	select HAVE_MAINBOARD_RESOURCES
 	select MMCONF_SUPPORT
 	select HAVE_ACPI_TABLES
 	select HAVE_SMI_HANDLER
Index: svn/src/mainboard/intel/d945gclf/mainboard.c
===================================================================
--- svn.orig/src/mainboard/intel/d945gclf/mainboard.c
+++ svn/src/mainboard/intel/d945gclf/mainboard.c
@@ -23,11 +23,6 @@ 
 #include <arch/coreboot_tables.h>
 #include "chip.h"
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	return add_northbridge_resources(mem);
-}
-
 struct chip_operations mainboard_ops = {
 	CHIP_NAME("Intel D945GCLF Mainboard")
 };
Index: svn/src/mainboard/roda/rk886ex/mainboard.c
===================================================================
--- svn.orig/src/mainboard/roda/rk886ex/mainboard.c
+++ svn/src/mainboard/roda/rk886ex/mainboard.c
@@ -134,11 +134,6 @@  static void mainboard_enable(device_t de
 #endif
 }
 
-int add_mainboard_resources(struct lb_memory *mem)
-{
-	return add_northbridge_resources(mem);
-}
-
 struct chip_operations mainboard_ops = {
 	CHIP_NAME("Roda Computer GmbH RK886EX Rugged Notebook (ROCKY3+)")
 	.enable_dev = mainboard_enable,