Beispiel #1
0
static int
xf86ClaimPlatformSlot(struct xf86_platform_device * d, DriverPtr drvp,
                  int chipset, GDevPtr dev, Bool active)
{
    EntityPtr p = NULL;
    int num;

    if (xf86_check_platform_slot(d)) {
        num = xf86AllocateEntity();
        p = xf86Entities[num];
        p->driver = drvp;
        p->chipset = chipset;
        p->bus.type = BUS_PLATFORM;
        p->bus.id.plat = d;
        p->active = active;
        p->inUse = FALSE;
        if (dev)
            xf86AddDevToEntity(num, dev);

        platformSlotClaimed++;
        return num;
    }
    else
        return -1;
}
int
xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
		  GDevPtr dev, Bool active)
{
    EntityPtr p = NULL;

    int num;

    if (xf86CheckSbusSlot(psdp->fbNum)) {
        num = xf86AllocateEntity();
        p = xf86Entities[num];
        p->driver = drvp;
        p->chipset = -1;
        p->busType = BUS_SBUS;
        xf86AddDevToEntity(num, dev);
        p->sbusBusId.fbNum = psdp->fbNum;
        p->active = active;
        p->inUse = FALSE;
        /* Here we initialize the access structure */
        p->access = xnfcalloc(1,sizeof(EntityAccessRec));
	p->access->fallback = &AccessNULL;
        p->access->pAccess = &AccessNULL;
	sbusSlotClaimed = TRUE;
	return num;
    } else
	return -1;
}
Beispiel #3
0
int
xf86ClaimPciSlot(struct pci_device *d, DriverPtr drvp,
                 int chipset, GDevPtr dev, Bool active)
{
    EntityPtr p = NULL;
    int num;

    if (xf86CheckPciSlot(d)) {
        num = xf86AllocateEntity();
        p = xf86Entities[num];
        p->driver = drvp;
        p->chipset = chipset;
        p->bus.type = BUS_PCI;
        p->bus.id.pci = d;
        p->active = active;
        p->inUse = FALSE;
        if (dev)
            xf86AddDevToEntity(num, dev);
        pciSlotClaimed++;

        return num;
    }
    else
        return -1;
}
Beispiel #4
0
_X_EXPORT int
xf86MatchSbusInstances(const char *driverName, int sbusDevId,
		       GDevPtr *devList, int numDevs, DriverPtr drvp,
		       int **foundEntities)
{
	int *retEntities = NULL;
	EntityPtr p = NULL;
	int num;

	*foundEntities = NULL;
	if (sbusDevId == sbusInfo.devId) {
		if (xf86DoConfigure && xf86DoConfigurePass1) {
			GDevPtr pGDev;

			pGDev = xf86AddBusDeviceToConfigure(drvp->driverName,
							    BUS_SBUS,
							    &sbusInfo, -1);
			if (pGDev) {
				/*
				 * XF86Match???Instances() treat
				 * chipID and chipRev as overrides, so
				 * clobber them here.
				 */
				pGDev->chipID = pGDev->chipRev = -1;
			}
			return 1;
		}

		sbusInfo.device = devList[0]->identifier;
		num = xf86AllocateEntity();
		p = xf86Entities[num];
		p->driver = drvp;
		p->chipset = -1;
		p->bus.type = BUS_SBUS;
		xf86AddDevToEntity(num, devList[0]);
		p->active = TRUE;
		p->inUse = FALSE;
		retEntities = malloc(sizeof(int));
		retEntities[0] = num;
		*foundEntities = retEntities;
		return 1;
	}

	return 0;
}
Beispiel #5
0
_X_EXPORT int
xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active)
{
    EntityPtr p;
    int num;
    
    num = xf86AllocateEntity();
    p = xf86Entities[num];
    p->driver = drvp;
    p->chipset = 0;
    p->busType = BUS_NONE;
    p->active = active;
    p->inUse = FALSE;
    xf86AddDevToEntity(num, dev);
    p->access = xnfcalloc(1,sizeof(EntityAccessRec));
    p->access->fallback = &AccessNULL;
    p->access->pAccess = &AccessNULL;
    p->busAcc = NULL;

    return num;
}
Beispiel #6
0
int
xf86ClaimSbusSlot(sbusDevicePtr psdp, DriverPtr drvp,
		  GDevPtr dev, Bool active)
{
    EntityPtr p = NULL;

    int num;

    if (xf86CheckSbusSlot(psdp->fbNum)) {
        num = xf86AllocateEntity();
        p = xf86Entities[num];
        p->driver = drvp;
        p->chipset = -1;
        p->bus.type = BUS_SBUS;
        xf86AddDevToEntity(num, dev);
        p->bus.id.sbus.fbNum = psdp->fbNum;
        p->active = active;
        p->inUse = FALSE;
	sbusSlotClaimed = TRUE;
	return num;
    } else
	return -1;
}