Lines Matching full:firmware
3 //! Firmware abstraction
5 //! C header: [`include/linux/firmware.h`](srctree/include/linux/firmware.h)
23 *mut *const bindings::firmware,
39 /// Abstraction around a C `struct firmware`.
41 /// This is a simple abstraction around the C firmware API. Just like with the C API, firmware can
42 /// be requested. Once requested the abstraction provides direct access to the firmware buffer as
43 /// `&[u8]`. The firmware is released once [`Firmware`] is dropped.
47 /// The pointer is valid, and has ownership over the instance of `struct firmware`.
49 /// The `Firmware`'s backing buffer is not modified.
54 /// # use kernel::{device::Device, firmware::Firmware};
60 /// let fw = Firmware::request(c"path/to/firmware.bin", &dev)?;
66 pub struct Firmware(NonNull<bindings::firmware>); struct
68 impl Firmware { impl
70 let mut fw: *mut bindings::firmware = core::ptr::null_mut(); in request_internal()
71 let pfw: *mut *mut bindings::firmware = &mut fw; in request_internal()
72 let pfw: *mut *const bindings::firmware = pfw.cast(); in request_internal()
74 // SAFETY: `pfw` is a valid pointer to a NULL initialized `bindings::firmware` pointer. in request_internal()
82 // valid pointer to `bindings::firmware`. in request_internal()
83 Ok(Firmware(unsafe { NonNull::new_unchecked(fw) })) in request_internal()
86 /// Send a firmware request and wait for it. See also `bindings::request_firmware`.
91 /// Send a request for an optional firmware module. See also
97 fn as_raw(&self) -> *mut bindings::firmware { in as_raw() argument
101 /// Returns the size of the requested firmware in bytes.
107 /// Returns the requested firmware as `&[u8]`.
110 // `bindings::firmware` guarantees, if successfully requested, that in data()
111 // `bindings::firmware::data` has a size of `bindings::firmware::size` bytes. in data()
116 impl Drop for Firmware { implementation
123 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, which is safe to be used from
125 unsafe impl Send for Firmware {} implementation
127 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, references to which are safe to
129 unsafe impl Sync for Firmware {} implementation
131 /// Create firmware .modinfo entries.
134 /// simple string literals, which is already covered by the `firmware` field of
136 /// [`ModInfoBuilder`], which can create the firmware modinfo strings in a more flexible way.
145 /// it construct the corresponding firmware modinfo.
154 /// # use kernel::firmware;
172 /// const fn create(module_name: &'static kernel::str::CStr) -> firmware::ModInfoBuilder<N> {
173 /// let mut builder = firmware::ModInfoBuilder::new(module_name);
220 /// Builder for firmware module info.
222 /// [`ModInfoBuilder`] is a helper component to flexibly compose firmware paths strings for the
275 /// use kernel::firmware::ModInfoBuilder;
314 /// This method acts as a separator between module firmware path entries.
323 .push_internal(b"firmware=") in new_entry()