#include #include #include #include #include #include "avm_hw_config_hw199x.h" /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ struct _avm_hw_config_table avm_hw_config_tables[] = { { .hwrev = 199, .table = avm_hardware_config_hw199x }, /*--- FRITZ!Box Puma6 6460 ---*/ { .hwrev = 204, .table = avm_hardware_config_hw199x }, /*--- FRITZ!Box Puma6 6490 ---*/ { .hwrev = 213, .table = avm_hardware_config_hw199x }, /*--- FRITZ!Box Puma6 6490 neu---*/ { .hwrev = 220, .table = avm_hardware_config_hw199x }, /*--- FRITZ!Box Puma6 6590 ---*/ { .hwrev = 231, .table = avm_hardware_config_hw199x }, /*--- FRITZ!Box Puma6 6430 neu---*/ }; EXPORT_SYMBOL(avm_hw_config_tables); /*------------------------------------------------------------------------------------------*\ \*------------------------------------------------------------------------------------------*/ struct _avm_hw_config *avm_current_hw_config = NULL; EXPORT_SYMBOL(avm_current_hw_config); struct _avm_hw_config *avm_get_hw_config_table(void) { static struct _avm_hw_config *current_config_table = NULL; unsigned int hwrev, hwsubrev, i; char *s; if(current_config_table) { return current_config_table; } s = prom_getenv("HWRevision"); if (s) { hwrev = simple_strtoul(s, NULL, 10); } else { hwrev = 0; } s = prom_getenv("HWSubRevision"); if (s) { hwsubrev = simple_strtoul(s, NULL, 10); } else { hwsubrev = 1; } if(hwrev == 0) { printk("[%s] error: no HWRevision detected in environment variables\n", __FUNCTION__); BUG_ON(1); return NULL; } for(i = 0; i < sizeof(avm_hw_config_tables)/sizeof(struct _avm_hw_config_table); i++) { if(avm_hw_config_tables[i].hwrev == hwrev) { if((avm_hw_config_tables[i].hwsubrev == 0) || (avm_hw_config_tables[i].hwsubrev == hwsubrev)) { current_config_table = avm_hw_config_tables[i].table; return current_config_table; } } } printk("[%s] error: No hardware configuration defined for HWRevision %d\n", __FUNCTION__, hwrev); BUG_ON(1); return NULL; } EXPORT_SYMBOL(avm_get_hw_config_table);