1 /* 2 * errata functions 3 * 4 * This code is free software; you can redistribute it and/or modify it 5 * under the terms of the GNU Library General Public License version 2. 6 */ 7 #ifndef _ERRATA_H_ 8 #define _ERRATA_H_ 9 #include "config.h" 10 11 #ifndef CONFIG_ERRATA_FORCE 12 #define CONFIG_ERRATA_FORCE 0 13 #endif 14 15 #define _ERRATA(erratum) errata("ERRATA_" # erratum) 16 #define ERRATA(erratum) _ERRATA(erratum) 17 18 #define _ERRATA_RELAXED(erratum) errata_relaxed("ERRATA_" # erratum) 19 #define ERRATA_RELAXED(erratum) _ERRATA_RELAXED(erratum) 20 21 static inline bool errata_force(void) 22 { 23 char *s; 24 25 if (CONFIG_ERRATA_FORCE == 1) 26 return true; 27 28 s = getenv("ERRATA_FORCE"); 29 return s && (*s == '1' || *s == 'y' || *s == 'Y'); 30 } 31 32 static inline bool errata(const char *erratum) 33 { 34 char *s; 35 36 if (errata_force()) 37 return true; 38 39 s = getenv(erratum); 40 41 return s && (*s == '1' || *s == 'y' || *s == 'Y'); 42 } 43 44 static inline bool errata_relaxed(const char *erratum) 45 { 46 char *s; 47 48 if (errata_force()) 49 return true; 50 51 s = getenv(erratum); 52 53 return !(s && (*s == '0' || *s == 'n' || *s == 'N')); 54 } 55 56 #endif 57