* Fixed the AGP interface to correctly use phys_addr_t where needed.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36962 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2008, Haiku, Inc. All Rights Reserved.
|
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _AGP_H_
|
#ifndef _AGP_H_
|
||||||
@@ -18,17 +18,17 @@ typedef struct agp_info {
|
|||||||
uchar class_sub; /* specific device function */
|
uchar class_sub; /* specific device function */
|
||||||
uchar class_base; /* device type (display vs host bridge) */
|
uchar class_base; /* device type (display vs host bridge) */
|
||||||
struct {
|
struct {
|
||||||
uint32 capability_id; /* AGP capability register as defined in the AGP standard */
|
uint32 capability_id; /* AGP capability register */
|
||||||
uint32 status; /* AGP STATUS register as defined in the AGP standard */
|
uint32 status; /* AGP status register */
|
||||||
uint32 command; /* AGP COMMAND register as defined in the AGP standard */
|
uint32 command; /* AGP command register */
|
||||||
} interface;
|
} interface;
|
||||||
} agp_info;
|
} agp_info;
|
||||||
|
|
||||||
typedef struct aperture_info {
|
typedef struct aperture_info {
|
||||||
addr_t physical_base;
|
phys_addr_t physical_base;
|
||||||
addr_t base;
|
addr_t base;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t reserved_size;
|
size_t reserved_size;
|
||||||
} aperture_info;
|
} aperture_info;
|
||||||
|
|
||||||
/* flags for allocate_memory */
|
/* flags for allocate_memory */
|
||||||
@@ -43,13 +43,13 @@ typedef struct gart_bus_module_info gart_bus_module_info;
|
|||||||
typedef struct agp_gart_module_info {
|
typedef struct agp_gart_module_info {
|
||||||
bus_manager_info info;
|
bus_manager_info info;
|
||||||
|
|
||||||
// AGP functionality
|
/* AGP functionality */
|
||||||
status_t (*get_nth_agp_info)(uint32 index, agp_info *info);
|
status_t (*get_nth_agp_info)(uint32 index, agp_info *info);
|
||||||
status_t (*acquire_agp)(void);
|
status_t (*acquire_agp)(void);
|
||||||
void (*release_agp)(void);
|
void (*release_agp)(void);
|
||||||
uint32 (*set_agp_mode)(uint32 command);
|
uint32 (*set_agp_mode)(uint32 command);
|
||||||
|
|
||||||
// GART functionality
|
/* GART functionality */
|
||||||
aperture_id (*map_aperture)(uint8 bus, uint8 device, uint8 function,
|
aperture_id (*map_aperture)(uint8 bus, uint8 device, uint8 function,
|
||||||
size_t size, addr_t *_apertureBase);
|
size_t size, addr_t *_apertureBase);
|
||||||
aperture_id (*map_custom_aperture)(gart_bus_module_info *module,
|
aperture_id (*map_custom_aperture)(gart_bus_module_info *module,
|
||||||
@@ -59,7 +59,7 @@ typedef struct agp_gart_module_info {
|
|||||||
|
|
||||||
status_t (*allocate_memory)(aperture_id id, size_t size,
|
status_t (*allocate_memory)(aperture_id id, size_t size,
|
||||||
size_t alignment, uint32 flags, addr_t *_apertureBase,
|
size_t alignment, uint32 flags, addr_t *_apertureBase,
|
||||||
addr_t *_physicalBase);
|
phys_addr_t *_physicalBase);
|
||||||
status_t (*free_memory)(aperture_id id, addr_t apertureBase);
|
status_t (*free_memory)(aperture_id id, addr_t apertureBase);
|
||||||
status_t (*reserve_aperture)(aperture_id id, size_t size,
|
status_t (*reserve_aperture)(aperture_id id, size_t size,
|
||||||
addr_t *_apertureBase);
|
addr_t *_apertureBase);
|
||||||
@@ -90,7 +90,7 @@ struct agp_gart_bus_module_info {
|
|||||||
status_t (*get_aperture_info)(void *aperture, aperture_info *info);
|
status_t (*get_aperture_info)(void *aperture, aperture_info *info);
|
||||||
status_t (*set_aperture_size)(void *aperture, size_t size);
|
status_t (*set_aperture_size)(void *aperture, size_t size);
|
||||||
status_t (*bind_page)(void *aperture, uint32 offset,
|
status_t (*bind_page)(void *aperture, uint32 offset,
|
||||||
addr_t physicalAddress);
|
phys_addr_t physicalAddress);
|
||||||
status_t (*unbind_page)(void *aperture, uint32 offset);
|
status_t (*unbind_page)(void *aperture, uint32 offset);
|
||||||
void (*flush_tlbs)(void *aperture);
|
void (*flush_tlbs)(void *aperture);
|
||||||
};
|
};
|
||||||
@@ -120,4 +120,5 @@ struct agp_gart_bus_module_info {
|
|||||||
/* masks for command register bits */
|
/* masks for command register bits */
|
||||||
#define AGP_ENABLE 0x00000100 /* set to 1 if AGP should be enabled */
|
#define AGP_ENABLE 0x00000100 /* set to 1 if AGP should be enabled */
|
||||||
|
|
||||||
|
|
||||||
#endif /* _AGP_H_ */
|
#endif /* _AGP_H_ */
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2009, Axel Dörfler, [email protected].
|
* Copyright 2008-2010, Axel Dörfler, [email protected].
|
||||||
* Copyright 2004-2006, Rudolf Cornelissen. All rights reserved.
|
* Copyright 2004-2006, Rudolf Cornelissen. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
@@ -660,7 +660,8 @@ Aperture::BindMemory(aperture_memory *memory, addr_t address, size_t size)
|
|||||||
else
|
else
|
||||||
page = memory->pages[index];
|
page = memory->pages[index];
|
||||||
|
|
||||||
physicalAddress = page->physical_page_number << PAGE_SHIFT;
|
physicalAddress
|
||||||
|
= (phys_addr_t)page->physical_page_number << PAGE_SHIFT;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,9 +1007,8 @@ get_aperture_info(aperture_id id, aperture_info *info)
|
|||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
allocate_memory(aperture_id id, size_t size, size_t alignment, uint32 flags,
|
allocate_memory(aperture_id id, size_t size, size_t alignment, uint32 flags,
|
||||||
addr_t *_apertureBase, addr_t *_physicalBase)
|
addr_t *_apertureBase, phys_addr_t *_physicalBase)
|
||||||
{
|
{
|
||||||
// TODO: _physicalBase should be a phys_addr_t*!
|
|
||||||
if ((flags & ~APERTURE_PUBLIC_FLAGS_MASK) != 0 || _apertureBase == NULL)
|
if ((flags & ~APERTURE_PUBLIC_FLAGS_MASK) != 0 || _apertureBase == NULL)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
@@ -1034,7 +1034,8 @@ allocate_memory(aperture_id id, size_t size, size_t alignment, uint32 flags,
|
|||||||
|
|
||||||
if (_physicalBase != NULL && (flags & B_APERTURE_NEED_PHYSICAL) != 0) {
|
if (_physicalBase != NULL && (flags & B_APERTURE_NEED_PHYSICAL) != 0) {
|
||||||
#if defined(__HAIKU__) && !defined(GART_TEST)
|
#if defined(__HAIKU__) && !defined(GART_TEST)
|
||||||
*_physicalBase = memory->page->physical_page_number * B_PAGE_SIZE;
|
*_physicalBase
|
||||||
|
= (phys_addr_t)memory->page->physical_page_number * B_PAGE_SIZE;
|
||||||
#else
|
#else
|
||||||
physical_entry entry;
|
physical_entry entry;
|
||||||
status = get_memory_map((void *)memory->base, B_PAGE_SIZE, &entry, 1);
|
status = get_memory_map((void *)memory->base, B_PAGE_SIZE, &entry, 1);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2009, Axel Dörfler, [email protected].
|
* Copyright 2008-2010, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -253,8 +253,9 @@ determine_memory_sizes(intel_info &info, size_t >tSize, size_t &stolenSize)
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_gtt_entry(intel_info &info, uint32 offset, addr_t physicalAddress)
|
set_gtt_entry(intel_info &info, uint32 offset, phys_addr_t physicalAddress)
|
||||||
{
|
{
|
||||||
|
// TODO: this is not 64-bit safe!
|
||||||
write32(info.gtt_base + (offset >> GTT_PAGE_SHIFT),
|
write32(info.gtt_base + (offset >> GTT_PAGE_SHIFT),
|
||||||
(uint32)physicalAddress | GTT_ENTRY_VALID);
|
(uint32)physicalAddress | GTT_ENTRY_VALID);
|
||||||
}
|
}
|
||||||
@@ -462,7 +463,7 @@ intel_set_aperture_size(void *aperture, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
intel_bind_page(void *aperture, uint32 offset, addr_t physicalAddress)
|
intel_bind_page(void *aperture, uint32 offset, phys_addr_t physicalAddress)
|
||||||
{
|
{
|
||||||
//TRACE("bind_page(offset %lx, physical %lx)\n", offset, physicalAddress);
|
//TRACE("bind_page(offset %lx, physical %lx)\n", offset, physicalAddress);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user