PCI reports the amount of video memory (for chmem'ing the X server)

This commit is contained in:
Philip Homburg 2006-03-17 15:23:59 +00:00
parent 816f031854
commit 64a9d53b12
2 changed files with 48 additions and 5 deletions

View file

@ -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<pcidev[devind].pd_bar_nr; i++)
{
if (pcidev[devind].pd_bar[i].pb_flags & PBF_IO)
continue;
size= pcidev[devind].pd_bar[i].pb_size;
if (size < amount)
continue;
amount= size;
}
if (size != 0)
{
printf("PCI: video memory for device at %d.%d.%d: %d bytes\n",
pcidev[devind].pd_busnr,
pcidev[devind].pd_dev,
pcidev[devind].pd_func,
amount);
}
}
/*===========================================================================*
* pci_vid_name *
*===========================================================================*/

View file

@ -108,6 +108,9 @@ Created: Jan 2000 by Philip Homburg <philip@cs.vu.nl>
#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 */