mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-26 14:32:44 +08:00
firmware: Port to RTEMS.
This commit is contained in:
parent
2e8dd24b7c
commit
66eb1437f2
@ -231,7 +231,7 @@ firmware_unregister(const char *imagename)
|
|||||||
/*
|
/*
|
||||||
* It is ok for the lookup to fail; this can happen
|
* It is ok for the lookup to fail; this can happen
|
||||||
* when a module is unloaded on last reference and the
|
* 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.
|
* firmware images.
|
||||||
*/
|
*/
|
||||||
err = 0;
|
err = 0;
|
||||||
@ -254,6 +254,7 @@ firmware_unregister(const char *imagename)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
static void
|
static void
|
||||||
loadimage(void *arg, int npending)
|
loadimage(void *arg, int npending)
|
||||||
{
|
{
|
||||||
@ -294,6 +295,7 @@ loadimage(void *arg, int npending)
|
|||||||
done:
|
done:
|
||||||
wakeup_one(imagename); /* we're done */
|
wakeup_one(imagename); /* we're done */
|
||||||
}
|
}
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Lookup and potentially load the specified firmware image.
|
* Lookup and potentially load the specified firmware image.
|
||||||
@ -305,14 +307,17 @@ done:
|
|||||||
const struct firmware *
|
const struct firmware *
|
||||||
firmware_get(const char *imagename)
|
firmware_get(const char *imagename)
|
||||||
{
|
{
|
||||||
|
#ifndef __rtems__
|
||||||
struct task fwload_task;
|
struct task fwload_task;
|
||||||
struct thread *td;
|
struct thread *td;
|
||||||
|
#endif /* __rtems__ */
|
||||||
struct priv_fw *fp;
|
struct priv_fw *fp;
|
||||||
|
|
||||||
mtx_lock(&firmware_mtx);
|
mtx_lock(&firmware_mtx);
|
||||||
fp = lookup(imagename, NULL);
|
fp = lookup(imagename, NULL);
|
||||||
if (fp != NULL)
|
if (fp != NULL)
|
||||||
goto found;
|
goto found;
|
||||||
|
#ifndef __rtems__
|
||||||
/*
|
/*
|
||||||
* Image not present, try to load the module holding it.
|
* Image not present, try to load the module holding it.
|
||||||
*/
|
*/
|
||||||
@ -344,6 +349,9 @@ firmware_get(const char *imagename)
|
|||||||
mtx_unlock(&firmware_mtx);
|
mtx_unlock(&firmware_mtx);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#else /* __rtems__ */
|
||||||
|
return NULL;
|
||||||
|
#endif /* __rtems__ */
|
||||||
found: /* common exit point on success */
|
found: /* common exit point on success */
|
||||||
if (fp->refcnt == 0 && fp->parent != NULL)
|
if (fp->refcnt == 0 && fp->parent != NULL)
|
||||||
fp->parent->refcnt++;
|
fp->parent->refcnt++;
|
||||||
@ -379,6 +387,7 @@ firmware_put(const struct firmware *p, int flags)
|
|||||||
mtx_unlock(&firmware_mtx);
|
mtx_unlock(&firmware_mtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
/*
|
/*
|
||||||
* Setup directory state for the firmware_tq thread so we can do i/o.
|
* 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);
|
DECLARE_MODULE(firmware, firmware_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
|
||||||
MODULE_VERSION(firmware, 1);
|
MODULE_VERSION(firmware, 1);
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
@ -237,6 +237,7 @@ def base(mm):
|
|||||||
'sys/sys/fail.h',
|
'sys/sys/fail.h',
|
||||||
'sys/sys/filedesc.h',
|
'sys/sys/filedesc.h',
|
||||||
'sys/sys/file.h',
|
'sys/sys/file.h',
|
||||||
|
'sys/sys/firmware.h',
|
||||||
'sys/sys/fnv_hash.h',
|
'sys/sys/fnv_hash.h',
|
||||||
'sys/sys/gpio.h',
|
'sys/sys/gpio.h',
|
||||||
'sys/sys/hash.h',
|
'sys/sys/hash.h',
|
||||||
@ -355,6 +356,7 @@ def base(mm):
|
|||||||
'sys/kern/subr_bus.c',
|
'sys/kern/subr_bus.c',
|
||||||
'sys/kern/subr_counter.c',
|
'sys/kern/subr_counter.c',
|
||||||
'sys/kern/subr_eventhandler.c',
|
'sys/kern/subr_eventhandler.c',
|
||||||
|
'sys/kern/subr_firmware.c',
|
||||||
'sys/kern/subr_hash.c',
|
'sys/kern/subr_hash.c',
|
||||||
'sys/kern/subr_hints.c',
|
'sys/kern/subr_hints.c',
|
||||||
'sys/kern/subr_kobj.c',
|
'sys/kern/subr_kobj.c',
|
||||||
|
@ -816,6 +816,7 @@ def build(bld):
|
|||||||
'freebsd/sys/kern/subr_bus.c',
|
'freebsd/sys/kern/subr_bus.c',
|
||||||
'freebsd/sys/kern/subr_counter.c',
|
'freebsd/sys/kern/subr_counter.c',
|
||||||
'freebsd/sys/kern/subr_eventhandler.c',
|
'freebsd/sys/kern/subr_eventhandler.c',
|
||||||
|
'freebsd/sys/kern/subr_firmware.c',
|
||||||
'freebsd/sys/kern/subr_hash.c',
|
'freebsd/sys/kern/subr_hash.c',
|
||||||
'freebsd/sys/kern/subr_hints.c',
|
'freebsd/sys/kern/subr_hints.c',
|
||||||
'freebsd/sys/kern/subr_kobj.c',
|
'freebsd/sys/kern/subr_kobj.c',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user