+ /*
+ * For details of old-vs-new scheme, see:
+ * https://github.com/pimoroni/RPi.version/blob/master/RPi/version.py
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=99293&p=690282
+ * (a few posts down)
+ *
+ * For the RPi 1, bit 24 is the "warranty bit", so we mask off just the
+ * lower byte to use as the board rev:
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=63&t=98367&start=250
+ * http://www.raspberrypi.org/forums/viewtopic.php?f=31&t=20594
+ */
+ revision = msg->get_board_rev.body.resp.rev;
+ if (revision & 0x800000) {
+ rev_scheme = 1;
+ rev_type = (revision >> 4) & 0xff;
+ models = rpi_models_new_scheme;
+ models_count = ARRAY_SIZE(rpi_models_new_scheme);
+ } else {
+ rev_scheme = 0;
+ rev_type = revision & 0xff;
+ models = rpi_models_old_scheme;
+ models_count = ARRAY_SIZE(rpi_models_old_scheme);
+ }
+ if (rev_type >= models_count) {
+ printf("RPI: Board rev 0x%x outside known range\n", rev_type);
+ model = &rpi_model_unknown;
+ } else if (!models[rev_type].name) {
+ printf("RPI: Board rev 0x%x unknown\n", rev_type);
+ model = &rpi_model_unknown;
+ } else {
+ model = &models[rev_type];
+ }