| 128 | } |
| 129 | |
| 130 | void |
| 131 | cninit(void) |
| 132 | { |
| 133 | struct consdev *best_cn, *cn, **list; |
| 134 | |
| 135 | /* |
| 136 | * Check if we should mute the console (for security reasons perhaps) |
| 137 | * It can be changes dynamically using sysctl kern.consmute |
| 138 | * once we are up and going. |
| 139 | * |
| 140 | */ |
| 141 | cn_mute = ((boothowto & (RB_MUTE |
| 142 | |RB_SINGLE |
| 143 | |RB_VERBOSE |
| 144 | |RB_ASKNAME)) == RB_MUTE); |
| 145 | |
| 146 | /* |
| 147 | * Bring up the kbd layer just in time for cnprobe. Console drivers |
| 148 | * have a dependency on kbd being ready, so this fits nicely between the |
| 149 | * machdep callers of cninit() and MI probing/initialization of consoles |
| 150 | * here. |
| 151 | */ |
| 152 | kbdinit(); |
| 153 | |
| 154 | /* |
| 155 | * Find the first console with the highest priority. |
| 156 | */ |
| 157 | best_cn = NULL; |
| 158 | SET_FOREACH(list, cons_set) { |
| 159 | cn = *list; |
| 160 | cnremove(cn); |
| 161 | /* Skip cons_consdev. */ |
| 162 | if (cn->cn_ops == NULL) |
| 163 | continue; |
| 164 | cn->cn_ops->cn_probe(cn); |
| 165 | if (cn->cn_pri == CN_DEAD) |
| 166 | continue; |
| 167 | if (best_cn == NULL || cn->cn_pri > best_cn->cn_pri) |
| 168 | best_cn = cn; |
| 169 | if (boothowto & RB_MULTIPLE) { |
| 170 | /* |
| 171 | * Initialize console, and attach to it. |
| 172 | */ |
| 173 | cn->cn_ops->cn_init(cn); |
| 174 | cnadd(cn); |
| 175 | } |
| 176 | } |
| 177 | if (best_cn == NULL) |
| 178 | return; |
| 179 | if ((boothowto & RB_MULTIPLE) == 0) { |
| 180 | best_cn->cn_ops->cn_init(best_cn); |
| 181 | cnadd(best_cn); |
| 182 | } |
| 183 | if (boothowto & RB_PAUSE) |
| 184 | console_pausing = 1; |
| 185 | /* |
| 186 | * Make the best console the preferred console. |
| 187 | */ |
no test coverage detected