Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
6586bafd
Commit
6586bafd
authored
Oct 05, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux-dj.bkbits.net/agpgart
into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents
b203e95a
1afee222
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
101 additions
and
91 deletions
+101
-91
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/amd-k7-agp.c
+14
-17
drivers/char/agp/amd64-agp.c
drivers/char/agp/amd64-agp.c
+3
-3
drivers/char/agp/ati-agp.c
drivers/char/agp/ati-agp.c
+14
-17
drivers/char/agp/generic.c
drivers/char/agp/generic.c
+6
-10
drivers/char/agp/intel-agp.c
drivers/char/agp/intel-agp.c
+2
-1
drivers/char/agp/intel-mch-agp.c
drivers/char/agp/intel-mch-agp.c
+3
-3
drivers/char/agp/nvidia-agp.c
drivers/char/agp/nvidia-agp.c
+11
-14
drivers/char/agp/sworks-agp.c
drivers/char/agp/sworks-agp.c
+17
-26
drivers/char/agp/via-agp.c
drivers/char/agp/via-agp.c
+31
-0
No files found.
drivers/char/agp/amd-k7-agp.c
View file @
6586bafd
...
...
@@ -24,11 +24,11 @@ static struct pci_device_id agp_amdk7_pci_table[];
struct
amd_page_map
{
unsigned
long
*
real
;
unsigned
long
*
remapped
;
unsigned
long
__iomem
*
remapped
;
};
static
struct
_amd_irongate_private
{
volatile
u8
*
registers
;
volatile
u8
__iomem
*
registers
;
struct
amd_page_map
**
gatt_pages
;
int
num_tables
;
}
amd_irongate_private
;
...
...
@@ -54,7 +54,7 @@ static int amd_create_page_map(struct amd_page_map *page_map)
global_cache_flush
();
for
(
i
=
0
;
i
<
PAGE_SIZE
/
sizeof
(
unsigned
long
);
i
++
)
page_map
->
remapped
[
i
]
=
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
page_map
->
remapped
+
i
)
;
return
0
;
}
...
...
@@ -151,7 +151,7 @@ static int amd_create_gatt_table(void)
}
agp_bridge
->
gatt_table_real
=
(
u32
*
)
page_dir
.
real
;
agp_bridge
->
gatt_table
=
(
u32
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_table
=
(
u32
__iomem
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_bus_addr
=
virt_to_phys
(
page_dir
.
real
);
/* Get the address for the gart region.
...
...
@@ -165,9 +165,8 @@ static int amd_create_gatt_table(void)
/* Calculate the agp offset */
for
(
i
=
0
;
i
<
value
->
num_entries
/
1024
;
i
++
,
addr
+=
0x00400000
)
{
page_dir
.
remapped
[
GET_PAGE_DIR_OFF
(
addr
)]
=
virt_to_phys
(
amd_irongate_private
.
gatt_pages
[
i
]
->
real
);
page_dir
.
remapped
[
GET_PAGE_DIR_OFF
(
addr
)]
|=
0x00000001
;
writel
(
virt_to_phys
(
amd_irongate_private
.
gatt_pages
[
i
]
->
real
)
|
1
,
page_dir
.
remapped
+
GET_PAGE_DIR_OFF
(
addr
));
}
return
0
;
...
...
@@ -178,7 +177,7 @@ static int amd_free_gatt_table(void)
struct
amd_page_map
page_dir
;
page_dir
.
real
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table_real
;
page_dir
.
remapped
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table
;
page_dir
.
remapped
=
(
unsigned
long
__iomem
*
)
agp_bridge
->
gatt_table
;
amd_free_gatt_pages
();
amd_free_page_map
(
&
page_dir
);
...
...
@@ -218,7 +217,7 @@ static int amd_irongate_configure(void)
/* Get the memory mapped registers */
pci_read_config_dword
(
agp_bridge
->
dev
,
AMD_MMBASE
,
&
temp
);
temp
=
(
temp
&
PCI_BASE_ADDRESS_MEM_MASK
);
amd_irongate_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
4096
);
amd_irongate_private
.
registers
=
(
volatile
u8
__iomem
*
)
ioremap
(
temp
,
4096
);
/* Write out the address of the gatt table */
OUTREG32
(
amd_irongate_private
.
registers
,
AMD_ATTBASE
,
...
...
@@ -263,7 +262,7 @@ static void amd_irongate_cleanup(void)
pci_read_config_dword
(
agp_bridge
->
dev
,
AMD_APSIZE
,
&
temp
);
temp
=
((
temp
&
~
(
0x0000000f
))
|
previous_size
->
size_value
);
pci_write_config_dword
(
agp_bridge
->
dev
,
AMD_APSIZE
,
temp
);
iounmap
((
void
*
)
amd_irongate_private
.
registers
);
iounmap
((
void
__iomem
*
)
amd_irongate_private
.
registers
);
}
/*
...
...
@@ -282,7 +281,7 @@ static void amd_irongate_tlbflush(struct agp_memory *temp)
static
int
amd_insert_memory
(
struct
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
{
int
i
,
j
,
num_entries
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
num_entries
=
A_SIZE_LVL2
(
agp_bridge
->
current_size
)
->
num_entries
;
...
...
@@ -297,7 +296,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
while
(
j
<
(
pg_start
+
mem
->
page_count
))
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
if
(
!
PGE_EMPTY
(
agp_bridge
,
cur_gatt
[
GET_GATT_OFF
(
addr
)]
))
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
cur_gatt
+
GET_GATT_OFF
(
addr
))
))
return
-
EBUSY
;
j
++
;
}
...
...
@@ -310,8 +309,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
agp_generic_mask_memory
(
mem
->
memory
[
i
],
mem
->
type
);
writel
(
agp_generic_mask_memory
(
mem
->
memory
[
i
],
mem
->
type
),
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
amd_irongate_tlbflush
(
mem
);
return
0
;
...
...
@@ -320,7 +318,7 @@ static int amd_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
static
int
amd_remove_memory
(
struct
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
{
int
i
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
if
(
type
!=
0
||
mem
->
type
!=
0
)
...
...
@@ -329,8 +327,7 @@ static int amd_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
{
addr
=
(
i
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
amd_irongate_tlbflush
(
mem
);
...
...
drivers/char/agp/amd64-agp.c
View file @
6586bafd
...
...
@@ -73,7 +73,7 @@ static void amd64_tlbflush(struct agp_memory *temp)
static
int
amd64_insert_memory
(
struct
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
{
int
i
,
j
,
num_entries
;
long
tmp
;
long
long
tmp
;
u32
pte
;
num_entries
=
agp_num_entries
();
...
...
@@ -90,7 +90,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
/* gatt table should be empty. */
while
(
j
<
(
pg_start
+
mem
->
page_count
))
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
agp_bridge
->
gatt_table
[
j
]
))
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
agp_bridge
->
gatt_table
+
j
)
))
return
-
EBUSY
;
j
++
;
}
...
...
@@ -108,7 +108,7 @@ static int amd64_insert_memory(struct agp_memory *mem, off_t pg_start, int type)
pte
|=
(
tmp
&
0x00000000fffff000ULL
);
pte
|=
GPTE_VALID
|
GPTE_COHERENT
;
agp_bridge
->
gatt_table
[
j
]
=
pte
;
writel
(
pte
,
agp_bridge
->
gatt_table
+
j
)
;
}
amd64_tlbflush
(
mem
);
return
0
;
...
...
drivers/char/agp/ati-agp.c
View file @
6586bafd
...
...
@@ -42,11 +42,11 @@ static struct gatt_mask ati_generic_masks[] =
typedef
struct
_ati_page_map
{
unsigned
long
*
real
;
unsigned
long
*
remapped
;
unsigned
long
__iomem
*
remapped
;
}
ati_page_map
;
static
struct
_ati_generic_private
{
volatile
u8
*
registers
;
volatile
u8
__iomem
*
registers
;
ati_page_map
**
gatt_pages
;
int
num_tables
;
}
ati_generic_private
;
...
...
@@ -76,7 +76,7 @@ static int ati_create_page_map(ati_page_map *page_map)
global_cache_flush
();
for
(
i
=
0
;
i
<
PAGE_SIZE
/
sizeof
(
unsigned
long
);
i
++
)
page_map
->
remapped
[
i
]
=
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
page_map
->
remapped
+
i
)
;
return
0
;
}
...
...
@@ -206,7 +206,7 @@ static void ati_cleanup(void)
temp
=
((
temp
&
~
(
0x0000000f
))
|
previous_size
->
size_value
);
pci_write_config_dword
(
agp_bridge
->
dev
,
ATI_RS300_APSIZE
,
temp
);
}
iounmap
((
vo
id
*
)
ati_generic_private
.
registers
);
iounmap
((
vo
latile
u8
__iomem
*
)
ati_generic_private
.
registers
);
}
...
...
@@ -217,7 +217,7 @@ static int ati_configure(void)
/* Get the memory mapped registers */
pci_read_config_dword
(
agp_bridge
->
dev
,
ATI_GART_MMBASE_ADDR
,
&
temp
);
temp
=
(
temp
&
0xfffff000
);
ati_generic_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
4096
);
ati_generic_private
.
registers
=
(
volatile
u8
__iomem
*
)
ioremap
(
temp
,
4096
);
if
(
is_r200
())
pci_write_config_dword
(
agp_bridge
->
dev
,
ATI_RS100_IG_AGPMODE
,
0x20000
);
...
...
@@ -261,7 +261,7 @@ static int ati_insert_memory(struct agp_memory * mem,
off_t
pg_start
,
int
type
)
{
int
i
,
j
,
num_entries
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
num_entries
=
A_SIZE_LVL2
(
agp_bridge
->
current_size
)
->
num_entries
;
...
...
@@ -276,7 +276,7 @@ static int ati_insert_memory(struct agp_memory * mem,
while
(
j
<
(
pg_start
+
mem
->
page_count
))
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
if
(
!
PGE_EMPTY
(
agp_bridge
,
cur_gatt
[
GET_GATT_OFF
(
addr
)]
))
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
cur_gatt
+
GET_GATT_OFF
(
addr
))
))
return
-
EBUSY
;
j
++
;
}
...
...
@@ -290,8 +290,7 @@ static int ati_insert_memory(struct agp_memory * mem,
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
);
writel
(
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
),
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
agp_bridge
->
driver
->
tlb_flush
(
mem
);
return
0
;
...
...
@@ -301,7 +300,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
int
type
)
{
int
i
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
if
(
type
!=
0
||
mem
->
type
!=
0
)
{
...
...
@@ -310,8 +309,7 @@ static int ati_remove_memory(struct agp_memory * mem, off_t pg_start,
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
{
addr
=
(
i
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
agp_bridge
->
driver
->
tlb_flush
(
mem
);
...
...
@@ -340,7 +338,7 @@ static int ati_create_gatt_table(void)
}
agp_bridge
->
gatt_table_real
=
(
u32
*
)
page_dir
.
real
;
agp_bridge
->
gatt_table
=
(
u32
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_table
=
(
u32
__iomem
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_bus_addr
=
virt_to_bus
(
page_dir
.
real
);
/* Write out the size register */
...
...
@@ -371,9 +369,8 @@ static int ati_create_gatt_table(void)
/* Calculate the agp offset */
for
(
i
=
0
;
i
<
value
->
num_entries
/
1024
;
i
++
,
addr
+=
0x00400000
)
{
page_dir
.
remapped
[
GET_PAGE_DIR_OFF
(
addr
)]
=
virt_to_bus
(
ati_generic_private
.
gatt_pages
[
i
]
->
real
);
page_dir
.
remapped
[
GET_PAGE_DIR_OFF
(
addr
)]
|=
0x00000001
;
writel
(
virt_to_bus
(
ati_generic_private
.
gatt_pages
[
i
]
->
real
)
|
1
,
page_dir
.
remapped
+
GET_PAGE_DIR_OFF
(
addr
));
}
return
0
;
...
...
@@ -384,7 +381,7 @@ static int ati_free_gatt_table(void)
ati_page_map
page_dir
;
page_dir
.
real
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table_real
;
page_dir
.
remapped
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table
;
page_dir
.
remapped
=
(
unsigned
long
__iomem
*
)
agp_bridge
->
gatt_table
;
ati_free_gatt_pages
();
ati_free_page_map
(
&
page_dir
);
...
...
drivers/char/agp/generic.c
View file @
6586bafd
...
...
@@ -35,6 +35,7 @@
#include <linux/pm.h>
#include <linux/agp_backend.h>
#include <linux/vmalloc.h>
#include <asm/io.h>
#include "agp.h"
__u32
*
agp_gatt_table
;
...
...
@@ -737,7 +738,7 @@ int agp_generic_create_gatt_table(void)
/* AK: bogus, should encode addresses > 4GB */
for
(
i
=
0
;
i
<
num_entries
;
i
++
)
agp_bridge
->
gatt_table
[
i
]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
agp_bridge
->
gatt_table
+
i
)
;
return
0
;
}
...
...
@@ -843,9 +844,8 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
j
=
pg_start
;
while
(
j
<
(
pg_start
+
mem
->
page_count
))
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
agp_bridge
->
gatt_table
[
j
]))
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
agp_bridge
->
gatt_table
+
j
)))
return
-
EBUSY
;
}
j
++
;
}
...
...
@@ -855,9 +855,7 @@ int agp_generic_insert_memory(struct agp_memory * mem, off_t pg_start, int type)
}
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
agp_bridge
->
gatt_table
[
j
]
=
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
);
writel
(
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
),
agp_bridge
->
gatt_table
+
j
);
agp_bridge
->
driver
->
tlb_flush
(
mem
);
return
0
;
...
...
@@ -875,10 +873,8 @@ int agp_generic_remove_memory(struct agp_memory *mem, off_t pg_start, int type)
}
/* AK: bogus, should encode addresses > 4GB */
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
{
agp_bridge
->
gatt_table
[
i
]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
}
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
writel
(
agp_bridge
->
scratch_page
,
agp_bridge
->
gatt_table
+
i
);
agp_bridge
->
driver
->
tlb_flush
(
mem
);
return
0
;
...
...
drivers/char/agp/intel-agp.c
View file @
6586bafd
...
...
@@ -202,7 +202,7 @@ static int intel_i810_insert_entries(struct agp_memory *mem, off_t pg_start,
return
-
EINVAL
;
}
for
(
j
=
pg_start
;
j
<
(
pg_start
+
mem
->
page_count
);
j
++
)
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
agp_bridge
->
gatt_table
[
j
]
))
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
agp_bridge
->
gatt_table
+
j
)
))
return
-
EBUSY
;
}
...
...
@@ -1768,6 +1768,7 @@ static struct pci_device_id agp_intel_pci_table[] = {
ID
(
PCI_DEVICE_ID_INTEL_82875_HB
),
ID
(
PCI_DEVICE_ID_INTEL_7505_0
),
ID
(
PCI_DEVICE_ID_INTEL_7205_0
),
ID
(
PCI_DEVICE_ID_INTEL_82915G_HB
),
{
}
};
...
...
drivers/char/agp/intel-mch-agp.c
View file @
6586bafd
...
...
@@ -84,7 +84,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
static
struct
_intel_i830_private
{
struct
pci_dev
*
i830_dev
;
/* device one */
volatile
u8
*
registers
;
volatile
u8
__iomem
*
registers
;
int
gtt_entries
;
}
intel_i830_private
;
...
...
@@ -172,7 +172,7 @@ static int intel_i830_create_gatt_table(void)
pci_read_config_dword
(
intel_i830_private
.
i830_dev
,
I810_MMADDR
,
&
temp
);
temp
&=
0xfff80000
;
intel_i830_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
128
*
4096
);
intel_i830_private
.
registers
=
(
volatile
u8
__iomem
*
)
ioremap
(
temp
,
128
*
4096
);
if
(
!
intel_i830_private
.
registers
)
return
(
-
ENOMEM
);
...
...
@@ -255,7 +255,7 @@ static int intel_i830_configure(void)
static
void
intel_i830_cleanup
(
void
)
{
iounmap
((
void
*
)
intel_i830_private
.
registers
);
iounmap
((
void
__iomem
*
)
intel_i830_private
.
registers
);
}
static
int
intel_i830_insert_entries
(
struct
agp_memory
*
mem
,
off_t
pg_start
,
...
...
drivers/char/agp/nvidia-agp.c
View file @
6586bafd
...
...
@@ -28,7 +28,7 @@ static struct _nvidia_private {
struct
pci_dev
*
dev_1
;
struct
pci_dev
*
dev_2
;
struct
pci_dev
*
dev_3
;
volatile
u32
*
aperture
;
volatile
u32
__iomem
*
aperture
;
int
num_active_entries
;
off_t
pg_offset
;
u32
wbc_mask
;
...
...
@@ -154,7 +154,7 @@ static int nvidia_configure(void)
/* map aperture */
nvidia_private
.
aperture
=
(
volatile
u32
*
)
ioremap
(
apbase
,
33
*
PAGE_SIZE
);
(
volatile
u32
__iomem
*
)
ioremap
(
apbase
,
33
*
PAGE_SIZE
);
return
0
;
}
...
...
@@ -173,7 +173,7 @@ static void nvidia_cleanup(void)
pci_write_config_dword
(
nvidia_private
.
dev_2
,
NVIDIA_2_GARTCTRL
,
temp
&
~
(
0x11
));
/* unmap aperture */
iounmap
((
void
*
)
nvidia_private
.
aperture
);
iounmap
((
void
__iomem
*
)
nvidia_private
.
aperture
);
/* restore previous aperture size */
previous_size
=
A_SIZE_8
(
agp_bridge
->
previous_size
);
...
...
@@ -206,7 +206,7 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
return
-
EINVAL
;
for
(
j
=
pg_start
;
j
<
(
pg_start
+
mem
->
page_count
);
j
++
)
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
agp_bridge
->
gatt_table
[
nvidia_private
.
pg_offset
+
j
]
))
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
agp_bridge
->
gatt_table
+
nvidia_private
.
pg_offset
+
j
)
))
return
-
EBUSY
;
}
...
...
@@ -215,9 +215,8 @@ static int nvidia_insert_memory(struct agp_memory *mem, off_t pg_start, int type
mem
->
is_flushed
=
TRUE
;
}
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
agp_bridge
->
gatt_table
[
nvidia_private
.
pg_offset
+
j
]
=
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
);
writel
(
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
),
agp_bridge
->
gatt_table
+
nvidia_private
.
pg_offset
+
j
);
agp_bridge
->
driver
->
tlb_flush
(
mem
);
return
0
;
}
...
...
@@ -229,11 +228,9 @@ static int nvidia_remove_memory(struct agp_memory *mem, off_t pg_start, int type
if
((
type
!=
0
)
||
(
mem
->
type
!=
0
))
return
-
EINVAL
;
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
{
agp_bridge
->
gatt_table
[
nvidia_private
.
pg_offset
+
i
]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
}
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
writel
(
agp_bridge
->
scratch_page
,
agp_bridge
->
gatt_table
+
nvidia_private
.
pg_offset
+
i
);
agp_bridge
->
driver
->
tlb_flush
(
mem
);
return
0
;
...
...
@@ -265,9 +262,9 @@ static void nvidia_tlbflush(struct agp_memory *mem)
/* flush TLB entries */
for
(
i
=
0
;
i
<
32
+
1
;
i
++
)
temp
=
nvidia_private
.
aperture
[
i
*
PAGE_SIZE
/
sizeof
(
u32
)]
;
temp
=
readl
(
nvidia_private
.
aperture
+
(
i
*
PAGE_SIZE
/
sizeof
(
u32
)))
;
for
(
i
=
0
;
i
<
32
+
1
;
i
++
)
temp
=
nvidia_private
.
aperture
[
i
*
PAGE_SIZE
/
sizeof
(
u32
)]
;
temp
=
readl
(
nvidia_private
.
aperture
+
(
i
*
PAGE_SIZE
/
sizeof
(
u32
)))
;
}
...
...
drivers/char/agp/sworks-agp.c
View file @
6586bafd
...
...
@@ -27,12 +27,12 @@
struct
serverworks_page_map
{
unsigned
long
*
real
;
unsigned
long
*
remapped
;
unsigned
long
__iomem
*
remapped
;
};
static
struct
_serverworks_private
{
struct
pci_dev
*
svrwrks_dev
;
/* device one */
volatile
u8
*
registers
;
volatile
u8
__iomem
*
registers
;
struct
serverworks_page_map
**
gatt_pages
;
int
num_tables
;
struct
serverworks_page_map
scratch_dir
;
...
...
@@ -61,9 +61,8 @@ static int serverworks_create_page_map(struct serverworks_page_map *page_map)
}
global_cache_flush
();
for
(
i
=
0
;
i
<
PAGE_SIZE
/
sizeof
(
unsigned
long
);
i
++
)
{
page_map
->
remapped
[
i
]
=
agp_bridge
->
scratch_page
;
}
for
(
i
=
0
;
i
<
PAGE_SIZE
/
sizeof
(
unsigned
long
);
i
++
)
writel
(
agp_bridge
->
scratch_page
,
page_map
->
remapped
+
i
);
return
0
;
}
...
...
@@ -162,10 +161,8 @@ static int serverworks_create_gatt_table(void)
}
/* Create a fake scratch directory */
for
(
i
=
0
;
i
<
1024
;
i
++
)
{
serverworks_private
.
scratch_dir
.
remapped
[
i
]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
page_dir
.
remapped
[
i
]
=
virt_to_phys
(
serverworks_private
.
scratch_dir
.
real
);
page_dir
.
remapped
[
i
]
|=
0x00000001
;
writel
(
agp_bridge
->
scratch_page
,
serverworks_private
.
scratch_dir
.
remapped
+
i
);
writel
(
virt_to_phys
(
serverworks_private
.
scratch_dir
.
real
)
|
1
,
page_dir
.
remapped
+
i
);
}
retval
=
serverworks_create_gatt_pages
(
value
->
num_entries
/
1024
);
...
...
@@ -176,7 +173,7 @@ static int serverworks_create_gatt_table(void)
}
agp_bridge
->
gatt_table_real
=
(
u32
*
)
page_dir
.
real
;
agp_bridge
->
gatt_table
=
(
u32
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_table
=
(
u32
__iomem
*
)
page_dir
.
remapped
;
agp_bridge
->
gatt_bus_addr
=
virt_to_phys
(
page_dir
.
real
);
/* Get the address for the gart region.
...
...
@@ -189,11 +186,8 @@ static int serverworks_create_gatt_table(void)
/* Calculate the agp offset */
for
(
i
=
0
;
i
<
value
->
num_entries
/
1024
;
i
++
)
{
page_dir
.
remapped
[
i
]
=
virt_to_phys
(
serverworks_private
.
gatt_pages
[
i
]
->
real
);
page_dir
.
remapped
[
i
]
|=
0x00000001
;
}
for
(
i
=
0
;
i
<
value
->
num_entries
/
1024
;
i
++
)
writel
(
virt_to_phys
(
serverworks_private
.
gatt_pages
[
i
]
->
real
)
|
1
,
page_dir
.
remapped
+
i
);
return
0
;
}
...
...
@@ -203,7 +197,7 @@ static int serverworks_free_gatt_table(void)
struct
serverworks_page_map
page_dir
;
page_dir
.
real
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table_real
;
page_dir
.
remapped
=
(
unsigned
long
*
)
agp_bridge
->
gatt_table
;
page_dir
.
remapped
=
(
unsigned
long
__iomem
*
)
agp_bridge
->
gatt_table
;
serverworks_free_gatt_pages
();
serverworks_free_page_map
(
&
page_dir
);
...
...
@@ -269,7 +263,7 @@ static int serverworks_configure(void)
/* Get the memory mapped registers */
pci_read_config_dword
(
agp_bridge
->
dev
,
serverworks_private
.
mm_addr_ofs
,
&
temp
);
temp
=
(
temp
&
PCI_BASE_ADDRESS_MEM_MASK
);
serverworks_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
4096
);
serverworks_private
.
registers
=
(
volatile
u8
__iomem
*
)
ioremap
(
temp
,
4096
);
if
(
!
serverworks_private
.
registers
)
{
printk
(
KERN_ERR
PFX
"Unable to ioremap() memory.
\n
"
);
return
-
ENOMEM
;
...
...
@@ -311,14 +305,14 @@ static int serverworks_configure(void)
static
void
serverworks_cleanup
(
void
)
{
iounmap
((
void
*
)
serverworks_private
.
registers
);
iounmap
((
void
__iomem
*
)
serverworks_private
.
registers
);
}
static
int
serverworks_insert_memory
(
struct
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
{
int
i
,
j
,
num_entries
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
num_entries
=
A_SIZE_LVL2
(
agp_bridge
->
current_size
)
->
num_entries
;
...
...
@@ -334,9 +328,8 @@ static int serverworks_insert_memory(struct agp_memory *mem,
while
(
j
<
(
pg_start
+
mem
->
page_count
))
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
SVRWRKS_GET_GATT
(
addr
);
if
(
!
PGE_EMPTY
(
agp_bridge
,
cur_gatt
[
GET_GATT_OFF
(
addr
)]))
{
if
(
!
PGE_EMPTY
(
agp_bridge
,
readl
(
cur_gatt
+
GET_GATT_OFF
(
addr
))))
return
-
EBUSY
;
}
j
++
;
}
...
...
@@ -348,8 +341,7 @@ static int serverworks_insert_memory(struct agp_memory *mem,
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
{
addr
=
(
j
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
SVRWRKS_GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
);
writel
(
agp_bridge
->
driver
->
mask_memory
(
mem
->
memory
[
i
],
mem
->
type
),
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
serverworks_tlbflush
(
mem
);
return
0
;
...
...
@@ -359,7 +351,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
int
type
)
{
int
i
;
unsigned
long
*
cur_gatt
;
unsigned
long
__iomem
*
cur_gatt
;
unsigned
long
addr
;
if
(
type
!=
0
||
mem
->
type
!=
0
)
{
...
...
@@ -372,8 +364,7 @@ static int serverworks_remove_memory(struct agp_memory *mem, off_t pg_start,
for
(
i
=
pg_start
;
i
<
(
mem
->
page_count
+
pg_start
);
i
++
)
{
addr
=
(
i
*
PAGE_SIZE
)
+
agp_bridge
->
gart_bus_addr
;
cur_gatt
=
SVRWRKS_GET_GATT
(
addr
);
cur_gatt
[
GET_GATT_OFF
(
addr
)]
=
(
unsigned
long
)
agp_bridge
->
scratch_page
;
writel
(
agp_bridge
->
scratch_page
,
cur_gatt
+
GET_GATT_OFF
(
addr
));
}
serverworks_tlbflush
(
mem
);
...
...
drivers/char/agp/via-agp.c
View file @
6586bafd
...
...
@@ -438,6 +438,33 @@ static void __devexit agp_via_remove(struct pci_dev *pdev)
agp_put_bridge
(
bridge
);
}
#ifdef CONFIG_PM
static
int
agp_via_suspend
(
struct
pci_dev
*
pdev
,
u32
state
)
{
pci_save_state
(
pdev
,
pdev
->
saved_config_space
);
pci_set_power_state
(
pdev
,
3
);
return
0
;
}
static
int
agp_via_resume
(
struct
pci_dev
*
pdev
)
{
struct
agp_bridge_data
*
bridge
=
pci_get_drvdata
(
pdev
);
pci_set_power_state
(
pdev
,
0
);
pci_restore_state
(
pdev
,
pdev
->
saved_config_space
);
if
(
bridge
->
driver
==
&
via_agp3_driver
)
return
via_configure_agp3
();
else
if
(
bridge
->
driver
==
&
via_driver
)
return
via_configure
();
return
0
;
}
#endif
/* CONFIG_PM */
/* must be the same order as name table above */
static
struct
pci_device_id
agp_via_pci_table
[]
=
{
#define ID(x) \
...
...
@@ -487,6 +514,10 @@ static struct pci_driver agp_via_pci_driver = {
.
id_table
=
agp_via_pci_table
,
.
probe
=
agp_via_probe
,
.
remove
=
agp_via_remove
,
#ifdef CONFIG_PM
.
suspend
=
agp_via_suspend
,
.
resume
=
agp_via_resume
,
#endif
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment