firmware: Port to RTEMS.

This commit is contained in:
Christian Mauderer 2016-12-12 13:09:09 +01:00
parent 2e8dd24b7c
commit 66eb1437f2
3 changed files with 14 additions and 1 deletions

View File

@ -231,7 +231,7 @@ firmware_unregister(const char *imagename)
/*
* It is ok for the lookup to fail; this can happen
* when a module is unloaded on last reference and the
* module unload handler unregister's each of its
* module unload handler unregister's each of it's
* firmware images.
*/
err = 0;
@ -254,6 +254,7 @@ firmware_unregister(const char *imagename)
return err;
}
#ifndef __rtems__
static void
loadimage(void *arg, int npending)
{
@ -294,6 +295,7 @@ loadimage(void *arg, int npending)
done:
wakeup_one(imagename); /* we're done */
}
#endif /* __rtems__ */
/*
* Lookup and potentially load the specified firmware image.
@ -305,14 +307,17 @@ done:
const struct firmware *
firmware_get(const char *imagename)
{
#ifndef __rtems__
struct task fwload_task;
struct thread *td;
#endif /* __rtems__ */
struct priv_fw *fp;
mtx_lock(&firmware_mtx);
fp = lookup(imagename, NULL);
if (fp != NULL)
goto found;
#ifndef __rtems__
/*
* Image not present, try to load the module holding it.
*/
@ -344,6 +349,9 @@ firmware_get(const char *imagename)
mtx_unlock(&firmware_mtx);
return NULL;
}
#else /* __rtems__ */
return NULL;
#endif /* __rtems__ */
found: /* common exit point on success */
if (fp->refcnt == 0 && fp->parent != NULL)
fp->parent->refcnt++;
@ -379,6 +387,7 @@ firmware_put(const struct firmware *p, int flags)
mtx_unlock(&firmware_mtx);
}
#ifndef __rtems__
/*
* Setup directory state for the firmware_tq thread so we can do i/o.
*/
@ -526,3 +535,4 @@ static moduledata_t firmware_mod = {
};
DECLARE_MODULE(firmware, firmware_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
MODULE_VERSION(firmware, 1);
#endif /* __rtems__ */

View File

@ -237,6 +237,7 @@ def base(mm):
'sys/sys/fail.h',
'sys/sys/filedesc.h',
'sys/sys/file.h',
'sys/sys/firmware.h',
'sys/sys/fnv_hash.h',
'sys/sys/gpio.h',
'sys/sys/hash.h',
@ -355,6 +356,7 @@ def base(mm):
'sys/kern/subr_bus.c',
'sys/kern/subr_counter.c',
'sys/kern/subr_eventhandler.c',
'sys/kern/subr_firmware.c',
'sys/kern/subr_hash.c',
'sys/kern/subr_hints.c',
'sys/kern/subr_kobj.c',

View File

@ -816,6 +816,7 @@ def build(bld):
'freebsd/sys/kern/subr_bus.c',
'freebsd/sys/kern/subr_counter.c',
'freebsd/sys/kern/subr_eventhandler.c',
'freebsd/sys/kern/subr_firmware.c',
'freebsd/sys/kern/subr_hash.c',
'freebsd/sys/kern/subr_hints.c',
'freebsd/sys/kern/subr_kobj.c',