undionly.c File Reference

"Pure" UNDI driver More...

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <gpxe/device.h>
#include <gpxe/init.h>
#include <undi.h>
#include <undinet.h>
#include <undipreload.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER)
static int undibus_probe (struct root_device *rootdev)
 Probe UNDI root bus.
static void undibus_remove (struct root_device *rootdev __unused)
 Remove UNDI root bus.
static void undionly_shutdown (int flags)
 Prepare for exit.
struct startup_fn startup_undionly __startup_fn (STARTUP_LATE)

Variables

static struct root_driver undi_root_driver
 UNDI bus root device driver.
struct root_device undi_root_device __root_device
 UNDI bus root device.


Detailed Description

"Pure" UNDI driver

This is the UNDI driver without explicit support for PCI or any other bus type. It is capable only of using the preloaded UNDI device. It must not be combined in an image with any other drivers.

If you want a PXE-loadable image that contains only the UNDI driver, build "bin/undionly.kpxe".

If you want any other image format, or any other drivers in addition to the UNDI driver, build e.g. "bin/undi.dsk".

Definition in file undionly.c.


Function Documentation

FILE_LICENCE ( GPL2_OR_LATER   ) 

static int undibus_probe ( struct root_device rootdev  )  [static]

Probe UNDI root bus.

Parameters:
rootdev UNDI bus root device
Scans the UNDI bus for devices and registers all devices it can find.

Definition at line 54 of file undionly.c.

References device_description::bus_type, BUS_TYPE_ISAPNP, BUS_TYPE_PCI, device::children, DBG, device::desc, root_device::dev, undi_device::dev, device_description::device, ENODEV, undi_device::entry, INIT_LIST_HEAD, undi_device::isapnp_csn, list_add, list_del, device_description::location, device::name, device::parent, undi_device::pci_busdevfn, undi_device::pci_device, undi_device::pci_vendor, preloaded_undi, s_SEGOFF16::segment, device::siblings, strncpy(), UNDI_NO_ISAPNP_CSN, UNDI_NO_PCI_BUSDEVFN, undinet_probe(), and device_description::vendor.

00054                                                          {
00055         struct undi_device *undi = &preloaded_undi;
00056         int rc;
00057 
00058         /* Check for a valie preloaded UNDI device */
00059         if ( ! undi->entry.segment ) {
00060                 DBG ( "No preloaded UNDI device found!\n" );
00061                 return -ENODEV;
00062         }
00063 
00064         /* Add to device hierarchy */
00065         strncpy ( undi->dev.name, "UNDI",
00066                   ( sizeof ( undi->dev.name ) - 1 ) );
00067         if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
00068                 undi->dev.desc.bus_type = BUS_TYPE_PCI;
00069                 undi->dev.desc.location = undi->pci_busdevfn;
00070                 undi->dev.desc.vendor = undi->pci_vendor;
00071                 undi->dev.desc.device = undi->pci_device;
00072         } else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
00073                 undi->dev.desc.bus_type = BUS_TYPE_ISAPNP;
00074         }
00075         undi->dev.parent = &rootdev->dev;
00076         list_add ( &undi->dev.siblings, &rootdev->dev.children);
00077         INIT_LIST_HEAD ( &undi->dev.children );
00078 
00079         /* Create network device */
00080         if ( ( rc = undinet_probe ( undi ) ) != 0 )
00081                 goto err;
00082 
00083         return 0;
00084 
00085  err:
00086         list_del ( &undi->dev.siblings );
00087         return rc;
00088 }

static void undibus_remove ( struct root_device *rootdev  __unused  )  [static]

Remove UNDI root bus.

Parameters:
rootdev UNDI bus root device

Definition at line 95 of file undionly.c.

References undi_device::dev, list_del, preloaded_undi, device::siblings, and undinet_remove().

00095                                                                     {
00096         struct undi_device *undi = &preloaded_undi;
00097 
00098         undinet_remove ( undi );
00099         list_del ( &undi->dev.siblings );
00100 }

static void undionly_shutdown ( int  flags  )  [static]

Prepare for exit.

Parameters:
flags Shutdown flags

Definition at line 119 of file undionly.c.

References preloaded_undi, SHUTDOWN_BOOT, and UNDI_FL_KEEP_ALL.

00119                                             {
00120         /* If we are shutting down to boot an OS, clear the "keep PXE
00121          * stack" flag.
00122          */
00123         if ( flags & SHUTDOWN_BOOT )
00124                 preloaded_undi.flags &= ~UNDI_FL_KEEP_ALL;
00125 }

struct startup_fn startup_undionly __startup_fn ( STARTUP_LATE   )  [read]


Variable Documentation

struct root_driver undi_root_driver [static]

Initial value:

 {
        .probe = undibus_probe,
        .remove = undibus_remove,
}
UNDI bus root device driver.

Definition at line 103 of file undionly.c.

struct root_device undi_root_device __root_device

Initial value:

 {
        .dev = { .name = "UNDI" },
        .driver = &undi_root_driver,
}
UNDI bus root device.

Definition at line 109 of file undionly.c.


Generated on Tue Apr 6 20:01:12 2010 for gPXE by  doxygen 1.5.7.1