@@ -253,181 +253,4 @@ static void atlx_restore_vlan(struct atlx_adapter *adapter)
253253 atlx_vlan_rx_register (adapter -> netdev , adapter -> vlgrp );
254254}
255255
256- /*
257- * This is the only thing that needs to be changed to adjust the
258- * maximum number of ports that the driver can manage.
259- */
260- #define ATL1_MAX_NIC 4
261-
262- #define OPTION_UNSET -1
263- #define OPTION_DISABLED 0
264- #define OPTION_ENABLED 1
265-
266- #define ATL1_PARAM_INIT { [0 ... ATL1_MAX_NIC] = OPTION_UNSET }
267-
268- /*
269- * Interrupt Moderate Timer in units of 2 us
270- *
271- * Valid Range: 10-65535
272- *
273- * Default Value: 100 (200us)
274- */
275- static int __devinitdata int_mod_timer [ATL1_MAX_NIC + 1 ] = ATL1_PARAM_INIT ;
276- static int num_int_mod_timer ;
277- module_param_array_named (int_mod_timer , int_mod_timer , int ,
278- & num_int_mod_timer , 0 );
279- MODULE_PARM_DESC (int_mod_timer , "Interrupt moderator timer" );
280-
281- /*
282- * flash_vendor
283- *
284- * Valid Range: 0-2
285- *
286- * 0 - Atmel
287- * 1 - SST
288- * 2 - ST
289- *
290- * Default Value: 0
291- */
292- static int __devinitdata flash_vendor [ATL1_MAX_NIC + 1 ] = ATL1_PARAM_INIT ;
293- static int num_flash_vendor ;
294- module_param_array_named (flash_vendor , flash_vendor , int , & num_flash_vendor , 0 );
295- MODULE_PARM_DESC (flash_vendor , "SPI flash vendor" );
296-
297- #define DEFAULT_INT_MOD_CNT 100 /* 200us */
298- #define MAX_INT_MOD_CNT 65000
299- #define MIN_INT_MOD_CNT 50
300-
301- #define FLASH_VENDOR_DEFAULT 0
302- #define FLASH_VENDOR_MIN 0
303- #define FLASH_VENDOR_MAX 2
304-
305- struct atl1_option {
306- enum { enable_option , range_option , list_option } type ;
307- char * name ;
308- char * err ;
309- int def ;
310- union {
311- struct { /* range_option info */
312- int min ;
313- int max ;
314- } r ;
315- struct { /* list_option info */
316- int nr ;
317- struct atl1_opt_list {
318- int i ;
319- char * str ;
320- } * p ;
321- } l ;
322- } arg ;
323- };
324-
325- static int __devinit atl1_validate_option (int * value , struct atl1_option * opt ,
326- struct pci_dev * pdev )
327- {
328- if (* value == OPTION_UNSET ) {
329- * value = opt -> def ;
330- return 0 ;
331- }
332-
333- switch (opt -> type ) {
334- case enable_option :
335- switch (* value ) {
336- case OPTION_ENABLED :
337- dev_info (& pdev -> dev , "%s enabled\n" , opt -> name );
338- return 0 ;
339- case OPTION_DISABLED :
340- dev_info (& pdev -> dev , "%s disabled\n" , opt -> name );
341- return 0 ;
342- }
343- break ;
344- case range_option :
345- if (* value >= opt -> arg .r .min && * value <= opt -> arg .r .max ) {
346- dev_info (& pdev -> dev , "%s set to %i\n" , opt -> name ,
347- * value );
348- return 0 ;
349- }
350- break ;
351- case list_option :{
352- int i ;
353- struct atl1_opt_list * ent ;
354-
355- for (i = 0 ; i < opt -> arg .l .nr ; i ++ ) {
356- ent = & opt -> arg .l .p [i ];
357- if (* value == ent -> i ) {
358- if (ent -> str [0 ] != '\0' )
359- dev_info (& pdev -> dev , "%s\n" ,
360- ent -> str );
361- return 0 ;
362- }
363- }
364- }
365- break ;
366-
367- default :
368- break ;
369- }
370-
371- dev_info (& pdev -> dev , "invalid %s specified (%i) %s\n" ,
372- opt -> name , * value , opt -> err );
373- * value = opt -> def ;
374- return -1 ;
375- }
376-
377- /*
378- * atl1_check_options - Range Checking for Command Line Parameters
379- * @adapter: board private structure
380- *
381- * This routine checks all command line parameters for valid user
382- * input. If an invalid value is given, or if no user specified
383- * value exists, a default value is used. The final value is stored
384- * in a variable in the adapter structure.
385- */
386- void __devinit atl1_check_options (struct atl1_adapter * adapter )
387- {
388- struct pci_dev * pdev = adapter -> pdev ;
389- int bd = adapter -> bd_number ;
390- if (bd >= ATL1_MAX_NIC ) {
391- dev_notice (& pdev -> dev , "no configuration for board#%i\n" , bd );
392- dev_notice (& pdev -> dev , "using defaults for all values\n" );
393- }
394- { /* Interrupt Moderate Timer */
395- struct atl1_option opt = {
396- .type = range_option ,
397- .name = "Interrupt Moderator Timer" ,
398- .err = "using default of "
399- __MODULE_STRING (DEFAULT_INT_MOD_CNT ),
400- .def = DEFAULT_INT_MOD_CNT ,
401- .arg = {.r = {.min = MIN_INT_MOD_CNT ,
402- .max = MAX_INT_MOD_CNT } }
403- };
404- int val ;
405- if (num_int_mod_timer > bd ) {
406- val = int_mod_timer [bd ];
407- atl1_validate_option (& val , & opt , pdev );
408- adapter -> imt = (u16 ) val ;
409- } else
410- adapter -> imt = (u16 ) (opt .def );
411- }
412-
413- { /* Flash Vendor */
414- struct atl1_option opt = {
415- .type = range_option ,
416- .name = "SPI Flash Vendor" ,
417- .err = "using default of "
418- __MODULE_STRING (FLASH_VENDOR_DEFAULT ),
419- .def = DEFAULT_INT_MOD_CNT ,
420- .arg = {.r = {.min = FLASH_VENDOR_MIN ,
421- .max = FLASH_VENDOR_MAX } }
422- };
423- int val ;
424- if (num_flash_vendor > bd ) {
425- val = flash_vendor [bd ];
426- atl1_validate_option (& val , & opt , pdev );
427- adapter -> hw .flash_vendor = (u8 ) val ;
428- } else
429- adapter -> hw .flash_vendor = (u8 ) (opt .def );
430- }
431- }
432-
433256#endif /* ATLX_C */
0 commit comments