Lines Matching full:firmware

3 //! Firmware abstraction
5 //! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h)
16 *mut *const bindings::firmware,
32 /// Abstraction around a C `struct firmware`.
34 /// This is a simple abstraction around the C firmware API. Just like with the C API, firmware can
35 /// be requested. Once requested the abstraction provides direct access to the firmware buffer as
36 /// `&[u8]`. The firmware is released once [`Firmware`] is dropped.
40 /// The pointer is valid, and has ownership over the instance of `struct firmware`.
42 /// The `Firmware`'s backing buffer is not modified.
47 /// # use kernel::{c_str, device::Device, firmware::Firmware};
53 /// let fw = Firmware::request(c_str!("path/to/firmware.bin"), &dev)?;
59 pub struct Firmware(NonNull<bindings::firmware>); struct
61 impl Firmware { implementation
63 let mut fw: *mut bindings::firmware = core::ptr::null_mut(); in request_internal()
64 let pfw: *mut *mut bindings::firmware = &mut fw; in request_internal()
66 // SAFETY: `pfw` is a valid pointer to a NULL initialized `bindings::firmware` pointer. in request_internal()
74 // valid pointer to `bindings::firmware`. in request_internal()
75 Ok(Firmware(unsafe { NonNull::new_unchecked(fw) })) in request_internal()
78 /// Send a firmware request and wait for it. See also `bindings::request_firmware`.
83 /// Send a request for an optional firmware module. See also
89 fn as_raw(&self) -> *mut bindings::firmware { in as_raw() argument
93 /// Returns the size of the requested firmware in bytes.
99 /// Returns the requested firmware as `&[u8]`.
102 // `bindings::firmware` guarantees, if successfully requested, that in data()
103 // `bindings::firmware::data` has a size of `bindings::firmware::size` bytes. in data()
108 impl Drop for Firmware { implementation
115 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, which is safe to be used from
117 unsafe impl Send for Firmware {} implementation
119 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, references to which are safe to
121 unsafe impl Sync for Firmware {} implementation
123 /// Create firmware .modinfo entries.
126 /// simple string literals, which is already covered by the `firmware` field of
128 /// [`ModInfoBuilder`], which can create the firmware modinfo strings in a more flexible way.
137 /// it construct the corresponding firmware modinfo.
146 /// # use kernel::firmware;
164 /// const fn create(module_name: &'static kernel::str::CStr) -> firmware::ModInfoBuilder<N> {
165 /// let mut builder = firmware::ModInfoBuilder::new(module_name);
212 /// Builder for firmware module info.
214 /// [`ModInfoBuilder`] is a helper component to flexibly compose firmware paths strings for the
267 /// use kernel::firmware::ModInfoBuilder;
306 /// This method acts as a separator between module firmware path entries.
315 .push_internal(b"firmware=") in new_entry()