Lines Matching defs:firmware

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`.
54 /// # use kernel::{device::Device, firmware::Firmware, sync::aref::ARef};
56 /// let fw = Firmware::request(c"path/to/firmware.bin", &dev)?;
62 pub struct Firmware(NonNull<bindings::firmware>);
66 let mut fw: *mut bindings::firmware = core::ptr::null_mut();
67 let pfw: *mut *mut bindings::firmware = &mut fw;
68 let pfw: *mut *const bindings::firmware = pfw.cast();
70 // SAFETY: `pfw` is a valid pointer to a NULL initialized `bindings::firmware` pointer.
78 // valid pointer to `bindings::firmware`.
82 /// Send a firmware request and wait for it. See also `bindings::request_firmware`.
87 /// Send a request for an optional firmware module. See also
93 fn as_raw(&self) -> *mut bindings::firmware {
97 /// Returns the size of the requested firmware in bytes.
103 /// Returns the requested firmware as `&[u8]`.
106 // `bindings::firmware` guarantees, if successfully requested, that
107 // `bindings::firmware::data` has a size of `bindings::firmware::size` bytes.
119 /// Load firmware directly into the caller-provided `buf`.
121 /// On success the firmware image has been copied into `buf`; the caller accesses the data
125 /// the `into_buf` path, the firmware data lives in the caller's `buf`, not in a
138 let mut fw: *const bindings::firmware = core::ptr::null();
140 // SAFETY: `&raw mut fw` is a valid pointer to a NULL initialized `bindings::firmware` pointer.
153 // The firmware bytes are now in `buf`, which the caller owns, so we don't need
161 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, which is safe to be used from
165 // SAFETY: `Firmware` only holds a pointer to a C `struct firmware`, references to which are safe to
169 /// Create firmware .modinfo entries.
172 /// simple string literals, which is already covered by the `firmware` field of
174 /// [`ModInfoBuilder`], which can create the firmware modinfo strings in a more flexible way.
183 /// it construct the corresponding firmware modinfo.
192 /// # use kernel::firmware;
210 /// const fn create(module_name: &'static kernel::str::CStr) -> firmware::ModInfoBuilder<N> {
211 /// let mut builder = firmware::ModInfoBuilder::new(module_name);
258 /// Builder for firmware module info.
260 /// [`ModInfoBuilder`] is a helper component to flexibly compose firmware paths strings for the
313 /// use kernel::firmware::ModInfoBuilder;
352 /// This method acts as a separator between module firmware path entries.
361 .push_internal(b"firmware=")