The size of the stolen memory for the graphics chip is now read out of the host bridge.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17381 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-05-09 01:00:58 +00:00
parent 9a6bbd514e
commit f197302867
2 changed files with 46 additions and 6 deletions

View File

@ -139,6 +139,26 @@ struct intel_free_graphics_memory {
//----------------------------------------------------------
// Register definitions, taken from X driver
// PCI bridge memory management
#define INTEL_GRAPHICS_MEMORY_CONTROL 0x52
#define STOLEN_MEMORY_MASK 0x70
// models i830 and up
#define i830_LOCAL_MEMORY_ONLY 0x10
#define i830_STOLEN_512K 0x20
#define i830_STOLEN_1M 0x30
#define i830_STOLEN_8M 0x40
// models i855 and up
#define i855_STOLEN_MEMORY_1M 0x10
#define i855_STOLEN_MEMORY_4M 0x20
#define i855_STOLEN_MEMORY_8M 0x30
#define i855_STOLEN_MEMORY_16M 0x40
#define i855_STOLEN_MEMORY_32M 0x50
#define i855_STOLEN_MEMORY_48M 0x60
#define i855_STOLEN_MEMORY_64M 0x70
#define INTEL_PAGE_TABLE_CONTROL 0x02020
#define INTEL_PAGE_TABLE_ERROR 0x02024
#define INTEL_HARDWARE_STATUS_PAGE 0x02080

View File

@ -18,10 +18,6 @@
#include <string.h>
#include <errno.h>
// ToDo: do this correctly
extern "C" void write_isa_io(uchar bus, uchar port, uchar offset);
extern "C" uchar read_isa_io(uchar bus, uchar port, uchar offset);
class PhysicalMemoryMapper {
public:
@ -99,8 +95,32 @@ intel_extreme_init(intel_info &info)
// get chipset info
// TODO: read this out of the PCI configuration of the PCI bridge
size_t memorySize = 8 * 1024 * 1024;
// read stolen memory from the PCI configuration of the PCI bridge
uint16 memoryConfig = gPCI->read_pci_config(0, 0, 0, INTEL_GRAPHICS_MEMORY_CONTROL, 2);
size_t memorySize = 1024 * 1024;
// TODO: this doesn't work like this on anything older than i855
switch (memoryConfig & STOLEN_MEMORY_MASK) {
case i855_STOLEN_MEMORY_4M:
memorySize *= 4;
break;
case i855_STOLEN_MEMORY_8M:
memorySize *= 8;
break;
case i855_STOLEN_MEMORY_16M:
memorySize *= 16;
break;
case i855_STOLEN_MEMORY_32M:
memorySize *= 32;
break;
case i855_STOLEN_MEMORY_48M:
memorySize *= 48;
break;
case i855_STOLEN_MEMORY_64M:
memorySize *= 64;
break;
}
dprintf("detected %ld MB of stolen memory\n", memorySize / 1024 / 1024);
// map frame buffer, try to map it write combined