staticvoid *find_section(struct bdb_header *bdb, int section_id)
{
u8 *base = (u8 *)bdb; int index = 0;
u16 total, current_size;
u8 current_id;
/* skip to first section */
index += bdb->header_size;
total = bdb->bdb_size;
/* walk the sections looking for section_id */ while (index < total) {
current_id = *(base + index);
index++;
current_size = *((u16 *)(base + index));
index += 2; if (current_id == section_id) return base + index;
index += current_size;
}
p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); if (!p_defs) {
DRM_DEBUG_KMS("No general definition block is found, unable to construct sdvo mapping.\n"); return;
} /* judge whether the size of child device meets the requirements. *Ifthechilddevicesizeobtainedfromgeneraldefinitionblock *isdifferentwithsizeof(structchild_device_config),skipthe *parsingofsdvodeviceinfo
*/ if (p_defs->child_dev_size != sizeof(*p_child)) { /* different child dev size . Ignore it */
DRM_DEBUG_KMS("different child size is found. Invalid.\n"); return;
} /* get the block size of general definitions */
block_size = get_blocksize(p_defs); /* get the number of child device */
child_device_num = (block_size - sizeof(*p_defs)) / sizeof(*p_child);
count = 0; for (i = 0; i < child_device_num; i++) {
p_child = &(p_defs->devices[i]); if (!p_child->device_type) { /* skip the device block if device type is invalid */ continue;
} if (p_child->target_addr != TARGET_ADDR1 &&
p_child->target_addr != TARGET_ADDR2) { /* *Ifthetargetaddressisneither0x70nor0x72, *itisnotaSDVOdevice.Skipit.
*/ continue;
} if (p_child->dvo_port != DEVICE_PORT_DVOB &&
p_child->dvo_port != DEVICE_PORT_DVOC) { /* skip the incorrect SDVO port */
DRM_DEBUG_KMS("Incorrect SDVO port. Skip it\n"); continue;
}
DRM_DEBUG_KMS("the SDVO device with target addr %2x is found on" " %s port\n",
p_child->target_addr,
(p_child->dvo_port == DEVICE_PORT_DVOB) ? "SDVOB" : "SDVOC");
p_mapping = &(dev_priv->sdvo_mappings[p_child->dvo_port - 1]); if (!p_mapping->initialized) {
p_mapping->dvo_port = p_child->dvo_port;
p_mapping->target_addr = p_child->target_addr;
p_mapping->dvo_wiring = p_child->dvo_wiring;
p_mapping->ddc_pin = p_child->ddc_pin;
p_mapping->i2c_pin = p_child->i2c_pin;
p_mapping->initialized = 1;
DRM_DEBUG_KMS("SDVO device: dvo=%x, addr=%x, wiring=%d, ddc_pin=%d, i2c_pin=%d\n",
p_mapping->dvo_port,
p_mapping->target_addr,
p_mapping->dvo_wiring,
p_mapping->ddc_pin,
p_mapping->i2c_pin);
} else {
DRM_DEBUG_KMS("Maybe one SDVO port is shared by " "two SDVO device.\n");
} if (p_child->target2_addr) { /* Maybe this is a SDVO device with multiple inputs */ /* And the mapping info is not added */
DRM_DEBUG_KMS("there exists the target2_addr. Maybe this" " is a SDVO device with multiple inputs.\n");
}
count++;
}
if (!count) { /* No SDVO device info is found */
DRM_DEBUG_KMS("No SDVO device info is found in VBT\n");
} return;
}
p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS); if (!p_defs) {
DRM_DEBUG_KMS("No general definition block is found, no devices defined.\n"); return;
} /* judge whether the size of child device meets the requirements. *Ifthechilddevicesizeobtainedfromgeneraldefinitionblock *isdifferentwithsizeof(structchild_device_config),skipthe *parsingofsdvodeviceinfo
*/ if (p_defs->child_dev_size != sizeof(*p_child)) { /* different child dev size . Ignore it */
DRM_DEBUG_KMS("different child size is found. Invalid.\n"); return;
} /* get the block size of general definitions */
block_size = get_blocksize(p_defs); /* get the number of child device */
child_device_num = (block_size - sizeof(*p_defs)) / sizeof(*p_child);
count = 0; /* get the number of child devices that are present */ for (i = 0; i < child_device_num; i++) {
p_child = &(p_defs->devices[i]); if (!p_child->device_type) { /* skip the device block if device type is invalid */ continue;
}
count++;
} if (!count) {
DRM_DEBUG_KMS("no child dev is parsed from VBT\n"); return;
}
dev_priv->child_dev = kcalloc(count, sizeof(*p_child), GFP_KERNEL); if (!dev_priv->child_dev) {
DRM_DEBUG_KMS("No memory space for child devices\n"); return;
}
dev_priv->child_dev_num = count;
count = 0; for (i = 0; i < child_device_num; i++) {
p_child = &(p_defs->devices[i]); if (!p_child->device_type) { /* skip the device block if device type is invalid */ continue;
}
child_dev_ptr = dev_priv->child_dev + count;
count++;
memcpy((void *)child_dev_ptr, (void *)p_child, sizeof(*p_child));
} return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.