-/**
- * Get PXE device information for an instantiated device
- *
- * @v pxe PXE device
- * @ret rc Return status code
- */
-static int pxedev_get_instance_info ( struct pxe_device *pxe ) {
- struct s_PXENV pxenv;
- struct s_PXE ppxe;
- struct s_PXENV_UNDI_GET_INFORMATION undi_info;
- int rc;
-
- /* Determine entry point from PXENV+ structure */
- DBGC ( pxe, "PXE %p has PXENV+ structure at %04x:%04x\n", pxe,
- pxe->pxenv.segment, pxe->pxenv.offset );
- copy_from_real ( &pxenv, pxe->pxenv.segment, pxe->pxenv.offset,
- sizeof ( pxenv ) );
- if ( checksum ( &pxenv, sizeof ( pxenv ) ) != 0 ) {
- DBGC ( pxe, "PXE %p bad PXENV+ checksum\n", pxe );
- return -EINVAL;
- }
- pxe->entry = pxenv.RMEntry;
-
- /* If API version is 2.1 or greater, use the !PXE structure instead */
- if ( pxenv.Version >= 0x0201 ) {
- pxe->ppxe = pxenv.PXEPtr;
- DBGC ( pxe, "PXE %p has !PXE structure at %04x:%04x\n", pxe,
- pxe->ppxe.segment, pxe->ppxe.offset );
- copy_from_real ( &ppxe, pxe->ppxe.segment, pxe->ppxe.offset,
- sizeof ( ppxe ) );
- if ( checksum ( &pxenv, sizeof ( pxenv ) ) != 0 ) {
- DBGC ( pxe, "PXE %p bad !PXE checksum\n", pxe );
- return -EINVAL;
- }
- pxe->entry = ppxe.EntryPointSP;
- }
-
- DBGC ( pxe, "PXE %p using entry point at %04x:%04x\n", pxe,
- pxe->entry.segment, pxe->entry.offset );
-
- /* Get device information */
- memset ( &undi_info, 0, sizeof ( undi_info ) );
- if ( ( rc = pxe_call ( pxe, PXENV_UNDI_GET_INFORMATION, &undi_info,
- sizeof ( undi_info ) ) ) != 0 ) {
- DBGC ( pxe, "PXE %p could not retrieve UNDI information: %s\n",
- pxe, strerror ( rc ) );
- return rc;
- }
- memcpy ( pxe->hwaddr, undi_info.PermNodeAddress,
- sizeof ( pxe->hwaddr ) );
- pxe->irq = undi_info.IntNumber;
- pxe->rom_segment = undi_info.ROMAddress;
-
- return 0;
-}
-
-/**
- * Register PXE device
- *
- * @v pxe PXE device
- * @ret rc Return status code
- */
-static int register_pxedev ( struct pxe_device *pxe ) {
- int rc;
-
- DBGC ( pxe, "PXE %p registering\n", pxe );
-
- /* Register as an UNDI driver */
- if ( ( rc = undi_probe ( pxe ) ) != 0 )
- return rc;
-
- /* Add to device hierarchy and return */
- list_add ( &pxe->dev.siblings, &pxe->dev.parent->children );
- return 0;
-}
-