1 // SPDX-License-Identifier: GPL-2.0 2 3 use kernel::prelude::*; 4 5 use crate::driver::Bar0; 6 use crate::gpu::Chipset; 7 8 mod ga100; 9 mod tu102; 10 11 pub(crate) trait FbHal { 12 /// Returns the address of the currently-registered sysmem flush page. 13 fn read_sysmem_flush_page(&self, bar: &Bar0) -> u64; 14 15 /// Register `addr` as the address of the sysmem flush page. 16 /// 17 /// This might fail if the address is too large for the receiving register. 18 fn write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result; 19 } 20 21 /// Returns the HAL corresponding to `chipset`. 22 pub(super) fn fb_hal(chipset: Chipset) -> &'static dyn FbHal { 23 use Chipset::*; 24 25 match chipset { 26 TU102 | TU104 | TU106 | TU117 | TU116 => tu102::TU102_HAL, 27 GA100 | GA102 | GA103 | GA104 | GA106 | GA107 | AD102 | AD103 | AD104 | AD106 | AD107 => { 28 ga100::GA100_HAL 29 } 30 } 31 } 32