FreeBSD kernel kern code
subr_firmware.c File Reference
#include <sys/cdefs.h>
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
#include <sys/queue.h>
#include <sys/taskqueue.h>
#include <sys/systm.h>
#include <sys/lock.h>
#include <sys/mutex.h>
#include <sys/errno.h>
#include <sys/linker.h>
#include <sys/firmware.h>
#include <sys/priv.h>
#include <sys/proc.h>
#include <sys/module.h>
#include <sys/eventhandler.h>
#include <sys/filedesc.h>
#include <sys/vnode.h>
Include dependency graph for subr_firmware.c:

Go to the source code of this file.

Data Structures

struct  priv_fw
 
struct  fw_loadimage
 

Macros

#define FW_UNLOAD   0x100
 
#define PRIV_FW(x)
 

Functions

 __FBSDID ("$FreeBSD$")
 
static LIST_HEAD (priv_fw)
 
const struct firmware * firmware_register (const char *imagename, const void *data, size_t datasize, unsigned int version, const struct firmware *parent)
 
int firmware_unregister (const char *imagename)
 
static void loadimage (void *arg, int npending __unused)
 
const struct firmware * firmware_get_flags (const char *imagename, uint32_t flags)
 
const struct firmware * firmware_get (const char *imagename)
 
void firmware_put (const struct firmware *p, int flags)
 
static void set_rootvnode (void *arg, int npending)
 
static void firmware_mountroot (void *arg)
 
 EVENTHANDLER_DEFINE (mountroot, firmware_mountroot, NULL, 0)
 
static void unloadentry (void *unused1, int unused2)
 
static int firmware_modevent (module_t mod, int type, void *unused)
 
 DECLARE_MODULE (firmware, firmware_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST)
 
 MODULE_VERSION (firmware, 1)
 

Variables

static moduledata_t firmware_mod
 

Macro Definition Documentation

◆ FW_UNLOAD

#define FW_UNLOAD   0x100

◆ PRIV_FW

#define PRIV_FW (   x)
Value:
((struct priv_fw *) \
((intptr_t)(x) - offsetof(struct priv_fw, fw)) )

Definition at line 116 of file subr_firmware.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ DECLARE_MODULE()

DECLARE_MODULE ( firmware  ,
firmware_mod  ,
SI_SUB_DRIVERS  ,
SI_ORDER_FIRST   
)

◆ EVENTHANDLER_DEFINE()

EVENTHANDLER_DEFINE ( mountroot  ,
firmware_mountroot  ,
NULL  ,
 
)

◆ firmware_get()

const struct firmware * firmware_get ( const char *  imagename)

Definition at line 342 of file subr_firmware.c.

References firmware_get_flags().

Here is the call graph for this function:

◆ firmware_get_flags()

const struct firmware * firmware_get_flags ( const char *  imagename,
uint32_t  flags 
)

Definition at line 288 of file subr_firmware.c.

References fw_loadimage::flags, flags, fw_loadimage::imagename, loadimage(), printf(), priv_check(), priv_fw::refcnt, securelevel_gt(), and taskqueue_enqueue().

Referenced by firmware_get().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ firmware_modevent()

static int firmware_modevent ( module_t  mod,
int  type,
void *  unused 
)
static

◆ firmware_mountroot()

static void firmware_mountroot ( void *  arg)
static

Definition at line 391 of file subr_firmware.c.

References malloc(), printf(), set_rootvnode(), and taskqueue_enqueue().

Referenced by firmware_modevent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ firmware_put()

void firmware_put ( const struct firmware *  p,
int  flags 
)

Definition at line 358 of file subr_firmware.c.

References flags, FW_UNLOAD, PRIV_FW, priv_fw::refcnt, and taskqueue_enqueue().

Here is the call graph for this function:

◆ firmware_register()

const struct firmware * firmware_register ( const char *  imagename,
const void *  data,
size_t  datasize,
unsigned int  version,
const struct firmware *  parent 
)

Definition at line 167 of file subr_firmware.c.

References bootverbose, data, free(), malloc(), name, parent, printf(), and PRIV_FW.

Here is the call graph for this function:

◆ firmware_unregister()

int firmware_unregister ( const char *  imagename)

Definition at line 214 of file subr_firmware.c.

References free(), and priv_fw::refcnt.

Here is the call graph for this function:

◆ LIST_HEAD()

static LIST_HEAD ( priv_fw  )
static

Definition at line 122 of file subr_firmware.c.

◆ loadimage()

static void loadimage ( void *  arg,
int npending  __unused 
)
static

Definition at line 247 of file subr_firmware.c.

References bootverbose, fw_loadimage::flags, fw_loadimage::imagename, linker_reference_module(), linker_release_module(), printf(), result, and wakeup_one().

Referenced by firmware_get_flags().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ MODULE_VERSION()

MODULE_VERSION ( firmware  ,
 
)

◆ set_rootvnode()

static void set_rootvnode ( void *  arg,
int  npending 
)
static

Definition at line 379 of file subr_firmware.c.

References free(), and pwd_ensure_dirs().

Referenced by firmware_mountroot().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unloadentry()

static void unloadentry ( void *  unused1,
int  unused2 
)
static

Definition at line 412 of file subr_firmware.c.

References FW_UNLOAD, linker_release_module(), and priv_fw::refcnt.

Referenced by firmware_modevent().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ firmware_mod

moduledata_t firmware_mod
static
Initial value:
= {
"firmware",
NULL
}
static int firmware_modevent(module_t mod, int type, void *unused)

Definition at line 502 of file subr_firmware.c.