[haiku-commits] r36962 - in haiku/trunk: headers/private/graphics src/add-ons/kernel/bus_managers/agp_gart src/add-ons/kernel/busses/agp_gart

  • From: axeld@xxxxxxxxxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Fri, 28 May 2010 11:19:11 +0200 (CEST)

Author: axeld
Date: 2010-05-28 11:19:11 +0200 (Fri, 28 May 2010)
New Revision: 36962
Changeset: http://dev.haiku-os.org/changeset/36962/haiku

Modified:
   haiku/trunk/headers/private/graphics/AGP.h
   haiku/trunk/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp
   haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp
Log:
* Fixed the AGP interface to correctly use phys_addr_t where needed.


Modified: haiku/trunk/headers/private/graphics/AGP.h
===================================================================
--- haiku/trunk/headers/private/graphics/AGP.h  2010-05-27 22:14:24 UTC (rev 
36961)
+++ haiku/trunk/headers/private/graphics/AGP.h  2010-05-28 09:19:11 UTC (rev 
36962)
@@ -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.
  */
 #ifndef _AGP_H_
@@ -18,17 +18,17 @@
        uchar   class_sub;                      /* specific device function */
        uchar   class_base;                     /* device type (display vs host 
bridge) */
        struct {
-               uint32  capability_id;  /* AGP capability register as defined 
in the AGP standard */
-               uint32  status;                 /* AGP STATUS register as 
defined in the AGP standard */
-               uint32  command;                /* AGP COMMAND register as 
defined in the AGP standard */
+               uint32  capability_id;  /* AGP capability register */
+               uint32  status;                 /* AGP status register */
+               uint32  command;                /* AGP command register */
        } interface;
 } agp_info;
 
 typedef struct aperture_info {
-       addr_t  physical_base;
-       addr_t  base;
-       size_t  size;
-       size_t  reserved_size;  
+       phys_addr_t     physical_base;
+       addr_t          base;
+       size_t          size;
+       size_t          reserved_size;  
 } aperture_info;
 
 /* flags for allocate_memory */
@@ -43,13 +43,13 @@
 typedef struct agp_gart_module_info {
        bus_manager_info info;
 
-       // AGP functionality
+       /* AGP functionality */
        status_t        (*get_nth_agp_info)(uint32 index, agp_info *info);
        status_t        (*acquire_agp)(void);
        void            (*release_agp)(void);
        uint32          (*set_agp_mode)(uint32 command);
 
-       // GART functionality
+       /* GART functionality */
        aperture_id     (*map_aperture)(uint8 bus, uint8 device, uint8 function,
                                        size_t size, addr_t *_apertureBase);
        aperture_id     (*map_custom_aperture)(gart_bus_module_info *module,
@@ -59,7 +59,7 @@
 
        status_t        (*allocate_memory)(aperture_id id, size_t size,
                                        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        (*reserve_aperture)(aperture_id id, size_t size,
                                        addr_t *_apertureBase);
@@ -90,7 +90,7 @@
        status_t        (*get_aperture_info)(void *aperture, aperture_info 
*info);
        status_t        (*set_aperture_size)(void *aperture, size_t size);
        status_t        (*bind_page)(void *aperture, uint32 offset,
-                                       addr_t physicalAddress);
+                                       phys_addr_t physicalAddress);
        status_t        (*unbind_page)(void *aperture, uint32 offset);
        void            (*flush_tlbs)(void *aperture);
 };
@@ -120,4 +120,5 @@
 /* masks for command register bits */
 #define AGP_ENABLE                     0x00000100      /* set to 1 if AGP 
should be enabled */
 
+
 #endif /* _AGP_H_ */

Modified: haiku/trunk/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp   
2010-05-27 22:14:24 UTC (rev 36961)
+++ haiku/trunk/src/add-ons/kernel/bus_managers/agp_gart/agp_gart.cpp   
2010-05-28 09:19:11 UTC (rev 36962)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2008-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * Copyright 2004-2006, Rudolf Cornelissen. All rights reserved.
  *
  * Distributed under the terms of the MIT License.
@@ -660,7 +660,8 @@
                        else
                                page = memory->pages[index];
 
-                       physicalAddress = page->physical_page_number << 
PAGE_SHIFT;
+                       physicalAddress
+                               = (phys_addr_t)page->physical_page_number << 
PAGE_SHIFT;
 #endif
                }
 
@@ -1006,9 +1007,8 @@
 
 static status_t
 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)
                return B_BAD_VALUE;
 
@@ -1034,7 +1034,8 @@
 
        if (_physicalBase != NULL && (flags & B_APERTURE_NEED_PHYSICAL) != 0) {
 #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
                physical_entry entry;
                status = get_memory_map((void *)memory->base, B_PAGE_SIZE, 
&entry, 1);

Modified: haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp       
2010-05-27 22:14:24 UTC (rev 36961)
+++ haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp       
2010-05-28 09:19:11 UTC (rev 36962)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
+ * Copyright 2008-2010, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx
  * Distributed under the terms of the MIT License.
  */
 
@@ -253,8 +253,9 @@
 
 
 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),
                (uint32)physicalAddress | GTT_ENTRY_VALID);
 }
@@ -462,7 +463,7 @@
 
 
 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);
 


Other related posts:

  • » [haiku-commits] r36962 - in haiku/trunk: headers/private/graphics src/add-ons/kernel/bus_managers/agp_gart src/add-ons/kernel/busses/agp_gart - axeld