generic check_legacy_ioport

Milton Miller miltonm at bga.com
Sun Apr 22 15:15:19 EST 2007


On 2007-04-21 at 04:51:07, Olaf Hering wrote:
> check_legacy_ioport makes only sense on PREP, CHRP and pSeries.
> They may have an isa node with PS/2, parport, floppy and serial ports.
> Cell has IPMI, check for that too.
> 
> Remove the check_legacy_ioport call from ppc_md, its not needed anymore.
> Hardware capabilities come from the device-tree.

..
> Index: b/arch/powerpc/kernel/setup-common.c
> ===================================================================
> --- a/arch/powerpc/kernel/setup-common.c
> +++ b/arch/powerpc/kernel/setup-common.c
> @@ -498,9 +498,47 @@ void probe_machine(void)
>  
>  int check_legacy_ioport(unsigned long base_port)
>  {
> -	if (ppc_md.check_legacy_ioport == NULL)
> +	struct device_node *np;
> +
> +	switch(base_port) {
> +#ifdef CONFIG_SERIO_I8042
> +	case I8042_DATA_REG:
> +		np = of_find_node_by_type(NULL, "8042");
> +		if (np == NULL)
> +			return -ENODEV;
> +		of_node_put(np);
> +		return 0;
> +#endif
> +#ifdef CONFIG_BLK_DEV_FD
> +	case FDC_BASE: /* FDC1 */
> +		np = of_find_node_by_type(NULL, "fdc");
> +		if (np == NULL)
> +			return -ENODEV;
> +		of_node_put(np);
> +		return 0;
> +#endif
> +#ifdef CONFIG_IPMI_HANDLER
> +	/* IPMI */
> +	case 0xca2:
> +	case 0xca9:
> +	case 0xe4:
> +		np = of_find_node_by_type(NULL, "ipmi");
> +		if (np == NULL)
> +			return -ENODEV;
> +		of_node_put(np);
>  		return 0;
> -	return ppc_md.check_legacy_ioport(base_port);
> +#endif

These are all ifdef'd for the driver being built-in.   Also,
they check that a given type of device exists, but not that
the device is at the expected address.

Can we write someting generic instead that finds the isa
bus, then walks children looking for a direct child that
has a matching reg to the requested port?

If this doesn't catch the cell IPMI case then another
approach is to have a table of (port, expected device type)
and loop rather than the case statement.   

milton



More information about the Linuxppc-dev mailing list