/* Check if this configuration has any chance of working */ if (tot_bw > target.maxbw) {
dev_err(&td->dev, "isochronous bandwidth required " "by AGP 3.0 devices exceeds that which is supported by " "the AGP 3.0 bridge!\n");
ret = -ENODEV; goto free_and_exit;
}
/* Calculate the minimum ISOCH_N needed by each master */ for (cdev=0; cdev<ndevs; cdev++) {
master[cdev].y = target.y;
master[cdev].n = master[cdev].maxbw / (master[cdev].y + 1);
tot_n += master[cdev].n;
}
/* Exit if the minimal ISOCH_N allocation among the masters is more
* than the target can handle. */ if (tot_n > target.n) {
dev_err(&td->dev, "number of isochronous " "transactions per period required by AGP 3.0 devices " "exceeds that which is supported by the AGP 3.0 " "bridge!\n");
ret = -ENODEV; goto free_and_exit;
}
/* Calculate left over ISOCH_N capability in the target. We'll give
* this to the hungriest device (as per the spec) */
rem = target.n - tot_n;
/* Figure the number of isochronous and asynchronous RQ slots the
* target is providing. */
rq_isoch = (target.y > 0x1) ? target.n * (1 << (target.y - 1)) : target.n;
rq_async = target.rq - rq_isoch;
/* Exit if the minimal RQ needs of the masters exceeds what the target
* can provide. */ if (tot_rq > rq_isoch) {
dev_err(&td->dev, "number of request queue slots " "required by the isochronous bandwidth requested by " "AGP 3.0 devices exceeds the number provided by the " "AGP 3.0 bridge!\n");
ret = -ENODEV; goto free_and_exit;
}
/* Calculate asynchronous RQ capability in the target (per master) as
* well as the total number of leftover isochronous RQ slots. */
step = rq_async / ndevs;
rem_async = step + (rq_async % ndevs);
rem_isoch = rq_isoch - tot_rq;
/* Distribute the extra RQ slots calculated above and write our
* isochronous settings out to the actual devices. */ for (cdev=0; cdev<ndevs; cdev++) {
cur = master[cdev].dev;
dev = cur->dev;
/* Extract some power-on defaults from the target */
pci_read_config_dword(td, bridge->capndx+AGPSTAT, &tstatus);
isoch = (tstatus >> 17) & 0x1; if (isoch == 0) /* isoch xfers not available, bail out. */ return -ENODEV;
/* *AllocateaheadforourAGP3.5devicelist *(multipleAGPv3devicesareallowedbehindasinglebridge).
*/ if ((dev_list = kmalloc(sizeof(*dev_list), GFP_KERNEL)) == NULL) {
ret = -ENOMEM; goto get_out;
}
head = &dev_list->list;
INIT_LIST_HEAD(head);
/* Find all AGP devices, and add them to dev_list. */
for_each_pci_dev(dev) {
mcapndx = pci_find_capability(dev, PCI_CAP_ID_AGP); if (mcapndx == 0) continue;
switch ((dev->class >>8) & 0xff00) { case0x0600: /* Bridge */ /* Skip bridges. We should call this function for each one. */ continue;
case0x0001: /* Unclassified device */ /* Don't know what this is, but log it for investigation. */ if (mcapndx != 0) {
dev_info(&td->dev, "wacky, found unclassified AGP device %s [%04x/%04x]\n",
pci_name(dev),
dev->vendor, dev->device);
} continue;
/* *Takeaninitialpassthroughthedeviceslyingbehindourhost *bridge.MakesureeachoneisactuallyanAGP3.0device,otherwise *exitwithanerrormessage.AlongthewaystoretheAGP3.0 *cap_ptrforeachdevice
*/
list_for_each(pos, head) {
cur = list_entry(pos, struct agp_3_5_dev, list);
dev = cur->dev;
pci_read_config_word(dev, PCI_STATUS, &mpstat); if ((mpstat & PCI_STATUS_CAP_LIST) == 0) continue;
pci_read_config_byte(dev, PCI_CAPABILITY_LIST, &mcapndx); if (mcapndx != 0) { do {
pci_read_config_dword(dev, mcapndx, &ncapid); if ((ncapid & 0xff) != 2)
mcapndx = (ncapid >> 8) & 0xff;
} while (((ncapid & 0xff) != 2) && (mcapndx != 0));
}
if (mcapndx == 0) {
dev_err(&td->dev, "woah! Non-AGP device %s on " "secondary bus of AGP 3.5 bridge!\n",
pci_name(dev));
ret = -ENODEV; goto free_and_exit;
}
mmajor = (ncapid >> AGP_MAJOR_VERSION_SHIFT) & 0xf; if (mmajor < 3) {
dev_err(&td->dev, "woah! AGP 2.0 device %s on " "secondary bus of AGP 3.5 bridge operating " "with AGP 3.0 electricals!\n", pci_name(dev));
ret = -ENODEV; goto free_and_exit;
}
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.