| // SPDX-License-Identifier: GPL-2.0 | |
| use crate::gpu; | |
| use kernel::firmware; | |
| pub(crate) struct ModInfoBuilder<const N: usize>(firmware::ModInfoBuilder<N>); | |
| impl<const N: usize> ModInfoBuilder<N> { | |
| const VERSION: &'static str = "535.113.01"; | |
| const fn make_entry_file(self, chipset: &str, fw: &str) -> Self { | |
| ModInfoBuilder( | |
| self.0 | |
| .new_entry() | |
| .push("nvidia/") | |
| .push(chipset) | |
| .push("/gsp/") | |
| .push(fw) | |
| .push("-") | |
| .push(Self::VERSION) | |
| .push(".bin"), | |
| ) | |
| } | |
| const fn make_entry_chipset(self, chipset: &str) -> Self { | |
| self.make_entry_file(chipset, "booter_load") | |
| .make_entry_file(chipset, "booter_unload") | |
| .make_entry_file(chipset, "bootloader") | |
| .make_entry_file(chipset, "gsp") | |
| } | |
| pub(crate) const fn create( | |
| module_name: &'static kernel::str::CStr, | |
| ) -> firmware::ModInfoBuilder<N> { | |
| let mut this = Self(firmware::ModInfoBuilder::new(module_name)); | |
| let mut i = 0; | |
| while i < gpu::Chipset::NAMES.len() { | |
| this = this.make_entry_chipset(gpu::Chipset::NAMES[i]); | |
| i += 1; | |
| } | |
| this.0 | |
| } | |
| } |