On Wed, Nov 12, 2008 at 10:37 AM, ron minnich <[EMAIL PROTECTED]> wrote:
> On Wed, Nov 12, 2008 at 8:25 AM, Myles Watson <[EMAIL PROTECTED]> wrote:
>
> > I forgot the rule. I'm down the path of creating static devices for each
> > PNP device. :(
>
> if you make a dts per PNP device, the dtc will do that for you.
>
> don't go too far without a sanity test with me or you will go insane :-)
>
>
> > Which has absolutely no knowledge of the dts. We could, however, create
> an
> > initialization function that copies all of the information from the dts
> into
> > the specific device. It just has to be done before resource allocation,
> > which means that pnp_enable_devices needs to be split and renamed.
>
> as marc pointed out, the phase3_chip_setup_dev does have dts knowledge.
>
> I'm seeing the problem more now. As you have pointed out, the pnp
> stuff has no good connection to anything else, and this needs to be
> fixed.
>
>
> > I have a generic pnp dts which has members io,irq,io2,irq2,drq
>
> can I see it?
Shield your eyes from the ugliness :)
This patch creates a superio/winbond/*/pnp.dts which is generic enough that
it probably should be extended if needed and moved to device/pnp.dts or
superio/pnp.dts or something like that.
I wish that I could put [EMAIL PROTECTED] and have the define come out in the
statictree.c, but it doesn't like that, so I have to duplicate the
information.
Right now it does [EMAIL PROTECTED] as a static child of [EMAIL PROTECTED] I
have to fix that
up in the code by assigning the pnp device's port from its parents. That
could move.
In the pnp code, I changed it so that it doesn't allocate a pnp device if it
doesn't find it, because that would mean that all the values were wrong for
the ports, irqs, etc.
Signed-off-by: Myles Watson <[EMAIL PROTECTED]>
I signed it off in case I'm hit by a truck, for Uwe, but it shouldn't be
committed.
Thanks,
Myles
Index: superio/winbond/w83627hf/pnp.dts
===================================================================
--- superio/winbond/w83627hf/pnp.dts (revision 0)
+++ superio/winbond/w83627hf/pnp.dts (revision 0)
@@ -0,0 +1,29 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2007 Ronald G. Minnich <[EMAIL PROTECTED]>
+ *
+ * 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; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+{
+ /* To override any of these, put the over-ride in mainboard dts. */
+ io = "0";
+ io2 = "0";
+ irq = "0";
+ irq2 = "0";
+ drq = "0";
+ drq2 = "0";
+};
Index: superio/winbond/w83627hf/superio.c
===================================================================
--- superio/winbond/w83627hf/superio.c (revision 987)
+++ superio/winbond/w83627hf/superio.c (working copy)
@@ -117,32 +117,31 @@
{
struct superio_winbond_w83627hf_dts_config *conf;
struct resource *res0, *res1;
- struct pc_keyboard keyboard;
-#if 1
- printk(BIOS_ERR, "dummy init XXXX\n");
-#endif
-
+ printk(BIOS_DEBUG, "%s: %s\n",__func__, dev->dtsname);
if (!dev->enabled) {
+ printk(BIOS_ERR, "dummy init XXXX\n");
return;
}
conf = dev->device_configuration;
switch(dev->path.pnp.device) {
case W83627HF_SP1:
+ printk(BIOS_DEBUG, "%s: Hey com1 is enabled.\n",__func__);
res0 = find_resource(dev, PNP_IDX_IO0);
#warning init_uart8250
- //init_uart8250(res0->base, &conf->com1);
+ printk(BIOS_DEBUG, "%s: Not calling init_uart8250.\n",__func__);
break;
case W83627HF_SP2:
res0 = find_resource(dev, PNP_IDX_IO0);
#warning init_uart8250
+ printk(BIOS_DEBUG, "%s: Not calling init_uart8250.\n",__func__);
//init_uart8250(res0->base, &conf->com2);
break;
case W83627HF_KBC:
res0 = find_resource(dev, PNP_IDX_IO0);
res1 = find_resource(dev, PNP_IDX_IO1);
- init_pc_keyboard(res0->base, res1->base, &keyboard);
+ init_pc_keyboard(res0->base, res1->base, NULL);
break;
case W83627HF_HWM:
res0 = find_resource(dev, PNP_IDX_IO0);
@@ -190,7 +189,9 @@
}
}
static void phase3_chip_setup_dev(struct device *dev);
+
struct device_operations w83627hf_ops = {
+ .id = {.type = DEVICE_ID_PNP},
.phase3_chip_setup_dev = phase3_chip_setup_dev,
.phase3_enable = w83627hf_pnp_enable_resources,
.phase4_read_resources = pnp_read_resources,
@@ -217,6 +218,13 @@
static void phase3_chip_setup_dev(struct device *dev)
{
+ struct device *child = dev->link[0].children;
+
+ while (dev->links && child) {
+ if (child->path.type == DEVICE_PATH_PNP)
+ child->path.pnp.port = dev->path.ioport.iobase;
+ child = child->sibling;
+ }
pnp_enable_devices(dev, &w83627hf_ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
}
Index: superio/winbond/w83627hf/dts
===================================================================
--- superio/winbond/w83627hf/dts (revision 987)
+++ superio/winbond/w83627hf/dts (working copy)
@@ -22,65 +22,4 @@
device_operations = "w83627hf_ops";
/* To override any of these, put the over-ride in mainboard dts. */
- /* Floppy */
- floppydev = "0x0";
- floppyenable = "0";
- floppyio = "0x3f0";
- floppyirq = "0x60";
- floppydrq = "0x02";
-
- /* Parallel port */
- ppdev = "2";
- ppenable = "0";
- ppio = "0x378";
- ppirq = "7";
-
- /* COM1 */
- com1dev = "2";
- com1enable = "0";
- com1io = "0x3f8";
- com1irq = "4";
-
- /* COM2 */
- com2dev = "3";
- com2enable = "0";
- com2io = "0x2f8";
- com2irq = "3";
-
- /* Keyboard */
- kbdev = "5";
- kbenable = "0";
- kbio = "0x60";
- kbio2 = "0x62";
- kbirq = "1";
- kbirq2 = "12";
-
- /* Consumer IR */
- cirdev = "6";
- cirenable = "0";
-
- /* Game port */
- gamedev = "7";
- gameenable = "0";
- gameio = "0x220";
- gameio2 = "0x400";
- gameirq = "9";
-
- /* GPIO2 */
- gpio2dev = "8";
- gpio2enable = "0";
-
- /* GPIO3 */
- gpio3dev = "9";
- gpio3enable = "0";
-
- /* ACPI */
- acpidev = "0xa";
- acpienable = "0";
-
- /* Hardware Monitor */
- hwmdev = "0xb";
- hwmenable = "0";
- hwmio = "0x290";
- hwmirq = "5";
};
Index: mainboard/amd/serengeti/dts
===================================================================
--- mainboard/amd/serengeti/dts (revision 987)
+++ mainboard/amd/serengeti/dts (working copy)
@@ -29,7 +29,10 @@
/config/("northbridge/amd/k8/domain");
[EMAIL PROTECTED],0 {
/config/("northbridge/amd/k8/pci");
- [EMAIL PROTECTED],0 {
+ [EMAIL PROTECTED],0 {
+ /config/("southbridge/amd/amd8132/pcix.dts");
+ };
+ [EMAIL PROTECTED],0 {
/config/("southbridge/amd/amd8111/pci.dts");
[EMAIL PROTECTED],0{
/config/("southbridge/amd/amd8111/usb.dts");
@@ -39,18 +42,43 @@
};
[EMAIL PROTECTED],2{
/config/("southbridge/amd/amd8111/usb2.dts");
- disable;
+ disabled;
};
[EMAIL PROTECTED],0{
/config/("southbridge/amd/amd8111/nic.dts");
- disable;
+ disabled;
};
};
[EMAIL PROTECTED],0 {
/config/("southbridge/amd/amd8111/lpc.dts");
+ [EMAIL PROTECTED] {
+ /config/("superio/winbond/w83627hf/dts");
+ [EMAIL PROTECTED] {
+ /config/("superio/winbond/w83627hf/pnp.dts");
+ enabled;
+ io = "0x3f8";
+ irq = "4";
+ };
+ [EMAIL PROTECTED] {
+ /config/("superio/winbond/w83627hf/pnp.dts");
+ enabled;
+ io = "0x60";
+ io2 = "0x62";
+ irq = "1";
+ irq2 = "12";
+ };
+ [EMAIL PROTECTED] {
+ /config/("superio/winbond/w83627hf/pnp.dts");
+ enabled;
+ io = "0x290";
+ irq = "5";
+ };
+ };
};
[EMAIL PROTECTED],1 {
/config/("southbridge/amd/amd8111/ide.dts");
+ ide0_enable = "1";
+ ide1_enable = "1";
};
[EMAIL PROTECTED],2 {
/config/("southbridge/amd/amd8111/smbus.dts");
@@ -60,26 +88,18 @@
};
[EMAIL PROTECTED],5 {
/config/("southbridge/amd/amd8111/ac97audio.dts");
+ disabled;
};
[EMAIL PROTECTED],6 {
/config/("southbridge/amd/amd8111/ac97modem.dts");
+ disabled;
};
- [EMAIL PROTECTED],0 {
- /config/("southbridge/amd/amd8132/pcix.dts");
+ [EMAIL PROTECTED],7 {
+ disabled;
};
};
- [EMAIL PROTECTED],0 {
- /config/("northbridge/amd/k8/pci");
- };
- [EMAIL PROTECTED],0 {
- /config/("northbridge/amd/k8/pci");
- };
[EMAIL PROTECTED],1 {};
[EMAIL PROTECTED],2 {};
[EMAIL PROTECTED],3 {};
- [EMAIL PROTECTED] {
- /config/("superio/winbond/w83627hf/dts");
- com1enable = "1";
- };
};
};
Index: device/pnp_device.c
===================================================================
--- device/pnp_device.c (revision 987)
+++ device/pnp_device.c (working copy)
@@ -85,6 +85,9 @@
static void pnp_set_resource(struct device *dev, struct resource *resource)
{
+ printk(BIOS_SPEW,
+ "%s: %s %02lx %s\n",
+ __func__, dev_path(dev), resource->index, resource_type(resource));
if (!(resource->flags & IORESOURCE_ASSIGNED)) {
printk(BIOS_ERR,
"ERROR: %s %02lx %s size: 0x%010llx not assigned\n",
@@ -158,6 +161,8 @@
/* Initialize the resource. */
resource->limit = 0xffff;
resource->flags |= IORESOURCE_IO;
+ resource->flags |= IORESOURCE_ASSIGNED;
+ resource->flags |= IORESOURCE_FIXED;
/* Get the resource size. */
moving = info->mask;
@@ -233,17 +238,29 @@
unsigned int functions, struct pnp_info *info)
{
struct device_path path;
- struct device_id id = {.type = DEVICE_ID_PNP };
struct device *dev;
int i;
+ void resource_tree(struct device *dev, int depth);
+
path.type = DEVICE_PATH_PNP;
path.pnp.port = base_dev->path.pnp.port;
+ printk(BIOS_DEBUG,"%s: find_devs base %s PNP port %02x (%d functions.)\n",
+ __func__,base_dev->dtsname,base_dev->path.pnp.port, functions);
/* Setup the ops and resources on the newly allocated devices. */
for (i = 0; i < functions; i++) {
path.pnp.device = info[i].function;
- dev = alloc_find_dev(base_dev->bus, &path, &id);
+ printk(BIOS_DEBUG," find_dev %02x.\n", info[i].function);
+ dev = find_dev_path(&base_dev->link[0], &path);
+ printk(BIOS_DEBUG,"%s: find_dev returns %s(%s).\n",
+ __func__,dev?dev->dtsname:"NULL",dev?dev_path(dev):"");
+ if (!dev) {
+ printk(BIOS_ERR,"No device at PNP port %02x function %x.\n",
+ base_dev->path.pnp.port, info[i].function);
+ continue;
+ }
+
/* Don't initialize a device multiple times. */
if (dev->ops)
@@ -255,5 +272,8 @@
dev->ops = info[i].ops;
}
get_resources(dev, &info[i]);
+
}
+ printk(BIOS_DEBUG,"%s: device %s\n",__func__, base_dev->dtsname);
+ resource_tree(base_dev,0);
}
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot