Lines 15-23
Link Here
|
15 |
#include "nv-retpoline.h" |
15 |
#include "nv-retpoline.h" |
16 |
|
16 |
|
17 |
#include <sys/consio.h> |
|
|
18 |
#include <sys/fbio.h> |
19 |
#include <sys/linker.h> |
17 |
#include <sys/linker.h> |
20 |
#include <sys/timex.h> |
18 |
#include <sys/timex.h> |
21 |
#include <dev/syscons/syscons.h> |
|
|
22 |
|
19 |
|
23 |
// This bootloader metadata interface was added to metadata.h in FreeBSD 10.1 |
20 |
// This bootloader metadata interface was added to metadata.h in FreeBSD 10.1 |
Lines 761-831
Link Here
|
761 |
{ |
758 |
{ |
762 |
return TRUE; |
759 |
return TRUE; |
763 |
} |
|
|
764 |
|
765 |
void NV_API_CALL os_get_screen_info( |
766 |
NvU64 *pPhysicalAddress, |
767 |
NvU16 *pFbWidth, |
768 |
NvU16 *pFbHeight, |
769 |
NvU16 *pFbDepth, |
770 |
NvU16 *pFbPitch |
771 |
) |
772 |
{ |
773 |
#if NV_HAVE_EFI_FB |
774 |
/* |
775 |
* Look up EFI framebuffer information passed to the FreeBSD kernel by the |
776 |
* bootloader. |
777 |
* |
778 |
* Adapted from a suggestion by Conrad Meyer <cem@freebsd.org>. |
779 |
*/ |
780 |
caddr_t kmdp = preload_search_by_type("elf kernel") ?: |
781 |
preload_search_by_type("elf64 kernel"); |
782 |
|
783 |
if (kmdp != NULL) |
784 |
{ |
785 |
const struct efi_fb *efifb = |
786 |
(const struct efi_fb *)preload_search_info(kmdp, MODINFO_METADATA | |
787 |
MODINFOMD_EFI_FB); |
788 |
if (efifb != NULL) |
789 |
{ |
790 |
int depth = fls(efifb->fb_mask_red | efifb->fb_mask_green | |
791 |
efifb->fb_mask_blue | efifb->fb_mask_reserved); |
792 |
int bpp = roundup2(depth, NBBY); |
793 |
|
794 |
*pPhysicalAddress = efifb->fb_addr; |
795 |
*pFbWidth = efifb->fb_width; |
796 |
*pFbHeight = efifb->fb_height; |
797 |
*pFbDepth = depth; |
798 |
/* fb_stride is in pixels. Convert to bytes */ |
799 |
*pFbPitch = efifb->fb_stride * (bpp / NBBY); |
800 |
return; |
801 |
} |
802 |
} |
803 |
#endif |
804 |
{ |
805 |
const sc_softc_t *sc = sc_get_softc(0, SC_KERNEL_CONSOLE); |
806 |
|
807 |
if (sc) |
808 |
{ |
809 |
const video_adapter_t *adp = sc->adp; |
810 |
|
811 |
if (adp) |
812 |
{ |
813 |
const struct video_info *vi = &adp->va_info; |
814 |
|
815 |
if (vi && (vi->vi_flags & V_INFO_LINEAR)) |
816 |
{ |
817 |
*pPhysicalAddress = vi->vi_buffer; |
818 |
*pFbWidth = vi->vi_width; |
819 |
*pFbHeight = vi->vi_height; |
820 |
*pFbDepth = vi->vi_depth; |
821 |
*pFbPitch = adp->va_line_width; |
822 |
return; |
823 |
} |
824 |
} |
825 |
} |
826 |
} |
827 |
|
828 |
*pPhysicalAddress = 0; |
829 |
*pFbWidth = *pFbHeight = *pFbDepth = *pFbPitch = 0; |
830 |
} |
760 |
} |
831 |
|
761 |
|