2008-01-27 01:18:52 +03:00
|
|
|
/*
|
2010-05-28 13:19:11 +04:00
|
|
|
* Copyright 2004-2010, Haiku, Inc. All Rights Reserved.
|
2008-01-27 01:18:52 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _AGP_H_
|
2004-06-22 15:07:03 +04:00
|
|
|
#define _AGP_H_
|
|
|
|
|
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
#include <bus_manager.h>
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2004-07-11 02:25:49 +04:00
|
|
|
|
|
|
|
typedef struct agp_info {
|
2008-01-27 01:18:52 +03:00
|
|
|
ushort vendor_id; /* vendor id */
|
|
|
|
ushort device_id; /* device id */
|
|
|
|
uchar bus; /* bus number */
|
|
|
|
uchar device; /* device number on bus */
|
|
|
|
uchar function; /* function number in device */
|
|
|
|
uchar class_sub; /* specific device function */
|
|
|
|
uchar class_base; /* device type (display vs host bridge) */
|
|
|
|
struct {
|
2010-05-28 13:19:11 +04:00
|
|
|
uint32 capability_id; /* AGP capability register */
|
|
|
|
uint32 status; /* AGP status register */
|
|
|
|
uint32 command; /* AGP command register */
|
2004-07-11 02:25:49 +04:00
|
|
|
} interface;
|
2004-06-22 15:07:03 +04:00
|
|
|
} agp_info;
|
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
typedef struct aperture_info {
|
2010-05-28 13:19:11 +04:00
|
|
|
phys_addr_t physical_base;
|
|
|
|
addr_t base;
|
|
|
|
size_t size;
|
|
|
|
size_t reserved_size;
|
2008-01-27 01:18:52 +03:00
|
|
|
} aperture_info;
|
|
|
|
|
|
|
|
/* flags for allocate_memory */
|
|
|
|
enum {
|
|
|
|
B_APERTURE_NON_RESERVED = 0x01,
|
|
|
|
B_APERTURE_NEED_PHYSICAL = 0x02,
|
2004-06-22 15:07:03 +04:00
|
|
|
};
|
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
typedef int32 aperture_id;
|
|
|
|
typedef struct gart_bus_module_info gart_bus_module_info;
|
|
|
|
|
|
|
|
typedef struct agp_gart_module_info {
|
|
|
|
bus_manager_info info;
|
|
|
|
|
2010-05-28 13:19:11 +04:00
|
|
|
/* AGP functionality */
|
2008-01-27 01:18:52 +03:00
|
|
|
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);
|
|
|
|
|
2010-05-28 13:19:11 +04:00
|
|
|
/* GART functionality */
|
2008-01-27 01:18:52 +03:00
|
|
|
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,
|
|
|
|
addr_t *_apertureBase);
|
|
|
|
status_t (*unmap_aperture)(aperture_id id);
|
|
|
|
status_t (*get_aperture_info)(aperture_id id, aperture_info *info);
|
|
|
|
|
|
|
|
status_t (*allocate_memory)(aperture_id id, size_t size,
|
|
|
|
size_t alignment, uint32 flags, addr_t *_apertureBase,
|
2010-05-28 13:19:11 +04:00
|
|
|
phys_addr_t *_physicalBase);
|
2008-01-31 20:54:23 +03:00
|
|
|
status_t (*free_memory)(aperture_id id, addr_t apertureBase);
|
2008-01-27 01:18:52 +03:00
|
|
|
status_t (*reserve_aperture)(aperture_id id, size_t size,
|
|
|
|
addr_t *_apertureBase);
|
|
|
|
status_t (*unreserve_aperture)(aperture_id id, addr_t apertureBase);
|
|
|
|
status_t (*bind_aperture)(aperture_id id, area_id area, addr_t base,
|
2008-01-31 20:54:23 +03:00
|
|
|
size_t size, size_t alignment, addr_t reservedBase,
|
|
|
|
addr_t *_apertureBase);
|
2008-01-27 01:18:52 +03:00
|
|
|
status_t (*unbind_aperture)(aperture_id id, addr_t apertureBase);
|
|
|
|
} agp_gart_module_info;
|
|
|
|
|
|
|
|
#define B_AGP_GART_MODULE_NAME "bus_managers/agp_gart/v0"
|
|
|
|
|
|
|
|
struct agp_gart_for_bus_module_info {
|
|
|
|
module_info info;
|
|
|
|
};
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
#define B_AGP_GART_FOR_BUS_MODULE_NAME "bus_managers/agp_gart/bus/v0"
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
struct agp_gart_bus_module_info {
|
|
|
|
module_info info;
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
// TODO: add some stuff for non-generic AGP support as well
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
status_t (*create_aperture)(uint8 bus, uint8 device, uint8 function,
|
|
|
|
size_t size, void **_aperture);
|
|
|
|
void (*delete_aperture)(void *aperture);
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
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,
|
2010-05-28 13:19:11 +04:00
|
|
|
phys_addr_t physicalAddress);
|
2008-01-27 01:18:52 +03:00
|
|
|
status_t (*unbind_page)(void *aperture, uint32 offset);
|
|
|
|
void (*flush_tlbs)(void *aperture);
|
|
|
|
};
|
2004-06-22 15:07:03 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
/* defines for capability ID register bits */
|
|
|
|
#define AGP_REV_MINOR 0x000f0000 /* AGP Revision minor number reported */
|
|
|
|
#define AGP_REV_MINOR_SHIFT 16
|
|
|
|
#define AGP_REV_MAJOR 0x00f00000 /* AGP Revision major number reported */
|
|
|
|
#define AGP_REV_MAJOR_SHIFT 20
|
|
|
|
|
|
|
|
/* defines for status and command register bits */
|
|
|
|
#define AGP_2_1x 0x00000001 /* AGP Revision 2.0 1x speed transfer mode */
|
|
|
|
#define AGP_2_2x 0x00000002 /* AGP Revision 2.0 2x speed transfer mode */
|
|
|
|
#define AGP_2_4x 0x00000004 /* AGP Revision 2.0 4x speed transfer mode */
|
|
|
|
#define AGP_3_4x 0x00000001 /* AGP Revision 3.0 4x speed transfer mode */
|
|
|
|
#define AGP_3_8x 0x00000002 /* AGP Revision 3.0 8x speed transfer mode */
|
|
|
|
#define AGP_RATE_MASK 0x00000007 /* mask for supported rates info */
|
|
|
|
#define AGP_3_MODE 0x00000008 /* 0 if AGP Revision 2.0 or earlier rate scheme,
|
|
|
|
* 1 if AGP Revision 3.0 rate scheme */
|
|
|
|
#define AGP_FAST_WRITE 0x00000010 /* 1 if fast write transfers supported */
|
|
|
|
#define AGP_ABOVE_4G 0x00000020 /* 1 if adresses above 4G bytes supported */
|
|
|
|
#define AGP_SBA 0x00000200 /* 1 if side band adressing supported */
|
|
|
|
#define AGP_REQUEST 0xff000000 /* max. number of enqueued AGP command requests
|
|
|
|
* supported, minus one */
|
|
|
|
#define AGP_REQUEST_SHIFT 24
|
|
|
|
|
|
|
|
/* masks for command register bits */
|
|
|
|
#define AGP_ENABLE 0x00000100 /* set to 1 if AGP should be enabled */
|
|
|
|
|
2010-05-28 13:19:11 +04:00
|
|
|
|
2008-01-27 01:18:52 +03:00
|
|
|
#endif /* _AGP_H_ */
|