[coreboot] [PATCH] Enable/Disable IDE 0/1 i82801xx

Stefan Reinauer stepan at coresystems.de
Wed May 27 09:29:22 CEST 2009


On 27.05.2009 6:08 Uhr, Joseph Smith wrote:
>  
>  extern struct chip_operations southbridge_intel_i82801xx_ops;
> Index: src/southbridge/intel/i82801xx/i82801xx_ide.c
> ===================================================================
> --- src/southbridge/intel/i82801xx/i82801xx_ide.c	(revision 4311)
> +++ src/southbridge/intel/i82801xx/i82801xx_ide.c	(working copy)
> @@ -27,29 +27,36 @@
>  #include <device/pci_ids.h>
>  #include "i82801xx.h"
>  
> +typedef struct southbridge_intel_i82801xx_config config_t;
> +
>  static void ide_init(struct device *dev)
>  {
> +	/* Get the chip configuration */
> +	config_t *config = dev->chip_info; 
> +
>  	/* TODO: Needs to be tested for compatibility with ICH5(R). */
>  	/* Enable IDE devices so the Linux IDE driver will work. */
>  	uint16_t ideTimingConfig;
> -	int enable_primary = 1;
> -	int enable_secondary = 1;
>  
>  	ideTimingConfig = pci_read_config16(dev, IDE_TIM_PRI);
>  	ideTimingConfig &= ~IDE_DECODE_ENABLE;
> -	if (enable_primary) {
> +	if (config->ide0_enable) {
>   

You should check if config is not NULL before accessing it or you might
silently read a config_t at the start of memory, which tells you that
all interrupts are configured to zero and both IDEs are disabled. This
was a tricky find for me once.

It will be NULL if the device 1f.2 (or whatever your IDE is) is not
present in Config.lb. 


Maybe you want to check

if (!config || config->ide0_enable) { ... } // enable is default if
config is NULL

or you print a message that the user should fix the Config.lb file.

Other than that..

Acked-by: Stefan Reinauer <stepan at coresystems.de>


All the best,
Stefan

-- 
coresystems GmbH • Brahmsstr. 16 • D-79104 Freiburg i. Br.
      Tel.: +49 761 7668825 • Fax: +49 761 7664613
Email: info at coresystems.dehttp://www.coresystems.de/
Registergericht: Amtsgericht Freiburg • HRB 7656
Geschäftsführer: Stefan Reinauer • Ust-IdNr.: DE245674866





More information about the coreboot mailing list