xref: /linux/drivers/gpu/nova-core/fb/hal/ga102.rs (revision 220994d61cebfc04f071d69049127657c7e8191b)
1*80213934SAlexandre Courbot // SPDX-License-Identifier: GPL-2.0
2*80213934SAlexandre Courbot 
3*80213934SAlexandre Courbot use kernel::prelude::*;
4*80213934SAlexandre Courbot 
5*80213934SAlexandre Courbot use crate::driver::Bar0;
6*80213934SAlexandre Courbot use crate::fb::hal::FbHal;
7*80213934SAlexandre Courbot use crate::regs;
8*80213934SAlexandre Courbot 
vidmem_size_ga102(bar: &Bar0) -> u649*80213934SAlexandre Courbot fn vidmem_size_ga102(bar: &Bar0) -> u64 {
10*80213934SAlexandre Courbot     regs::NV_USABLE_FB_SIZE_IN_MB::read(bar).usable_fb_size()
11*80213934SAlexandre Courbot }
12*80213934SAlexandre Courbot 
13*80213934SAlexandre Courbot struct Ga102;
14*80213934SAlexandre Courbot 
15*80213934SAlexandre Courbot impl FbHal for Ga102 {
read_sysmem_flush_page(&self, bar: &Bar0) -> u6416*80213934SAlexandre Courbot     fn read_sysmem_flush_page(&self, bar: &Bar0) -> u64 {
17*80213934SAlexandre Courbot         super::ga100::read_sysmem_flush_page_ga100(bar)
18*80213934SAlexandre Courbot     }
19*80213934SAlexandre Courbot 
write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result20*80213934SAlexandre Courbot     fn write_sysmem_flush_page(&self, bar: &Bar0, addr: u64) -> Result {
21*80213934SAlexandre Courbot         super::ga100::write_sysmem_flush_page_ga100(bar, addr);
22*80213934SAlexandre Courbot 
23*80213934SAlexandre Courbot         Ok(())
24*80213934SAlexandre Courbot     }
25*80213934SAlexandre Courbot 
supports_display(&self, bar: &Bar0) -> bool26*80213934SAlexandre Courbot     fn supports_display(&self, bar: &Bar0) -> bool {
27*80213934SAlexandre Courbot         super::ga100::display_enabled_ga100(bar)
28*80213934SAlexandre Courbot     }
29*80213934SAlexandre Courbot 
vidmem_size(&self, bar: &Bar0) -> u6430*80213934SAlexandre Courbot     fn vidmem_size(&self, bar: &Bar0) -> u64 {
31*80213934SAlexandre Courbot         vidmem_size_ga102(bar)
32*80213934SAlexandre Courbot     }
33*80213934SAlexandre Courbot }
34*80213934SAlexandre Courbot 
35*80213934SAlexandre Courbot const GA102: Ga102 = Ga102;
36*80213934SAlexandre Courbot pub(super) const GA102_HAL: &dyn FbHal = &GA102;
37