1 // SPDX-License-Identifier: GPL-2.0 2 3 use crate::gpu; 4 use kernel::firmware; 5 6 pub(crate) struct ModInfoBuilder<const N: usize>(firmware::ModInfoBuilder<N>); 7 8 impl<const N: usize> ModInfoBuilder<N> { 9 const VERSION: &'static str = "535.113.01"; 10 make_entry_file(self, chipset: &str, fw: &str) -> Self11 const fn make_entry_file(self, chipset: &str, fw: &str) -> Self { 12 ModInfoBuilder( 13 self.0 14 .new_entry() 15 .push("nvidia/") 16 .push(chipset) 17 .push("/gsp/") 18 .push(fw) 19 .push("-") 20 .push(Self::VERSION) 21 .push(".bin"), 22 ) 23 } 24 make_entry_chipset(self, chipset: &str) -> Self25 const fn make_entry_chipset(self, chipset: &str) -> Self { 26 self.make_entry_file(chipset, "booter_load") 27 .make_entry_file(chipset, "booter_unload") 28 .make_entry_file(chipset, "bootloader") 29 .make_entry_file(chipset, "gsp") 30 } 31 create( module_name: &'static kernel::str::CStr, ) -> firmware::ModInfoBuilder<N>32 pub(crate) const fn create( 33 module_name: &'static kernel::str::CStr, 34 ) -> firmware::ModInfoBuilder<N> { 35 let mut this = Self(firmware::ModInfoBuilder::new(module_name)); 36 let mut i = 0; 37 38 while i < gpu::Chipset::NAMES.len() { 39 this = this.make_entry_chipset(gpu::Chipset::NAMES[i]); 40 i += 1; 41 } 42 43 this.0 44 } 45 } 46