[coreboot] #if 0 crud in v3

Carl-Daniel Hailfinger c-d.hailfinger.devel.2006 at gmx.net
Thu Feb 14 02:50:18 CET 2008


device/device.c has code which was dead from the beginning when it was
copied from v2 to v3. It was never enabled in v2 as well. Then again, it
looks like enabling the code might make sense. See below.

> void dev_phase4(void)
> {
> 	struct resource *io, *mem;
> 	struct device *root;
>
> 	printk(BIOS_INFO, "Phase 4: Allocating resources...\n");
>
> 	root = &dev_root;
> 	if (!root->ops) {
> 		printk(BIOS_ERR,
> 		       "Phase 4: dev_root missing ops initialization\nPhase 4: Failed.\n");
> 		return;
> 	}
> 	if (!root->ops->phase4_read_resources) {
> 		printk(BIOS_ERR,
> 		       "dev_root ops missing read_resources\nPhase 4: Failed.\n");
> 		return;
> 	}
>
> 	if (!root->ops->phase4_set_resources) {
> 		printk(BIOS_ERR,
> 		       "dev_root ops missing set_resources\nPhase 4: Failed.\n");
> 		return;
> 	}
>
> 	printk(BIOS_INFO, "Phase 4: Reading resources...\n");
> 	root->ops->phase4_read_resources(root);
> 	printk(BIOS_INFO, "Phase 4: Done reading resources.\n");
>
> 	/* Get the resources. */
> 	io = &root->resource[0];
> 	mem = &root->resource[1];
>
> 	/* Make certain the I/O devices are allocated somewhere safe. */
> 	io->base = DEVICE_IO_START;
> 	io->flags |= IORESOURCE_ASSIGNED;
> 	io->flags &= ~IORESOURCE_STORED;
>
> 	/* Now reallocate the PCI resources memory with the
> 	 * highest addresses I can manage.
> 	 */
> 	mem->base = resource_max(&root->resource[1]);
> 	mem->flags |= IORESOURCE_ASSIGNED;
> 	mem->flags &= ~IORESOURCE_STORED;
>
> #if defined(CONFIG_PCI_OPTION_ROM_RUN) && CONFIG_PCI_OPTION_ROM_RUN == 1
> 	/* Allocate the VGA I/O resource. */
> 	allocate_vga_resource();
> #endif
>
> 	/* Store the computed resource allocations into device registers. */
> 	printk(BIOS_INFO, "Phase 4: Setting resources...\n");
> 	root->ops->phase4_set_resources(root);
> 	printk(BIOS_INFO, "Phase 4: Done setting resources.\n");
> #if 0
>   

Here. The resource allocations have been stored into the device in
root->ops->phase4_set_resources(root); so we probably should set the
IORESOURCE_STORED flag. Then again, that should probably be done inside
phase4_set_resources().
Opinions?

> 	mem->flags |= IORESOURCE_STORED;
> 	report_resource_stored(root, mem, "");
> #endif
>
> 	printk(BIOS_INFO, "Phase 4: Done allocating resources.\n");
> }

Regards,
Carl-Daniel

-- 
http://www.hailfinger.org/





More information about the coreboot mailing list