Early crc32 initialization

From: Matt_Domsch@Dell.com
Date: Wed Nov 20 2002 - 18:01:44 EST


Brian Murphy posted this on 8-Oct with no response. Quoting:

Here is a patch to the crc32 library routine to allow explicit
initialization of the tables used by the routines.

I need this to be able to use the crc routines in the early
start up code for my platform which saves crc protected
information (clock speed, machine type) in an eeprom.

The option CONFIG_CRC32_EXPLICIT is defined for the platforms
which need it in the config.in file.

I have removed dynamic allocation of memory because the
memory subsystem is also not initialised at the stage where I
need the crc functions.

/Brian

The current crc32 library code is set up as a core_initcall because it was
being used by net, usb, fs, and bluetooth subsystem drivers. This isn't
early enough for Brian, whose mips arch CPU needs the code in setup_arch.
He's proposed two solutions:

1) Brian's first patch
http://marc.theaimsgroup.com/?l=linux-kernel&m=103410018005672&w=2
   defines CONFIG_CRC32_EXPLICIT and his code calls init_crc32() as early as
needed.
2) make an early_initcall that happens before setup_arch is called, but
which then touches all arches.

I'm leaning toward:
3) Since kmalloc() isn't available that early, he's switched to a declared
variable. Don't even bother with an init_crc32() - simply declare and fill
the arrays with their values. Add CONFIG_HISCPU to the lib/Makefile to get
it built-in or modular just as every other crc32 user does.

Thoughts?
-Matt

--
Matt Domsch
Sr. Software Engineer, Lead Engineer, Architect
Dell Linux Solutions www.dell.com/linux
Linux on Dell mailing lists @ http://lists.us.dell.com

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:34 EST