Deleted Added
full compact
ati_pcigart.c (182080) ati_pcigart.c (182883)
1/*-
2 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,

--- 13 unchanged lines hidden (view full) ---

22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Gareth Hughes <gareth@valinux.com>
26 *
27 */
28
29#include <sys/cdefs.h>
1/*-
2 * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,

--- 13 unchanged lines hidden (view full) ---

22 * DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Gareth Hughes <gareth@valinux.com>
26 *
27 */
28
29#include <sys/cdefs.h>
30__FBSDID("$FreeBSD: head/sys/dev/drm/ati_pcigart.c 182080 2008-08-23 20:59:12Z rnoland $");
30__FBSDID("$FreeBSD: head/sys/dev/drm/ati_pcigart.c 182883 2008-09-09 02:05:03Z rnoland $");
31
32/** @file ati_pcigart.c
33 * Implementation of ATI's PCIGART, which provides an aperture in card virtual
34 * address space with addresses remapped to system memory.
35 */
36
37#include "dev/drm/drmP.h"
38
39#define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
40#define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1))
41
42#define ATI_PCIE_WRITE 0x4
43#define ATI_PCIE_READ 0x8
44
45static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
46 struct drm_ati_pcigart_info *gart_info)
47{
31
32/** @file ati_pcigart.c
33 * Implementation of ATI's PCIGART, which provides an aperture in card virtual
34 * address space with addresses remapped to system memory.
35 */
36
37#include "dev/drm/drmP.h"
38
39#define ATI_PCIGART_PAGE_SIZE 4096 /* PCI GART page size */
40#define ATI_PCIGART_PAGE_MASK (~(ATI_PCIGART_PAGE_SIZE-1))
41
42#define ATI_PCIE_WRITE 0x4
43#define ATI_PCIE_READ 0x8
44
45static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
46 struct drm_ati_pcigart_info *gart_info)
47{
48 dev->sg->dmah = drm_pci_alloc(dev, gart_info->table_size,
49 PAGE_SIZE,
50 gart_info->table_mask);
51 if (dev->sg->dmah == NULL)
48 drm_dma_handle_t *dmah;
49
50 DRM_UNLOCK();
51 dmah = drm_pci_alloc(dev, gart_info->table_size, PAGE_SIZE,
52 gart_info->table_mask);
53 DRM_LOCK();
54 if (dmah == NULL)
52 return ENOMEM;
53
55 return ENOMEM;
56
57 dev->sg->dmah = dmah;
58
54 return 0;
55}
56
57static void drm_ati_free_pcigart_table(struct drm_device *dev,
58 struct drm_ati_pcigart_info *gart_info)
59{
60 drm_pci_free(dev, dev->sg->dmah);
61 dev->sg->dmah = NULL;

--- 100 unchanged lines hidden ---
59 return 0;
60}
61
62static void drm_ati_free_pcigart_table(struct drm_device *dev,
63 struct drm_ati_pcigart_info *gart_info)
64{
65 drm_pci_free(dev, dev->sg->dmah);
66 dev->sg->dmah = NULL;

--- 100 unchanged lines hidden ---