aboutsummaryrefslogtreecommitdiffstats
path: root/arch/alpha/kernel/setup.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/alpha/kernel/setup.c')
-rw-r--r--arch/alpha/kernel/setup.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index 2cb9c4380113..fd4a8fa0c93d 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -114,8 +114,6 @@ struct alpha_machine_vector alpha_mv;
114int alpha_using_srm; 114int alpha_using_srm;
115#endif 115#endif
116 116
117#define N(a) (sizeof(a)/sizeof(a[0]))
118
119static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long, 117static struct alpha_machine_vector *get_sysvec(unsigned long, unsigned long,
120 unsigned long); 118 unsigned long);
121static struct alpha_machine_vector *get_sysvec_byname(const char *); 119static struct alpha_machine_vector *get_sysvec_byname(const char *);
@@ -240,7 +238,7 @@ reserve_std_resources(void)
240 standard_io_resources[0].start = RTC_PORT(0); 238 standard_io_resources[0].start = RTC_PORT(0);
241 standard_io_resources[0].end = RTC_PORT(0) + 0x10; 239 standard_io_resources[0].end = RTC_PORT(0) + 0x10;
242 240
243 for (i = 0; i < N(standard_io_resources); ++i) 241 for (i = 0; i < ARRAY_SIZE(standard_io_resources); ++i)
244 request_resource(io, standard_io_resources+i); 242 request_resource(io, standard_io_resources+i);
245} 243}
246 244
@@ -918,13 +916,13 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
918 916
919 /* Search the system tables first... */ 917 /* Search the system tables first... */
920 vec = NULL; 918 vec = NULL;
921 if (type < N(systype_vecs)) { 919 if (type < ARRAY_SIZE(systype_vecs)) {
922 vec = systype_vecs[type]; 920 vec = systype_vecs[type];
923 } else if ((type > ST_API_BIAS) && 921 } else if ((type > ST_API_BIAS) &&
924 (type - ST_API_BIAS) < N(api_vecs)) { 922 (type - ST_API_BIAS) < ARRAY_SIZE(api_vecs)) {
925 vec = api_vecs[type - ST_API_BIAS]; 923 vec = api_vecs[type - ST_API_BIAS];
926 } else if ((type > ST_UNOFFICIAL_BIAS) && 924 } else if ((type > ST_UNOFFICIAL_BIAS) &&
927 (type - ST_UNOFFICIAL_BIAS) < N(unofficial_vecs)) { 925 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_vecs)) {
928 vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS]; 926 vec = unofficial_vecs[type - ST_UNOFFICIAL_BIAS];
929 } 927 }
930 928
@@ -938,11 +936,11 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
938 936
939 switch (type) { 937 switch (type) {
940 case ST_DEC_ALCOR: 938 case ST_DEC_ALCOR:
941 if (member < N(alcor_indices)) 939 if (member < ARRAY_SIZE(alcor_indices))
942 vec = alcor_vecs[alcor_indices[member]]; 940 vec = alcor_vecs[alcor_indices[member]];
943 break; 941 break;
944 case ST_DEC_EB164: 942 case ST_DEC_EB164:
945 if (member < N(eb164_indices)) 943 if (member < ARRAY_SIZE(eb164_indices))
946 vec = eb164_vecs[eb164_indices[member]]; 944 vec = eb164_vecs[eb164_indices[member]];
947 /* PC164 may show as EB164 variation with EV56 CPU, 945 /* PC164 may show as EB164 variation with EV56 CPU,
948 but, since no true EB164 had anything but EV5... */ 946 but, since no true EB164 had anything but EV5... */
@@ -950,24 +948,24 @@ get_sysvec(unsigned long type, unsigned long variation, unsigned long cpu)
950 vec = &pc164_mv; 948 vec = &pc164_mv;
951 break; 949 break;
952 case ST_DEC_EB64P: 950 case ST_DEC_EB64P:
953 if (member < N(eb64p_indices)) 951 if (member < ARRAY_SIZE(eb64p_indices))
954 vec = eb64p_vecs[eb64p_indices[member]]; 952 vec = eb64p_vecs[eb64p_indices[member]];
955 break; 953 break;
956 case ST_DEC_EB66: 954 case ST_DEC_EB66:
957 if (member < N(eb66_indices)) 955 if (member < ARRAY_SIZE(eb66_indices))
958 vec = eb66_vecs[eb66_indices[member]]; 956 vec = eb66_vecs[eb66_indices[member]];
959 break; 957 break;
960 case ST_DEC_MARVEL: 958 case ST_DEC_MARVEL:
961 if (member < N(marvel_indices)) 959 if (member < ARRAY_SIZE(marvel_indices))
962 vec = marvel_vecs[marvel_indices[member]]; 960 vec = marvel_vecs[marvel_indices[member]];
963 break; 961 break;
964 case ST_DEC_TITAN: 962 case ST_DEC_TITAN:
965 vec = titan_vecs[0]; /* default */ 963 vec = titan_vecs[0]; /* default */
966 if (member < N(titan_indices)) 964 if (member < ARRAY_SIZE(titan_indices))
967 vec = titan_vecs[titan_indices[member]]; 965 vec = titan_vecs[titan_indices[member]];
968 break; 966 break;
969 case ST_DEC_TSUNAMI: 967 case ST_DEC_TSUNAMI:
970 if (member < N(tsunami_indices)) 968 if (member < ARRAY_SIZE(tsunami_indices))
971 vec = tsunami_vecs[tsunami_indices[member]]; 969 vec = tsunami_vecs[tsunami_indices[member]];
972 break; 970 break;
973 case ST_DEC_1000: 971 case ST_DEC_1000:
@@ -1039,7 +1037,7 @@ get_sysvec_byname(const char *name)
1039 1037
1040 size_t i; 1038 size_t i;
1041 1039
1042 for (i = 0; i < N(all_vecs); ++i) { 1040 for (i = 0; i < ARRAY_SIZE(all_vecs); ++i) {
1043 struct alpha_machine_vector *mv = all_vecs[i]; 1041 struct alpha_machine_vector *mv = all_vecs[i];
1044 if (strcasecmp(mv->vector_name, name) == 0) 1042 if (strcasecmp(mv->vector_name, name) == 0)
1045 return mv; 1043 return mv;
@@ -1055,13 +1053,13 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1055 1053
1056 /* If not in the tables, make it UNKNOWN, 1054 /* If not in the tables, make it UNKNOWN,
1057 else set type name to family */ 1055 else set type name to family */
1058 if (type < N(systype_names)) { 1056 if (type < ARRAY_SIZE(systype_names)) {
1059 *type_name = systype_names[type]; 1057 *type_name = systype_names[type];
1060 } else if ((type > ST_API_BIAS) && 1058 } else if ((type > ST_API_BIAS) &&
1061 (type - ST_API_BIAS) < N(api_names)) { 1059 (type - ST_API_BIAS) < ARRAY_SIZE(api_names)) {
1062 *type_name = api_names[type - ST_API_BIAS]; 1060 *type_name = api_names[type - ST_API_BIAS];
1063 } else if ((type > ST_UNOFFICIAL_BIAS) && 1061 } else if ((type > ST_UNOFFICIAL_BIAS) &&
1064 (type - ST_UNOFFICIAL_BIAS) < N(unofficial_names)) { 1062 (type - ST_UNOFFICIAL_BIAS) < ARRAY_SIZE(unofficial_names)) {
1065 *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS]; 1063 *type_name = unofficial_names[type - ST_UNOFFICIAL_BIAS];
1066 } else { 1064 } else {
1067 *type_name = sys_unknown; 1065 *type_name = sys_unknown;
@@ -1083,7 +1081,7 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1083 default: /* default to variation "0" for now */ 1081 default: /* default to variation "0" for now */
1084 break; 1082 break;
1085 case ST_DEC_EB164: 1083 case ST_DEC_EB164:
1086 if (member < N(eb164_indices)) 1084 if (member < ARRAY_SIZE(eb164_indices))
1087 *variation_name = eb164_names[eb164_indices[member]]; 1085 *variation_name = eb164_names[eb164_indices[member]];
1088 /* PC164 may show as EB164 variation, but with EV56 CPU, 1086 /* PC164 may show as EB164 variation, but with EV56 CPU,
1089 so, since no true EB164 had anything but EV5... */ 1087 so, since no true EB164 had anything but EV5... */
@@ -1091,32 +1089,32 @@ get_sysnames(unsigned long type, unsigned long variation, unsigned long cpu,
1091 *variation_name = eb164_names[1]; /* make it PC164 */ 1089 *variation_name = eb164_names[1]; /* make it PC164 */
1092 break; 1090 break;
1093 case ST_DEC_ALCOR: 1091 case ST_DEC_ALCOR:
1094 if (member < N(alcor_indices)) 1092 if (member < ARRAY_SIZE(alcor_indices))
1095 *variation_name = alcor_names[alcor_indices[member]]; 1093 *variation_name = alcor_names[alcor_indices[member]];
1096 break; 1094 break;
1097 case ST_DEC_EB64P: 1095 case ST_DEC_EB64P:
1098 if (member < N(eb64p_indices)) 1096 if (member < ARRAY_SIZE(eb64p_indices))
1099 *variation_name = eb64p_names[eb64p_indices[member]]; 1097 *variation_name = eb64p_names[eb64p_indices[member]];
1100 break; 1098 break;
1101 case ST_DEC_EB66: 1099 case ST_DEC_EB66:
1102 if (member < N(eb66_indices)) 1100 if (member < ARRAY_SIZE(eb66_indices))
1103 *variation_name = eb66_names[eb66_indices[member]]; 1101 *variation_name = eb66_names[eb66_indices[member]];
1104 break; 1102 break;
1105 case ST_DEC_MARVEL: 1103 case ST_DEC_MARVEL:
1106 if (member < N(marvel_indices)) 1104 if (member < ARRAY_SIZE(marvel_indices))
1107 *variation_name = marvel_names[marvel_indices[member]]; 1105 *variation_name = marvel_names[marvel_indices[member]];
1108 break; 1106 break;
1109 case ST_DEC_RAWHIDE: 1107 case ST_DEC_RAWHIDE:
1110 if (member < N(rawhide_indices)) 1108 if (member < ARRAY_SIZE(rawhide_indices))
1111 *variation_name = rawhide_names[rawhide_indices[member]]; 1109 *variation_name = rawhide_names[rawhide_indices[member]];
1112 break; 1110 break;
1113 case ST_DEC_TITAN: 1111 case ST_DEC_TITAN:
1114 *variation_name = titan_names[0]; /* default */ 1112 *variation_name = titan_names[0]; /* default */
1115 if (member < N(titan_indices)) 1113 if (member < ARRAY_SIZE(titan_indices))
1116 *variation_name = titan_names[titan_indices[member]]; 1114 *variation_name = titan_names[titan_indices[member]];
1117 break; 1115 break;
1118 case ST_DEC_TSUNAMI: 1116 case ST_DEC_TSUNAMI:
1119 if (member < N(tsunami_indices)) 1117 if (member < ARRAY_SIZE(tsunami_indices))
1120 *variation_name = tsunami_names[tsunami_indices[member]]; 1118 *variation_name = tsunami_names[tsunami_indices[member]];
1121 break; 1119 break;
1122 } 1120 }
@@ -1211,7 +1209,7 @@ show_cpuinfo(struct seq_file *f, void *slot)
1211 1209
1212 cpu_index = (unsigned) (cpu->type - 1); 1210 cpu_index = (unsigned) (cpu->type - 1);
1213 cpu_name = "Unknown"; 1211 cpu_name = "Unknown";
1214 if (cpu_index < N(cpu_names)) 1212 if (cpu_index < ARRAY_SIZE(cpu_names))
1215 cpu_name = cpu_names[cpu_index]; 1213 cpu_name = cpu_names[cpu_index];
1216 1214
1217 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation, 1215 get_sysnames(hwrpb->sys_type, hwrpb->sys_variation,