iPXE
Functions | Variables
undionly.c File Reference

"Pure" UNDI driver More...

#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ipxe/device.h>
#include <ipxe/init.h>
#include <ipxe/pci.h>
#include <undi.h>
#include <undinet.h>
#include <undipreload.h>

Go to the source code of this file.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
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 booting)
 Prepare for exit.
struct startup_fn startup_undionly __startup_fn (STARTUP_LATE)

Variables

static struct device undibus_dev
 UNDI root bus device.
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_OR_UBDL  )
static int undibus_probe ( struct root_device rootdev) [static]

Probe UNDI root bus.

Parameters:
rootdevUNDI bus root device

Scans the UNDI bus for devices and registers all devices it can find.

Definition at line 64 of file undionly.c.

References device_description::bus_type, BUS_TYPE_ISAPNP, BUS_TYPE_PCI, device::children, DBG, device::desc, root_device::dev, device_description::device, device::driver_name, ENODEV, undi_device::entry, INIT_LIST_HEAD, undi_device::isapnp_csn, list_add, list_del, device_description::location, device::name, device::parent, PCI_BUS, undi_device::pci_busdevfn, undi_device::pci_device, PCI_FUNC, PCI_SLOT, undi_device::pci_vendor, preloaded_undi, rc, device::siblings, snprintf(), UNDI_NO_ISAPNP_CSN, UNDI_NO_PCI_BUSDEVFN, undibus_dev, undinet_probe(), and device_description::vendor.

                                                         {
        struct undi_device *undi = &preloaded_undi;
        struct device *dev = &undibus_dev;
        int rc;

        /* Check for a valie preloaded UNDI device */
        if ( ! undi->entry.segment ) {
                DBG ( "No preloaded UNDI device found!\n" );
                return -ENODEV;
        }

        /* Add to device hierarchy */
        dev->driver_name = "undionly";
        if ( undi->pci_busdevfn != UNDI_NO_PCI_BUSDEVFN ) {
                dev->desc.bus_type = BUS_TYPE_PCI;
                dev->desc.location = undi->pci_busdevfn;
                dev->desc.vendor = undi->pci_vendor;
                dev->desc.device = undi->pci_device;
                snprintf ( dev->name, sizeof ( dev->name ),
                           "0000:%02x:%02x.%x", PCI_BUS ( undi->pci_busdevfn ),
                           PCI_SLOT ( undi->pci_busdevfn ),
                           PCI_FUNC ( undi->pci_busdevfn ) );
        } else if ( undi->isapnp_csn != UNDI_NO_ISAPNP_CSN ) {
                dev->desc.bus_type = BUS_TYPE_ISAPNP;
                snprintf ( dev->name, sizeof ( dev->name ), "ISAPNP" );
        }
        dev->parent = &rootdev->dev;
        list_add ( &dev->siblings, &rootdev->dev.children);
        INIT_LIST_HEAD ( &dev->children );

        /* Create network device */
        if ( ( rc = undinet_probe ( undi, dev ) ) != 0 )
                goto err;

        return 0;

 err:
        list_del ( &dev->siblings );
        return rc;
}
static void undibus_remove ( struct root_device *rootdev  __unused) [static]

Remove UNDI root bus.

Parameters:
rootdevUNDI bus root device

Definition at line 110 of file undionly.c.

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

                                                                    {
        struct undi_device *undi = &preloaded_undi;
        struct device *dev = &undibus_dev;

        undinet_remove ( undi );
        list_del ( &dev->siblings );
}
static void undionly_shutdown ( int  booting) [static]

Prepare for exit.

Parameters:
bootingSystem is shutting down for OS boot

Definition at line 135 of file undionly.c.

References preloaded_undi, and UNDI_FL_KEEP_ALL.

                                              {
        /* If we are shutting down to boot an OS, clear the "keep PXE
         * stack" flag.
         */
        if ( booting )
                preloaded_undi.flags &= ~UNDI_FL_KEEP_ALL;
}
struct startup_fn startup_undionly __startup_fn ( STARTUP_LATE  ) [read]

Variable Documentation

struct device undibus_dev [static]

UNDI root bus device.

Definition at line 54 of file undionly.c.

Referenced by undibus_probe(), and undibus_remove().

struct root_driver undi_root_driver [static]
Initial value:
 {
        .probe = undibus_probe,
        .remove = undibus_remove,
}

UNDI bus root device driver.

Definition at line 119 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 125 of file undionly.c.