FreeBSD/sys/dev/xen/pcifront/pcifront.c
/* The backend is now connected so complete the connection process on our side */
The backend is now connected so complete the connection process on our side
The backend is now connected so complete the connection process on our side
static int
pcifront_connect(struct pcifront_device *pdev)
{
	device_t nexus;
	devclass_t nexus_devclass;
	if (!(nexus_devclass = devclass_find("nexus")) ||
		!(nexus = devclass_get_device(nexus_devclass, 0))) {
		WPRINTF("could not find nexus0!\n");
		return -1;
	}
	pdev->ndev = BUS_ADD_CHILD(nexus, 0, "xpcife", pdev->unit);
	if (!pdev->ndev) {
		WPRINTF("could not create xpcife%d!\n", pdev->unit);
		return -EFAULT;
	}
	get_pdev(pdev);
	device_set_ivars(pdev->ndev, pdev);
	xenbus_switch_state(pdev->xdev, NULL, XenbusStateConnected);
	printf("pcifront: connected to %s\n", pdev->xdev->nodename);
	mtx_lock(&Giant);
	device_probe_and_attach(pdev->ndev);
	mtx_unlock(&Giant);
	return 0;
}
static int pcifront_connect ( struct pcifront_device * pdev ) { device_t nexus ; devclass_t nexus_devclass ; if ( ! ( nexus_devclass = devclass_find ( " " ) ) || ! ( nexus = devclass_get_device ( nexus_devclass , 0 ) ) ) { WPRINTF ( " \n " ) ; return -1 ; } pdev -> ndev = BUS_ADD_CHILD ( nexus , 0 , " " , pdev -> unit ) ; if ( ! pdev -> ndev ) { WPRINTF ( " \n " , pdev -> unit ) ; return - EFAULT ; } get_pdev ( pdev ) ; device_set_ivars ( pdev -> ndev , pdev ) ; xenbus_switch_state ( pdev -> xdev , NULL , XenbusStateConnected ) ; printf ( " \n " , pdev -> xdev -> nodename ) ; mtx_lock ( & Giant ) ; device_probe_and_attach ( pdev -> ndev ) ; mtx_unlock ( & Giant ) ; return 0 ; }
The backend is now connected so complete the connection process on our side
The backend is now connected so complete the connection process on our side
/* We will add our device as a child of the nexus0 device */ /* Create a newbus device representing this frontend instance */ /* Good to go connected now */