From: Philip Homburg Date: Fri, 17 Mar 2006 15:23:59 +0000 (+0000) Subject: PCI reports the amount of video memory (for chmem'ing the X server) X-Git-Tag: v3.1.2a~190 X-Git-Url: http://zhaoyanbai.com/repos/man.nsupdate.html?a=commitdiff_plain;h=64a9d53b127d466dbd46e323d50d874b6ecee95b;p=minix.git PCI reports the amount of video memory (for chmem'ing the X server) --- diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 2b420c669..7692149b4 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -118,6 +118,7 @@ FORWARD _PROTOTYPE( int do_piix, (int devind) ); FORWARD _PROTOTYPE( int do_amd_isabr, (int devind) ); FORWARD _PROTOTYPE( int do_sis_isabr, (int devind) ); FORWARD _PROTOTYPE( int do_via_isabr, (int devind) ); +FORWARD _PROTOTYPE( void report_vga, (int devind) ); FORWARD _PROTOTYPE( char *pci_vid_name, (U16_t vid) ); FORWARD _PROTOTYPE( char *pci_baseclass_name, (U8_t baseclass) ); FORWARD _PROTOTYPE( char *pci_subclass_name, (U8_t baseclass, @@ -657,7 +658,7 @@ PRIVATE void pci_intel_init() PRIVATE void probe_bus(busind) int busind; { - u32_t dev, func; + u32_t dev, func, t3; u16_t vid, did, sts; u8_t headt; u8_t baseclass, subclass, infclass; @@ -799,10 +800,13 @@ printf("probe_bus(%d)\n", busind); headt & PHT_MASK); break; } - if (debug) print_capabilities(devind); + t3= ((baseclass << 16) | (subclass << 8) | infclass); + if (t3 == PCI_T3_VGA || t3 == PCI_T3_VGA_OLD) + report_vga(devind); + if (nr_pcidev >= NR_PCIDEV) panic("PCI","too many PCI devices", nr_pcidev); devind= nr_pcidev; @@ -1346,6 +1350,7 @@ int busind; { int i, j, r, type, busnr, unknown_bridge, bridge_dev; u16_t vid, did; + u32_t t3; char *dstr; unknown_bridge= -1; @@ -1357,9 +1362,9 @@ int busind; { if (pcidev[i].pd_busnr != busnr) continue; - if (pcidev[i].pd_baseclass == 0x06 && - pcidev[i].pd_subclass == 0x01 && - pcidev[i].pd_infclass == 0x00) + t3= ((pcidev[i].pd_baseclass << 16) | + (pcidev[i].pd_subclass << 8) | pcidev[i].pd_infclass); + if (t3 == PCI_T3_ISA) { /* ISA bridge. Report if no supported bridge is * found. @@ -1798,6 +1803,41 @@ int devind; return 0; } + +/*===========================================================================* + * report_vga * + *===========================================================================*/ +PRIVATE void report_vga(devind) +int devind; +{ + /* Report the amount of video memory. This is needed by the X11R6 + * postinstall script to chmem the X server. Hopefully this can be + * removed when we get virtual memory. + */ + size_t amount, size; + int i; + + amount= 0; + for (i= 0; i #define CAP_NEXT 0x01 /* Next field in capability */ /* Device type values as ([PCI_BCR] << 16) | ([PCI_SCR] << 8) | [PCI_PIFR] */ +#define PCI_T3_VGA_OLD 0x000100 /* OLD VGA class code */ +#define PCI_T3_VGA 0x030000 /* VGA-compatible video card */ +#define PCI_T3_ISA 0x060100 /* ISA bridge */ #define PCI_T3_PCI2PCI 0x060400 /* PCI-to-PCI Bridge device */ #define PCI_T3_PCI2PCI_SUBTR 0x060401 /* Subtr. PCI-to-PCI Bridge */ #define PCI_T3_CARDBUS 0x060700 /* Bardbus Bridge */