Intel Wi-Fi Init Path

  • In this section, you are going to learn

  • Wi-Fi init path

#

Version

Freebsd

14.1.0

wpa_supplicant

2.10

  • Abstract representation of a device

  • Defined in /usr/src/stand/kshim/bsd_kernel.h

typedef struct device *device_t;

struct device {
        TAILQ_HEAD(device_list, device) dev_children;
        TAILQ_ENTRY(device) dev_link;

        struct device *dev_parent;
        const struct module_data *dev_module;
        void   *dev_sc;
        void   *dev_aux;
        driver_filter_t *dev_irq_filter;
        driver_intr_t *dev_irq_fn;
        void   *dev_irq_arg;

        uint16_t dev_unit;

        char    dev_nameunit[64];
        char    dev_desc[64];

        uint8_t dev_res_alloc:1;
        uint8_t dev_quiet:1;
        uint8_t dev_softc_set:1;
        uint8_t dev_softc_alloc:1;
        uint8_t dev_attached:1;
        uint8_t dev_fixed_class:1;
        uint8_t dev_unit_manual:1;
};
  • The device object represents a piece of hardware attached to the system.

  • Ex: expansion card, the bus which that card is plugged into, disk drives attached to the expansion card, …

  • The system defines one device, - root_bus.

  • All other devices are created dynamically during auto configuration.

  • device_probe_and_attach()

    • initialise a device

    • This function is called during autoconfiguration to initialise the devices in the system.

    • For each device, the DEVICE_PROBE method of each suitable driver is called and if a probe succeeds, a description of the device is printed and the DEVICE_ATTACH method is called

  • DEVICE_PROBE

    • Probe for device existence

    • Method should probe to see if the device is present.

  • DEVICE_ATTACH

    • Attach a device

    • Attach a device to the system after the DEVICE_PROBE() method has been called and has indicated that the device exists

  • structure describing a device driver

  • Defined in /usr/src/stand/kshim/bsd_kernel.h

test:~$ typedef struct driver driver_t;

struct driver {
        const char * name;
        const struct device_method *methods;
        uint32_t size;
};
  • Driver is registered with the system by the DRIVER_MODULE macro

  • Each driver will implement one or more sets of methods called interfaces

  • Ex: methods from Device interface, methods from Bus interface

  1. wlan(net80211 driver)

  2. linuxkpi(linux kernel functions and drivers to work on FreeBSD)

  3. iwlwifi(enter intel driver)

device_probe_and_attach()

        device_probe()

                pci_probe() // pci controller

        device_attach()

                pci_attach() // pci controller