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
nexedi
linux
Commits
5d7fa0ad
Commit
5d7fa0ad
authored
Dec 20, 2002
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://kernel.bkbits.net/davem/sparc-2.5
into home.transmeta.com:/home/torvalds/v2.5/linux
parents
dff076a0
6ecabc8f
Changes
26
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
528 additions
and
546 deletions
+528
-546
drivers/char/agp/Makefile
drivers/char/agp/Makefile
+1
-1
drivers/char/agp/agp.h
drivers/char/agp/agp.h
+4
-0
drivers/char/agp/ali-agp.c
drivers/char/agp/ali-agp.c
+12
-9
drivers/char/agp/amd-k7-agp.c
drivers/char/agp/amd-k7-agp.c
+12
-14
drivers/char/agp/amd-k8-agp.c
drivers/char/agp/amd-k8-agp.c
+13
-5
drivers/char/agp/backend.c
drivers/char/agp/backend.c
+8
-19
drivers/char/agp/frontend.c
drivers/char/agp/frontend.c
+1
-1
drivers/char/agp/generic-3.0.c
drivers/char/agp/generic-3.0.c
+6
-8
drivers/char/agp/hp-agp.c
drivers/char/agp/hp-agp.c
+9
-9
drivers/char/agp/i460-agp.c
drivers/char/agp/i460-agp.c
+20
-15
drivers/char/agp/i7x05-agp.c
drivers/char/agp/i7x05-agp.c
+18
-14
drivers/char/agp/intel-agp.c
drivers/char/agp/intel-agp.c
+65
-69
drivers/char/agp/sis-agp.c
drivers/char/agp/sis-agp.c
+13
-14
drivers/char/agp/sworks-agp.c
drivers/char/agp/sworks-agp.c
+19
-38
drivers/char/agp/via-agp.c
drivers/char/agp/via-agp.c
+81
-18
drivers/scsi/aic7xxx_old.c
drivers/scsi/aic7xxx_old.c
+30
-36
drivers/scsi/aic7xxx_old/aic7xxx.h
drivers/scsi/aic7xxx_old/aic7xxx.h
+1
-0
drivers/scsi/scsi.c
drivers/scsi/scsi.c
+10
-13
drivers/scsi/scsi.h
drivers/scsi/scsi.h
+6
-12
drivers/scsi/scsi_error.c
drivers/scsi/scsi_error.c
+1
-1
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_lib.c
+18
-22
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_scan.c
+155
-209
drivers/scsi/sd.c
drivers/scsi/sd.c
+20
-16
drivers/scsi/sg.c
drivers/scsi/sg.c
+1
-1
drivers/scsi/sr.c
drivers/scsi/sr.c
+2
-2
include/scsi/scsi.h
include/scsi/scsi.h
+2
-0
No files found.
drivers/char/agp/Makefile
View file @
5d7fa0ad
...
...
@@ -6,9 +6,9 @@
export-objs
:=
backend.o
agpgart-y
:=
backend.o frontend.o generic.o
agpgart-$(CONFIG_AGP3)
+=
generic-3.0.o
agpgart-objs
:=
$
(
agpgart-y
)
obj-$(CONFIG_AGP)
+=
agpgart.o
obj-$(CONFIG_AGP3)
+=
generic-3.0.o
obj-$(CONFIG_AGP_INTEL)
+=
intel-agp.o
obj-$(CONFIG_AGP_VIA)
+=
via-agp.o
...
...
drivers/char/agp/agp.h
View file @
5d7fa0ad
...
...
@@ -33,6 +33,7 @@ extern struct agp_bridge_data agp_bridge;
/* Generic routines. */
void
agp_generic_agp_enable
(
u32
mode
);
int
agp_generic_agp_3_0_enable
(
u32
mode
);
int
agp_generic_create_gatt_table
(
void
);
int
agp_generic_free_gatt_table
(
void
);
agp_memory
*
agp_create_memory
(
int
scratch_pages
);
...
...
@@ -290,6 +291,9 @@ struct agp_bridge_data {
#define VIA_APSIZE 0x84
#define VIA_ATTBASE 0x88
/* VIA KT400 */
#define VIA_AGPSEL 0xfd
/* SiS registers */
#define SIS_APBASE 0x10
#define SIS_ATTBASE 0x90
...
...
drivers/char/agp/ali-agp.c
View file @
5d7fa0ad
...
...
@@ -195,7 +195,7 @@ static struct aper_size_info_32 ali_generic_sizes[7] =
{
4
,
1024
,
0
,
3
}
};
int
__init
ali_generic_setup
(
struct
pci_dev
*
pdev
)
static
int
__init
ali_generic_setup
(
struct
pci_dev
*
pdev
)
{
agp_bridge
.
masks
=
ali_generic_masks
;
agp_bridge
.
num_of_masks
=
1
;
...
...
@@ -338,17 +338,20 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
}
static
int
agp_ali_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_ali_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
return
-
ENODEV
;
u8
cap_ptr
=
0
;
agp_bridge
.
dev
=
dev
;
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
/* probe for known chipsets */
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
agp_register_driver
(
dev
);
return
0
;
}
...
...
@@ -369,7 +372,7 @@ static struct pci_device_id agp_ali_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_ali_pci_table
);
static
struct
pci_driver
agp_ali_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_ali_pci_driver
=
{
.
name
=
"agpgart-ali"
,
.
id_table
=
agp_ali_pci_table
,
.
probe
=
agp_ali_probe
,
...
...
drivers/char/agp/amd-k7-agp.c
View file @
5d7fa0ad
...
...
@@ -351,7 +351,7 @@ static struct gatt_mask amd_irongate_masks[] =
{.
mask
=
0x00000001
,
.
type
=
0
}
};
int
__init
amd_irongate_setup
(
struct
pci_dev
*
pdev
)
static
int
__init
amd_irongate_setup
(
struct
pci_dev
*
pdev
)
{
agp_bridge
.
masks
=
amd_irongate_masks
;
agp_bridge
.
num_of_masks
=
1
;
...
...
@@ -439,25 +439,23 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
/* Supported Device Scanning routine */
static
int
__init
agp_
find_supported_device
(
struct
pci_dev
*
dev
)
static
int
__init
agp_
amdk7_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
agp_bridge
.
dev
=
dev
;
u8
cap_ptr
=
0
;
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
/* probe for known chipsets */
return
agp_lookup_host_bridge
(
dev
);
}
static
int
agp_amdk7_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
agp_register_driver
(
dev
);
return
0
;
}
return
-
ENODEV
;
return
-
ENODEV
;
}
static
struct
pci_device_id
agp_amdk7_pci_table
[]
__initdata
=
{
...
...
@@ -474,7 +472,7 @@ static struct pci_device_id agp_amdk7_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_amdk7_pci_table
);
static
struct
pci_driver
agp_amdk7_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_amdk7_pci_driver
=
{
.
name
=
"agpgart-amdk7"
,
.
id_table
=
agp_amdk7_pci_table
,
.
probe
=
agp_amdk7_probe
,
...
...
drivers/char/agp/amd-k8-agp.c
View file @
5d7fa0ad
...
...
@@ -370,7 +370,7 @@ static void agp_x86_64_agp_enable(u32 mode)
}
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
command
);
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
command
);
/*
* PASS2: go through all devices that claim to be
...
...
@@ -429,7 +429,7 @@ static void agp_x86_64_agp_enable(u32 mode)
command
|=
0x100
;
pci_write_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
8
,
command
);
pci_write_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
8
,
command
);
/*
* PASS4: Go through all AGP devices and update the
...
...
@@ -475,11 +475,19 @@ static int __init amd_8151_setup (struct pci_dev *pdev)
}
static
int
agp_amdk8_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_amdk8_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
u8
cap_ptr
=
0
;
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
amd_8151_setup
(
dev
);
agp_register_driver
(
dev
);
return
0
;
...
...
@@ -499,7 +507,7 @@ static struct pci_device_id agp_amdk8_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_amdk8_pci_table
);
static
struct
pci_driver
agp_amdk8_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_amdk8_pci_driver
=
{
.
name
=
"agpgart-amd-k8"
,
.
id_table
=
agp_amdk8_pci_table
,
.
probe
=
agp_amdk8_probe
,
...
...
drivers/char/agp/backend.c
View file @
5d7fa0ad
...
...
@@ -112,23 +112,13 @@ static struct agp_version agp_current_version =
.
minor
=
AGPGART_VERSION_MINOR
,
};
static
int
__init
agp_backend_initialize
(
struct
pci_dev
*
dev
)
static
int
agp_backend_initialize
(
struct
pci_dev
*
dev
)
{
int
size_value
,
rc
,
got_gatt
=
0
,
got_keylist
=
0
;
u8
cap_ptr
=
0
;
agp_bridge
.
max_memory_agp
=
agp_find_max
();
agp_bridge
.
version
=
&
agp_current_version
;
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
if
(
agp_bridge
.
needs_scratch_page
==
TRUE
)
{
void
*
addr
;
addr
=
agp_bridge
.
agp_alloc_page
();
...
...
@@ -254,7 +244,7 @@ int agp_register_driver (struct pci_dev *dev)
}
inter_module_register
(
"drm_agp"
,
THIS_MODULE
,
&
drm_agp
);
pm_register
(
PM_PCI_DEV
,
PM_PCI_ID
(
agp_bridge
.
dev
),
agp_power
);
agp_count
++
;
...
...
@@ -272,13 +262,6 @@ int agp_unregister_driver(void)
return
0
;
}
int
__exit
agp_exit
(
void
)
{
if
(
agp_count
==
0
)
return
-
EBUSY
;
return
0
;
}
int
__init
agp_init
(
void
)
{
...
...
@@ -297,6 +280,12 @@ int __init agp_init(void)
return
0
;
}
void
__exit
agp_exit
(
void
)
{
if
(
agp_count
!=
0
)
BUG
();
}
#ifndef CONFIG_GART_IOMMU
module_init
(
agp_init
);
module_exit
(
agp_exit
);
...
...
drivers/char/agp/frontend.c
View file @
5d7fa0ad
...
...
@@ -1067,7 +1067,7 @@ static struct miscdevice agp_miscdev =
.
fops
=
&
agp_fops
};
int
__init
agp_frontend_initialize
(
void
)
int
agp_frontend_initialize
(
void
)
{
memset
(
&
agp_fe
,
0
,
sizeof
(
struct
agp_front_data
));
AGP_LOCK_INIT
();
...
...
drivers/char/agp/generic-3.0.c
View file @
5d7fa0ad
#include <linux/list.h>
#include <linux/pci.h>
//#include <linux/pagemap.h>
//#include <linux/miscdevice.h>
//#include <linux/pm.h>
#include <linux/agp_backend.h>
#include <linux/module.h>
#include "agp.h"
...
...
@@ -529,7 +525,7 @@ static int agp_3_0_node_enable(u32 mode, u32 minor)
* (AGP 3.0 devices are required to operate as AGP 2.0 devices
* when not using 3.0 electricals.
*/
void
agp_generic_agp_3_0_enable
(
u32
mode
)
int
agp_generic_agp_3_0_enable
(
u32
mode
)
{
u32
ncapid
,
major
,
minor
,
agp_3_0
;
...
...
@@ -548,9 +544,11 @@ void agp_generic_agp_3_0_enable(u32 mode)
*/
if
((
agp_3_0
>>
3
)
&
0x1
)
{
agp_3_0_node_enable
(
mode
,
minor
);
return
;
return
TRUE
;
}
}
agp_generic_agp_enable
(
mode
)
;
return
FALSE
;
}
EXPORT_SYMBOL
(
agp_generic_agp_3_0_enable
);
drivers/char/agp/hp-agp.c
View file @
5d7fa0ad
...
...
@@ -216,8 +216,7 @@ static void hp_zx1_tlbflush(agp_memory * mem)
{
struct
_hp_private
*
hp
=
&
hp_private
;
OUTREG64
(
hp
->
registers
,
HP_ZX1_PCOM
,
hp
->
gart_base
|
log2
(
hp
->
gart_size
));
OUTREG64
(
hp
->
registers
,
HP_ZX1_PCOM
,
hp
->
gart_base
|
log2
(
hp
->
gart_size
));
INREG64
(
hp
->
registers
,
HP_ZX1_PCOM
);
}
...
...
@@ -251,7 +250,7 @@ static int hp_zx1_create_gatt_table(void)
static
int
hp_zx1_free_gatt_table
(
void
)
{
struct
_hp_private
*
hp
=
&
hp_private
;
if
(
hp
->
io_pdir_owner
)
free_pages
((
unsigned
long
)
hp
->
io_pdir
,
get_order
(
hp
->
io_pdir_size
));
...
...
@@ -329,7 +328,7 @@ static unsigned long hp_zx1_mask_memory(unsigned long addr, int type)
return
HP_ZX1_PDIR_VALID_BIT
|
addr
;
}
int
__init
hp_zx1_setup
(
struct
pci_dev
*
pdev
__attribute__
((
unused
)))
static
int
__init
hp_zx1_setup
(
struct
pci_dev
*
pdev
__attribute__
((
unused
)))
{
agp_bridge
.
masks
=
hp_zx1_masks
;
agp_bridge
.
num_of_masks
=
1
;
...
...
@@ -368,21 +367,22 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
return
hp_zx1_setup
(
dev
);
}
return
-
ENODEV
;
}
static
int
agp_hp_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_hp_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
agp_register_driver
(
dev
);
return
0
;
}
return
-
ENODEV
;
return
-
ENODEV
;
}
static
struct
pci_device_id
agp_hp_pci_table
[]
__initdata
=
{
{
.
class
=
(
PCI_CLASS_BRIDGE_HOST
<<
8
),
.
class_mask
=
~
0
,
.
vendor
_id
=
PCI_VENDOR_ID_HP
,
.
vendor
=
PCI_VENDOR_ID_HP
,
.
device
=
PCI_DEVICE_ID_HP_ZX1_LBA
,
.
subvendor
=
PCI_ANY_ID
,
.
subdevice
=
PCI_ANY_ID
,
...
...
@@ -392,7 +392,7 @@ static struct pci_device_id agp_hp_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_pci_table
);
static
struct
pci_driver
agp_hp_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_hp_pci_driver
=
{
.
name
=
"agpgart-hp"
,
.
id_table
=
agp_hp_pci_table
,
.
probe
=
agp_hp_probe
,
...
...
@@ -412,7 +412,7 @@ static int __init agp_hp_init(void)
static
void
__exit
agp_hp_cleanup
(
void
)
{
agp_unregister_driver
();
pci_unregister_driver
(
&
agp_pci_driver
);
pci_unregister_driver
(
&
agp_
hp_
pci_driver
);
}
module_init
(
agp_hp_init
);
...
...
drivers/char/agp/i460-agp.c
View file @
5d7fa0ad
...
...
@@ -523,7 +523,7 @@ static unsigned long i460_mask_memory (unsigned long addr, int type)
|
(((
addr
&
~
((
1
<<
I460_IO_PAGE_SHIFT
)
-
1
))
&
0xffffff000
)
>>
12
));
}
int
__init
intel_i460_setup
(
struct
pci_dev
*
pdev
__attribute__
((
unused
)))
static
int
__init
intel_i460_setup
(
struct
pci_dev
*
pdev
__attribute__
((
unused
)))
{
agp_bridge
.
num_of_masks
=
1
;
agp_bridge
.
masks
=
i460_masks
;
...
...
@@ -560,55 +560,60 @@ int __init intel_i460_setup (struct pci_dev *pdev __attribute__((unused)))
return
0
;
}
static
int
agp_intel_i460_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_intel_i460_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
u8
cap_ptr
=
0
;
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
intel_i460_setup
(
dev
);
agp_register_driver
(
dev
);
return
0
;
}
static
struct
pci_device_id
agp_i460_pci_table
[]
__initdata
=
{
static
struct
pci_device_id
agp_i
ntel_i
460_pci_table
[]
__initdata
=
{
{
.
class
=
(
PCI_CLASS_BRIDGE_HOST
<<
8
),
.
class_mask
=
~
0
,
.
vendor
=
PCI_VENDOR_ID_INTEL
,
.
device
=
PCI_DEVICE_ID_INTEL_460GX
,
.
device
=
PCI_DEVICE_ID_INTEL_
84
460GX
,
.
subvendor
=
PCI_ANY_ID
,
.
subdevice
=
PCI_ANY_ID
,
},
{
}
};
MODULE_DEVICE_TABLE
(
pci
,
agp_i460_pci_table
);
MODULE_DEVICE_TABLE
(
pci
,
agp_i
ntel_i
460_pci_table
);
static
struct
pci_driver
agp
_i460_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_intel
_i460_pci_driver
=
{
.
name
=
"agpgart-intel-i460"
,
.
id_table
=
agp_i460_pci_table
,
.
probe
=
agp_i460_probe
,
.
id_table
=
agp_i
ntel_i
460_pci_table
,
.
probe
=
agp_i
ntel_i
460_probe
,
};
static
int
__init
agp_i460_init
(
void
)
static
int
__init
agp_i
ntel_i
460_init
(
void
)
{
int
ret_val
;
ret_val
=
pci_module_init
(
&
agp_i460_pci_driver
);
ret_val
=
pci_module_init
(
&
agp_i
ntel_i
460_pci_driver
);
if
(
ret_val
)
agp_bridge
.
type
=
NOT_SUPPORTED
;
return
ret_val
;
}
static
void
__exit
agp_i460_cleanup
(
void
)
static
void
__exit
agp_i
ntel_i
460_cleanup
(
void
)
{
agp_unregister_driver
();
pci_unregister_driver
(
&
agp_i460_pci_driver
);
pci_unregister_driver
(
&
agp_i
ntel_i
460_pci_driver
);
}
module_init
(
agp_i460_init
);
module_exit
(
agp_i460_cleanup
);
module_init
(
agp_i
ntel_i
460_init
);
module_exit
(
agp_i
ntel_i
460_cleanup
);
MODULE_AUTHOR
(
"Chris Ahna <Christopher.J.Ahna@intel.com>"
);
MODULE_LICENSE
(
"GPL and additional rights"
);
drivers/char/agp/i7x05-agp.c
View file @
5d7fa0ad
...
...
@@ -87,6 +87,11 @@ static aper_size_info_16 intel_7505_sizes[7] =
{
4
,
1024
,
0
,
0xf3f
}
};
static
void
i7505_setup
(
u32
mode
)
{
if
((
agp_generic_agp_3_0_enable
)
==
FALSE
)
agp_generic_agp_enable
(
mode
);
}
static
int
__init
intel_7505_setup
(
struct
pci_dev
*
pdev
)
{
...
...
@@ -102,7 +107,7 @@ static int __init intel_7505_setup (struct pci_dev *pdev)
agp_bridge
.
cleanup
=
intel_7505_cleanup
;
agp_bridge
.
tlb_flush
=
intel_7505_tlbflush
;
agp_bridge
.
mask_memory
=
intel_mask_memory
;
agp_bridge
.
agp_enable
=
agp_generic_agp_3_0
_enable
;
agp_bridge
.
agp_enable
=
i7505
_enable
;
agp_bridge
.
cache_flush
=
global_cache_flush
;
agp_bridge
.
create_gatt_table
=
agp_generic_create_gatt_table
;
agp_bridge
.
free_gatt_table
=
agp_generic_free_gatt_table
;
...
...
@@ -161,27 +166,26 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
}
static
int
__init
agp_
find_supported_device
(
struct
pci_dev
*
dev
)
static
int
__init
agp_
i7x05_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
agp_bridge
.
dev
=
dev
;
u8
cap_ptr
=
0
;
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
/* probe for known chipsets */
return
agp_lookup_host_bridge
(
dev
);
}
static
int
agp_i7x05_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
)
agp_register_driver
(
dev
);
return
0
;
}
return
-
ENODEV
;
return
-
ENODEV
;
}
static
struct
pci_device_id
agp_i7x05_pci_table
[]
__initdata
=
{
{
.
class
=
(
PCI_CLASS_BRIDGE_HOST
<<
8
),
...
...
@@ -196,7 +200,7 @@ static struct pci_device_id agp_i7x05_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_i7x05_pci_table
);
static
struct
pci_driver
agp_i7x05_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_i7x05_pci_driver
=
{
.
name
=
"agpgart-i7x05"
,
.
id_table
=
agp_i7x05_pci_table
,
.
probe
=
agp_i7x05_probe
,
...
...
drivers/char/agp/intel-agp.c
View file @
5d7fa0ad
...
...
@@ -14,12 +14,12 @@ static int agp_try_unsupported __initdata = 0;
static
struct
aper_size_info_fixed
intel_i810_sizes
[]
=
{
{
64
,
16384
,
4
},
/* The 32M mode still requires a 64k gatt */
/* The 32M mode still requires a 64k gatt */
{
32
,
8192
,
4
}
};
#define AGP_DCACHE_MEMORY
1
#define AGP_PHYS_MEMORY
2
#define AGP_DCACHE_MEMORY
1
#define AGP_PHYS_MEMORY
2
static
struct
gatt_mask
intel_i810_masks
[]
=
{
...
...
@@ -48,12 +48,12 @@ static int intel_i810_fetch_size(void)
}
if
((
smram_miscc
&
I810_GFX_MEM_WIN_SIZE
)
==
I810_GFX_MEM_WIN_32M
)
{
agp_bridge
.
previous_size
=
agp_bridge
.
current_size
=
(
void
*
)
(
values
+
1
);
agp_bridge
.
current_size
=
(
void
*
)
(
values
+
1
);
agp_bridge
.
aperture_size_idx
=
1
;
return
values
[
1
].
size
;
}
else
{
agp_bridge
.
previous_size
=
agp_bridge
.
current_size
=
(
void
*
)
(
values
);
agp_bridge
.
current_size
=
(
void
*
)
(
values
);
agp_bridge
.
aperture_size_idx
=
0
;
return
values
[
0
].
size
;
}
...
...
@@ -72,11 +72,10 @@ static int intel_i810_configure(void)
pci_read_config_dword
(
intel_i810_private
.
i810_dev
,
I810_MMADDR
,
&
temp
);
temp
&=
0xfff80000
;
intel_i810_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
128
*
4096
);
intel_i810_private
.
registers
=
(
volatile
u8
*
)
ioremap
(
temp
,
128
*
4096
);
if
((
INREG32
(
intel_i810_private
.
registers
,
I810_DRAM_CTL
)
&
I810_DRAM_ROW_0
)
==
I810_DRAM_ROW_0_SDRAM
)
{
&
I810_DRAM_ROW_0
)
==
I810_DRAM_ROW_0_SDRAM
)
{
/* This will need to be dynamically assigned */
printk
(
KERN_INFO
PFX
"detected 4MB dedicated video ram.
\n
"
);
intel_i810_private
.
num_dcache_entries
=
1024
;
...
...
@@ -114,7 +113,7 @@ static void intel_i810_agp_enable(u32 mode)
}
static
int
intel_i810_insert_entries
(
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
int
type
)
{
int
i
,
j
,
num_entries
;
void
*
temp
;
...
...
@@ -132,12 +131,10 @@ static int intel_i810_insert_entries(agp_memory * mem, off_t pg_start,
}
if
(
type
!=
0
||
mem
->
type
!=
0
)
{
if
((
type
==
AGP_DCACHE_MEMORY
)
&&
(
mem
->
type
==
AGP_DCACHE_MEMORY
))
{
if
((
type
==
AGP_DCACHE_MEMORY
)
&&
(
mem
->
type
==
AGP_DCACHE_MEMORY
))
{
/* special insert */
CACHE_FLUSH
();
for
(
i
=
pg_start
;
i
<
(
pg_start
+
mem
->
page_count
);
i
++
)
{
for
(
i
=
pg_start
;
i
<
(
pg_start
+
mem
->
page_count
);
i
++
)
{
OUTREG32
(
intel_i810_private
.
registers
,
I810_PTE_BASE
+
(
i
*
4
),
(
i
*
4096
)
|
I810_PTE_LOCAL
|
...
...
@@ -147,15 +144,13 @@ static int intel_i810_insert_entries(agp_memory * mem, off_t pg_start,
agp_bridge
.
tlb_flush
(
mem
);
return
0
;
}
if
((
type
==
AGP_PHYS_MEMORY
)
&&
(
mem
->
type
==
AGP_PHYS_MEMORY
))
{
goto
insert
;
}
if
((
type
==
AGP_PHYS_MEMORY
)
&&
(
mem
->
type
==
AGP_PHYS_MEMORY
))
goto
insert
;
return
-
EINVAL
;
}
insert:
CACHE_FLUSH
();
CACHE_FLUSH
();
for
(
i
=
0
,
j
=
pg_start
;
i
<
mem
->
page_count
;
i
++
,
j
++
)
{
OUTREG32
(
intel_i810_private
.
registers
,
I810_PTE_BASE
+
(
j
*
4
),
mem
->
memory
[
i
]);
...
...
@@ -167,7 +162,7 @@ static int intel_i810_insert_entries(agp_memory * mem, off_t pg_start,
}
static
int
intel_i810_remove_entries
(
agp_memory
*
mem
,
off_t
pg_start
,
int
type
)
int
type
)
{
int
i
;
...
...
@@ -199,7 +194,7 @@ static agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
new
->
page_count
=
pg_count
;
new
->
num_scratch_pages
=
0
;
vfree
(
new
->
memory
);
MOD_INC_USE_COUNT
;
MOD_INC_USE_COUNT
;
return
new
;
}
if
(
type
==
AGP_PHYS_MEMORY
)
{
...
...
@@ -209,15 +204,14 @@ static agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
* Xserver still writes to it through the agp
* aperture
*/
if
(
pg_count
!=
1
)
{
return
NULL
;
}
new
=
agp_create_memory
(
1
);
if
(
pg_count
!=
1
)
return
NULL
;
if
(
new
==
NULL
)
{
new
=
agp_create_memory
(
1
);
if
(
new
==
NULL
)
return
NULL
;
}
MOD_INC_USE_COUNT
;
MOD_INC_USE_COUNT
;
addr
=
agp_bridge
.
agp_alloc_page
();
if
(
addr
==
NULL
)
{
...
...
@@ -227,25 +221,23 @@ static agp_memory *intel_i810_alloc_by_type(size_t pg_count, int type)
}
new
->
memory
[
0
]
=
agp_bridge
.
mask_memory
(
virt_to_phys
(
addr
),
type
);
new
->
page_count
=
1
;
new
->
num_scratch_pages
=
1
;
new
->
type
=
AGP_PHYS_MEMORY
;
new
->
physical
=
virt_to_phys
((
void
*
)
new
->
memory
[
0
]);
return
new
;
new
->
num_scratch_pages
=
1
;
new
->
type
=
AGP_PHYS_MEMORY
;
new
->
physical
=
virt_to_phys
((
void
*
)
new
->
memory
[
0
]);
return
new
;
}
return
NULL
;
}
static
void
intel_i810_free_by_type
(
agp_memory
*
curr
)
{
agp_free_key
(
curr
->
key
);
if
(
curr
->
type
==
AGP_PHYS_MEMORY
)
{
agp_bridge
.
agp_destroy_page
(
phys_to_virt
(
curr
->
memory
[
0
]));
if
(
curr
->
type
==
AGP_PHYS_MEMORY
)
{
agp_bridge
.
agp_destroy_page
(
phys_to_virt
(
curr
->
memory
[
0
]));
vfree
(
curr
->
memory
);
}
kfree
(
curr
);
MOD_DEC_USE_COUNT
;
MOD_DEC_USE_COUNT
;
}
static
unsigned
long
intel_i810_mask_memory
(
unsigned
long
addr
,
int
type
)
...
...
@@ -254,7 +246,7 @@ static unsigned long intel_i810_mask_memory(unsigned long addr, int type)
return
addr
|
agp_bridge
.
masks
[
type
].
mask
;
}
int
__init
intel_i810_setup
(
struct
pci_dev
*
i810_dev
)
static
int
__init
intel_i810_setup
(
struct
pci_dev
*
i810_dev
)
{
intel_i810_private
.
i810_dev
=
i810_dev
;
...
...
@@ -295,7 +287,7 @@ static struct aper_size_info_fixed intel_i830_sizes[] =
};
static
struct
_intel_i830_private
{
struct
pci_dev
*
i830_dev
;
/* device one */
struct
pci_dev
*
i830_dev
;
/* device one */
volatile
u8
*
registers
;
int
gtt_entries
;
}
intel_i830_private
;
...
...
@@ -533,7 +525,7 @@ static agp_memory *intel_i830_alloc_by_type(size_t pg_count,int type)
return
(
NULL
);
}
int
__init
intel_i830_setup
(
struct
pci_dev
*
i830_dev
)
static
int
__init
intel_i830_setup
(
struct
pci_dev
*
i830_dev
)
{
intel_i830_private
.
i830_dev
=
i830_dev
;
...
...
@@ -581,8 +573,7 @@ static int intel_fetch_size(void)
for
(
i
=
0
;
i
<
agp_bridge
.
num_aperture_sizes
;
i
++
)
{
if
(
temp
==
values
[
i
].
size_value
)
{
agp_bridge
.
previous_size
=
agp_bridge
.
current_size
=
(
void
*
)
(
values
+
i
);
agp_bridge
.
previous_size
=
agp_bridge
.
current_size
=
(
void
*
)
(
values
+
i
);
agp_bridge
.
aperture_size_idx
=
i
;
return
values
[
i
].
size
;
}
...
...
@@ -627,11 +618,11 @@ static void intel_tlbflush(agp_memory * mem)
static
void
intel_8xx_tlbflush
(
agp_memory
*
mem
)
{
u32
temp
;
pci_read_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
temp
&
~
(
1
<<
7
));
pci_read_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
temp
|
(
1
<<
7
));
u32
temp
;
pci_read_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
temp
&
~
(
1
<<
7
));
pci_read_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
INTEL_AGPCTRL
,
temp
|
(
1
<<
7
));
}
...
...
@@ -683,7 +674,7 @@ static int intel_configure(void)
/* paccfg/nbxcfg */
pci_read_config_word
(
agp_bridge
.
dev
,
INTEL_NBXCFG
,
&
temp2
);
pci_write_config_word
(
agp_bridge
.
dev
,
INTEL_NBXCFG
,
(
temp2
&
~
(
1
<<
10
))
|
(
1
<<
9
));
(
temp2
&
~
(
1
<<
10
))
|
(
1
<<
9
));
/* clear any possible error conditions */
pci_write_config_byte
(
agp_bridge
.
dev
,
INTEL_ERRSTS
+
1
,
7
);
return
0
;
...
...
@@ -708,7 +699,7 @@ static int intel_815_configure(void)
/* attbase - aperture base */
/* the Intel 815 chipset spec. says that bits 29-31 in the
* ATTBASE register are reserved -> try not to write them */
if
(
agp_bridge
.
gatt_bus_addr
&
INTEL_815_ATTBASE_MASK
)
if
(
agp_bridge
.
gatt_bus_addr
&
INTEL_815_ATTBASE_MASK
)
panic
(
"gatt bus addr too high"
);
pci_read_config_dword
(
agp_bridge
.
dev
,
INTEL_ATTBASE
,
&
addr
);
addr
&=
INTEL_815_ATTBASE_MASK
;
...
...
@@ -729,7 +720,7 @@ static int intel_815_configure(void)
static
void
intel_820_tlbflush
(
agp_memory
*
mem
)
{
return
;
return
;
}
static
void
intel_820_cleanup
(
void
)
...
...
@@ -740,9 +731,9 @@ static void intel_820_cleanup(void)
previous_size
=
A_SIZE_8
(
agp_bridge
.
previous_size
);
pci_read_config_byte
(
agp_bridge
.
dev
,
INTEL_I820_RDCR
,
&
temp
);
pci_write_config_byte
(
agp_bridge
.
dev
,
INTEL_I820_RDCR
,
temp
&
~
(
1
<<
1
));
temp
&
~
(
1
<<
1
));
pci_write_config_byte
(
agp_bridge
.
dev
,
INTEL_APSIZE
,
previous_size
->
size_value
);
previous_size
->
size_value
);
}
...
...
@@ -974,10 +965,10 @@ static struct aper_size_info_16 intel_generic_sizes[7] =
static
struct
aper_size_info_8
intel_830mp_sizes
[
4
]
=
{
{
256
,
65536
,
6
,
0
},
{
128
,
32768
,
5
,
32
},
{
64
,
16384
,
4
,
48
},
{
32
,
8192
,
3
,
56
}
{
256
,
65536
,
6
,
0
},
{
128
,
32768
,
5
,
32
},
{
64
,
16384
,
4
,
48
},
{
32
,
8192
,
3
,
56
}
};
static
int
__init
intel_generic_setup
(
struct
pci_dev
*
pdev
)
...
...
@@ -1322,7 +1313,7 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
/* try init anyway, if user requests it */
if
(
agp_try_unsupported
)
{
printk
(
KERN_WARNING
PFX
"Trying generic Intel routines"
" for device id: %04x
\n
"
,
pdev
->
device
);
" for device id: %04x
\n
"
,
pdev
->
device
);
agp_bridge
.
type
=
INTEL_GENERIC
;
return
intel_generic_setup
(
pdev
);
}
...
...
@@ -1338,6 +1329,7 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
static
int
__init
agp_find_supported_device
(
struct
pci_dev
*
dev
)
{
struct
pci_dev
*
i810_dev
;
u8
cap_ptr
=
0
;
agp_bridge
.
dev
=
dev
;
...
...
@@ -1347,7 +1339,7 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
i810_dev
=
pci_find_device
(
PCI_VENDOR_ID_INTEL
,
PCI_DEVICE_ID_INTEL_82810_IG1
,
NULL
);
if
(
i810_dev
==
NULL
)
{
printk
(
KERN_ERR
PFX
"Detected an Intel i810,"
" but could not find the secondary device.
\n
"
);
" but could not find the secondary device.
\n
"
);
return
-
ENODEV
;
}
printk
(
KERN_INFO
PFX
"Detected an Intel i810 Chipset.
\n
"
);
...
...
@@ -1358,7 +1350,7 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
i810_dev
=
pci_find_device
(
PCI_VENDOR_ID_INTEL
,
PCI_DEVICE_ID_INTEL_82810_IG3
,
NULL
);
if
(
i810_dev
==
NULL
)
{
printk
(
KERN_ERR
PFX
"Detected an Intel i810 DC100, but could not find the "
"secondary device.
\n
"
);
"secondary device.
\n
"
);
return
-
ENODEV
;
}
printk
(
KERN_INFO
PFX
"Detected an Intel i810 DC100 Chipset.
\n
"
);
...
...
@@ -1369,7 +1361,7 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
i810_dev
=
pci_find_device
(
PCI_VENDOR_ID_INTEL
,
PCI_DEVICE_ID_INTEL_82810E_IG
,
NULL
);
if
(
i810_dev
==
NULL
)
{
printk
(
KERN_ERR
PFX
"Detected an Intel i810 E"
", but could not find the secondary device.
\n
"
);
", but could not find the secondary device.
\n
"
);
return
-
ENODEV
;
}
printk
(
KERN_INFO
PFX
"Detected an Intel i810 E Chipset.
\n
"
);
...
...
@@ -1377,11 +1369,11 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
return
intel_i810_setup
(
i810_dev
);
case
PCI_DEVICE_ID_INTEL_82815_MC
:
/* The i815 can operate either as an i810 style
* integrated device, or as an AGP4X motherboard.
*
* This only addresses the first mode:
*/
/* The i815 can operate either as an i810 style
* integrated device, or as an AGP4X motherboard.
*
* This only addresses the first mode:
*/
i810_dev
=
pci_find_device
(
PCI_VENDOR_ID_INTEL
,
PCI_DEVICE_ID_INTEL_82815_CGC
,
NULL
);
if
(
i810_dev
==
NULL
)
{
printk
(
KERN_ERR
PFX
"agpgart: Detected an "
...
...
@@ -1413,7 +1405,7 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
printk
(
KERN_INFO
PFX
"Detected an Intel 845G Chipset.
\n
"
);
agp_bridge
.
type
=
INTEL_I810
;
return
intel_i830_setup
(
i810_dev
);
case
PCI_DEVICE_ID_INTEL_82830_HB
:
i810_dev
=
pci_find_device
(
PCI_VENDOR_ID_INTEL
,
PCI_DEVICE_ID_INTEL_82830_CGC
,
NULL
);
if
(
i810_dev
&&
PCI_FUNC
(
i810_dev
->
devfn
)
!=
0
)
...
...
@@ -1433,15 +1425,20 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
break
;
}
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
/* probe for known chipsets */
return
agp_lookup_host_bridge
(
dev
);
}
static
int
agp_intel_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_intel_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
agp_register_driver
(
dev
);
...
...
@@ -1464,7 +1461,7 @@ static struct pci_device_id agp_intel_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_intel_pci_table
);
static
struct
pci_driver
agp_intel_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_intel_pci_driver
=
{
.
name
=
"agpgart-intel"
,
.
id_table
=
agp_intel_pci_table
,
.
probe
=
agp_intel_probe
,
...
...
@@ -1498,4 +1495,3 @@ module_exit(agp_intel_cleanup);
MODULE_PARM
(
agp_try_unsupported
,
"1i"
);
MODULE_AUTHOR
(
"Dave Jones <davej@codemonkey.org.uk>"
);
MODULE_LICENSE
(
"GPL and additional rights"
);
drivers/char/agp/sis-agp.c
View file @
5d7fa0ad
...
...
@@ -86,7 +86,7 @@ static struct gatt_mask sis_generic_masks[] =
{.
mask
=
0x00000000
,
.
type
=
0
}
};
int
__init
sis_generic_setup
(
struct
pci_dev
*
pdev
)
static
int
__init
sis_generic_setup
(
struct
pci_dev
*
pdev
)
{
agp_bridge
.
masks
=
sis_generic_masks
;
agp_bridge
.
num_of_masks
=
1
;
...
...
@@ -223,25 +223,24 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
}
static
int
__init
agp_
find_supported_device
(
struct
pci_dev
*
dev
)
static
int
__init
agp_
sis_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
agp_bridge
.
dev
=
dev
;
u8
cap_ptr
=
0
;
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
/* probe for known chipsets */
return
agp_lookup_host_bridge
(
dev
);
}
static
int
agp_sis_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
agp_register_driver
(
dev
);
return
0
;
}
return
-
ENODEV
;
return
-
ENODEV
;
}
static
struct
pci_device_id
agp_sis_pci_table
[]
__initdata
=
{
...
...
@@ -258,13 +257,13 @@ static struct pci_device_id agp_sis_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_sis_pci_table
);
static
struct
pci_driver
agp_sis_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_sis_pci_driver
=
{
.
name
=
"agpgart-sis"
,
.
id_table
=
agp_sis_pci_table
,
.
probe
=
agp_sis_probe
,
};
int
__init
agp_sis_init
(
void
)
static
int
__init
agp_sis_init
(
void
)
{
int
ret_val
;
...
...
drivers/char/agp/sworks-agp.c
View file @
5d7fa0ad
...
...
@@ -169,9 +169,7 @@ static int serverworks_create_gatt_table(void)
* used to program the agp master not the cpu
*/
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp
);
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp
);
agp_bridge
.
gart_bus_addr
=
(
temp
&
PCI_BASE_ADDRESS_MEM_MASK
);
/* Calculate the agp offset */
...
...
@@ -206,18 +204,11 @@ static int serverworks_fetch_size(void)
struct
aper_size_info_lvl2
*
values
;
values
=
A_SIZE_LVL2
(
agp_bridge
.
aperture_sizes
);
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
SVWRKS_SIZE_MASK
);
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp2
);
pci_write_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
temp
);
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp
);
pci_write_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
SVWRKS_SIZE_MASK
);
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
&
temp2
);
pci_write_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
gart_addr_ofs
,
temp
);
temp2
&=
SVWRKS_SIZE_MASK
;
for
(
i
=
0
;
i
<
agp_bridge
.
num_aperture_sizes
;
i
++
)
{
...
...
@@ -245,9 +236,7 @@ static int serverworks_configure(void)
current_size
=
A_SIZE_LVL2
(
agp_bridge
.
current_size
);
/* Get the memory mapped registers */
pci_read_config_dword
(
agp_bridge
.
dev
,
serverworks_private
.
mm_addr_ofs
,
&
temp
);
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
);
...
...
@@ -269,7 +258,7 @@ static int serverworks_configure(void)
agp_bridge
.
tlb_flush
(
NULL
);
pci_read_config_byte
(
serverworks_private
.
svrwrks_dev
,
0x34
,
&
cap_ptr
);
if
(
cap_ptr
!=
0
x00
)
{
if
(
cap_ptr
!=
0
)
{
do
{
pci_read_config_dword
(
serverworks_private
.
svrwrks_dev
,
cap_ptr
,
&
cap_id
);
...
...
@@ -277,30 +266,21 @@ static int serverworks_configure(void)
if
((
cap_id
&
0xff
)
!=
0x02
)
cap_ptr
=
(
cap_id
>>
8
)
&
0xff
;
}
while
(((
cap_id
&
0xff
)
!=
0x02
)
&&
(
cap_ptr
!=
0
x00
));
while
(((
cap_id
&
0xff
)
!=
0x02
)
&&
(
cap_ptr
!=
0
));
}
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
serverworks_private
.
svrwrks_dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
pci_read_config_byte
(
agp_bridge
.
dev
,
SVWRKS_CACHING
,
&
enable_reg
);
pci_read_config_byte
(
agp_bridge
.
dev
,
SVWRKS_CACHING
,
&
enable_reg
);
enable_reg
&=
~
0x3
;
pci_write_config_byte
(
agp_bridge
.
dev
,
SVWRKS_CACHING
,
enable_reg
);
pci_write_config_byte
(
agp_bridge
.
dev
,
SVWRKS_CACHING
,
enable_reg
);
pci_read_config_byte
(
agp_bridge
.
dev
,
SVWRKS_FEATURE
,
&
enable_reg
);
pci_read_config_byte
(
agp_bridge
.
dev
,
SVWRKS_FEATURE
,
&
enable_reg
);
enable_reg
|=
(
1
<<
6
);
pci_write_config_byte
(
agp_bridge
.
dev
,
SVWRKS_FEATURE
,
enable_reg
);
pci_write_config_byte
(
agp_bridge
.
dev
,
SVWRKS_FEATURE
,
enable_reg
);
return
0
;
}
...
...
@@ -532,7 +512,7 @@ static void serverworks_agp_enable(u32 mode)
}
}
int
__init
serverworks_setup
(
struct
pci_dev
*
pdev
)
static
int
__init
serverworks_setup
(
struct
pci_dev
*
pdev
)
{
u32
temp
;
u32
temp2
;
...
...
@@ -606,7 +586,6 @@ int __init serverworks_setup (struct pci_dev *pdev)
static
int
__init
agp_find_supported_device
(
struct
pci_dev
*
dev
)
{
struct
pci_dev
*
bridge_dev
;
agp_bridge
.
dev
=
dev
;
/* Everything is on func 1 here so we are hardcoding function one */
bridge_dev
=
pci_find_slot
((
unsigned
int
)
dev
->
bus
->
number
,
PCI_DEVFN
(
0
,
1
));
...
...
@@ -617,6 +596,8 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
return
-
ENODEV
;
}
agp_bridge
.
dev
=
dev
;
switch
(
dev
->
device
)
{
case
PCI_DEVICE_ID_SERVERWORKS_HE
:
agp_bridge
.
type
=
SVWRKS_HE
;
...
...
@@ -638,7 +619,7 @@ static int __init agp_find_supported_device(struct pci_dev *dev)
}
static
int
agp_serverworks_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_serverworks_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
agp_find_supported_device
(
dev
)
==
0
)
{
agp_register_driver
(
dev
);
...
...
@@ -661,7 +642,7 @@ static struct pci_device_id agp_serverworks_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_serverworks_pci_table
);
static
struct
pci_driver
agp_serverworks_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_serverworks_pci_driver
=
{
.
name
=
"agpgart-serverworks"
,
.
id_table
=
agp_serverworks_pci_table
,
.
probe
=
agp_serverworks_probe
,
...
...
drivers/char/agp/via-agp.c
View file @
5d7fa0ad
...
...
@@ -94,7 +94,7 @@ static struct gatt_mask via_generic_masks[] =
{.
mask
=
0x00000000
,
.
type
=
0
}
};
int
__init
via_generic_setup
(
struct
pci_dev
*
pdev
)
static
int
__init
via_generic_setup
(
struct
pci_dev
*
pdev
)
{
agp_bridge
.
masks
=
via_generic_masks
;
agp_bridge
.
num_of_masks
=
1
;
...
...
@@ -124,13 +124,64 @@ int __init via_generic_setup (struct pci_dev *pdev)
return
0
;
}
struct
agp_device_ids
via_agp_device_ids
[]
__initdata
=
/*
* The KT400 does magick to put the AGP bridge compliant with the same
* standards version as the graphics card. If we haven't fallen into
* 2.0 compatability mode, we run the normal 3.0 code, and fall back
* if something nasty happens.
*/
static
void
__init
via_kt400_enable
(
u32
mode
)
{
if
((
agp_generic_agp_3_0_enable
(
mode
))
==
FALSE
)
/* Something weird happened, fall back to 2.0 */
agp_generic_agp_enable
(
mode
);
}
static
int
__init
via_kt400_setup
(
struct
pci_dev
*
pdev
)
{
u8
reg
;
agp_bridge
.
masks
=
via_generic_masks
;
agp_bridge
.
num_of_masks
=
1
;
agp_bridge
.
aperture_sizes
=
(
void
*
)
via_generic_sizes
;
agp_bridge
.
size_type
=
U8_APER_SIZE
;
agp_bridge
.
num_aperture_sizes
=
7
;
agp_bridge
.
dev_private_data
=
NULL
;
agp_bridge
.
needs_scratch_page
=
FALSE
;
agp_bridge
.
configure
=
via_configure
;
agp_bridge
.
fetch_size
=
via_fetch_size
;
agp_bridge
.
cleanup
=
via_cleanup
;
agp_bridge
.
tlb_flush
=
via_tlbflush
;
agp_bridge
.
mask_memory
=
via_mask_memory
;
agp_bridge
.
cache_flush
=
global_cache_flush
;
agp_bridge
.
create_gatt_table
=
agp_generic_create_gatt_table
;
agp_bridge
.
free_gatt_table
=
agp_generic_free_gatt_table
;
agp_bridge
.
insert_memory
=
agp_generic_insert_memory
;
agp_bridge
.
remove_memory
=
agp_generic_remove_memory
;
agp_bridge
.
alloc_by_type
=
agp_generic_alloc_by_type
;
agp_bridge
.
free_by_type
=
agp_generic_free_by_type
;
agp_bridge
.
agp_alloc_page
=
agp_generic_alloc_page
;
agp_bridge
.
agp_destroy_page
=
agp_generic_destroy_page
;
agp_bridge
.
suspend
=
agp_generic_suspend
;
agp_bridge
.
resume
=
agp_generic_resume
;
agp_bridge
.
cant_use_aperture
=
0
;
pci_read_config_byte
(
agp_bridge
.
dev
,
VIA_AGPSEL
,
&
reg
);
if
((
reg
&
(
1
<<
1
))
==
1
)
{
/* AGP 2.0 compatability mode. */
agp_bridge
.
agp_enable
=
agp_generic_agp_enable
;
}
else
{
/* AGP 3.0 mode */
agp_bridge
.
agp_enable
=
via_kt400_enable
;
}
return
0
;
}
static
struct
agp_device_ids
via_agp_device_ids
[]
__initdata
=
{
{
.
device_id
=
PCI_DEVICE_ID_VIA_8501_0
,
.
chipset
=
VIA_MVP4
,
.
chipset_name
=
"MVP4"
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_82C597_0
,
.
chipset
=
VIA_VP3
,
...
...
@@ -141,6 +192,11 @@ struct agp_device_ids via_agp_device_ids[] __initdata =
.
chipset
=
VIA_MVP3
,
.
chipset_name
=
"MVP3"
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_8501_0
,
.
chipset
=
VIA_MVP4
,
.
chipset_name
=
"MVP4"
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_82C691
,
.
chipset
=
VIA_APOLLO_PRO
,
...
...
@@ -166,20 +222,22 @@ struct agp_device_ids via_agp_device_ids[] __initdata =
.
chipset
=
VIA_APOLLO_KT133
,
.
chipset_name
=
"Apollo Pro KT266"
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_8653_0
,
.
chipset
=
VIA_APOLLO_PRO
,
.
chipset_name
=
"Apollo Pro 266T"
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_8377_0
,
.
chipset
=
VIA_APOLLO_KT400
,
.
chipset_name
=
"Apollo Pro KT400"
,
.
chipset_setup
=
via_kt400_setup
,
},
{
.
device_id
=
PCI_DEVICE_ID_VIA_8653_0
,
.
chipset
=
VIA_APOLLO_PRO
,
.
chipset_name
=
"Apollo Pro266T"
,
},
{
/* VIA ProSavage PM133 (Apollo Pro133A chipset with S3 Savage4) */
.
device_id
=
PCI_DEVICE_ID_VIA_82C694X_0
,
.
chipset
=
VIA_VT8605
,
.
chipset_name
=
"PM133"
.
chipset_name
=
"
Apollo ProSavage
PM133"
},
{
},
/* dummy final entry, always present */
};
...
...
@@ -220,15 +278,20 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
}
static
int
agp_via_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
static
int
__init
agp_via_probe
(
struct
pci_dev
*
dev
,
const
struct
pci_device_id
*
ent
)
{
if
(
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
)
==
0
)
return
-
ENODEV
;
u8
cap_ptr
=
0
;
agp_bridge
.
dev
=
dev
;
cap_ptr
=
pci_find_capability
(
dev
,
PCI_CAP_ID_AGP
);
if
(
cap_ptr
==
0
)
return
-
ENODEV
;
/* probe for known chipsets */
if
(
agp_lookup_host_bridge
(
dev
)
!=
-
ENODEV
)
{
agp_bridge
.
dev
=
dev
;
agp_bridge
.
capndx
=
cap_ptr
;
/* Fill in the mode register */
pci_read_config_dword
(
agp_bridge
.
dev
,
agp_bridge
.
capndx
+
4
,
&
agp_bridge
.
mode
);
agp_register_driver
(
dev
);
return
0
;
}
...
...
@@ -249,7 +312,7 @@ static struct pci_device_id agp_via_pci_table[] __initdata = {
MODULE_DEVICE_TABLE
(
pci
,
agp_via_pci_table
);
static
struct
pci_driver
agp_via_pci_driver
=
{
static
struct
__initdata
pci_driver
agp_via_pci_driver
=
{
.
name
=
"agpgart-via"
,
.
id_table
=
agp_via_pci_table
,
.
probe
=
agp_via_probe
,
...
...
drivers/scsi/aic7xxx_old.c
View file @
5d7fa0ad
...
...
@@ -6736,12 +6736,12 @@ aic7xxx_device_queue_depth(struct aic7xxx_host *p, Scsi_Device *device)
* prepare for this device to go away
*-F*************************************************************************/
static
void
aic7xxx_slave_destroy
(
Scsi_Device
*
sdpnt
)
aic7xxx_slave_destroy
(
Scsi_Device
*
SDptr
)
{
struct
aic_dev_data
*
aic_dev
=
sdpnt
->
hostdata
;
struct
aic_dev_data
*
aic_dev
=
SDptr
->
hostdata
;
list_del
(
&
aic_dev
->
list
);
sdpnt
->
hostdata
=
NULL
;
SDptr
->
hostdata
=
NULL
;
kfree
(
aic_dev
);
return
;
}
...
...
@@ -6756,16 +6756,16 @@ aic7xxx_slave_destroy(Scsi_Device *sdpnt)
* depths, allocate command structs, etc.
*-F*************************************************************************/
static
int
aic7xxx_slave_configure
(
Scsi_Device
*
sdpnt
)
aic7xxx_slave_configure
(
Scsi_Device
*
SDptr
)
{
struct
aic7xxx_host
*
p
=
(
struct
aic7xxx_host
*
)
sdpnt
->
host
->
hostdata
;
struct
aic7xxx_host
*
p
=
(
struct
aic7xxx_host
*
)
SDptr
->
host
->
hostdata
;
struct
aic_dev_data
*
aic_dev
;
int
scbnum
;
aic_dev
=
(
struct
aic_dev_data
*
)
sdpnt
->
hostdata
;
aic_dev
=
(
struct
aic_dev_data
*
)
SDptr
->
hostdata
;
aic7xxx_init_transinfo
(
p
,
aic_dev
);
aic7xxx_device_queue_depth
(
p
,
sdpnt
);
aic7xxx_device_queue_depth
(
p
,
SDptr
);
if
(
list_empty
(
&
aic_dev
->
list
))
list_add_tail
(
&
aic_dev
->
list
,
&
p
->
aic_devs
);
...
...
@@ -9024,7 +9024,6 @@ aic7xxx_detect(Scsi_Host_Template *template)
template
->
proc_name
=
"aic7xxx"
;
template
->
sg_tablesize
=
AIC7XXX_MAX_SG
;
template
->
max_sectors
=
2048
;
#ifdef CONFIG_PCI
...
...
@@ -9246,12 +9245,22 @@ aic7xxx_detect(Scsi_Host_Template *template)
{
/* duplicate PCI entry, skip it */
kfree
(
temp_p
);
temp_p
=
NULL
;
continue
;
}
current_p
=
current_p
->
next
;
}
if
(
temp_p
==
NULL
)
if
(
pci_request_regions
(
temp_p
->
pdev
,
"aic7xxx"
))
{
printk
(
"aic7xxx: <%s> at PCI %d/%d/%d
\n
"
,
board_names
[
aic_pdevs
[
i
].
board_name_index
],
temp_p
->
pci_bus
,
PCI_SLOT
(
temp_p
->
pci_device_fn
),
PCI_FUNC
(
temp_p
->
pci_device_fn
));
printk
(
"aic7xxx: I/O ports already in use, ignoring.
\n
"
);
kfree
(
temp_p
);
continue
;
}
if
(
aic7xxx_verbose
&
VERBOSE_PROBE2
)
printk
(
"aic7xxx: <%s> at PCI %d/%d
\n
"
,
board_names
[
aic_pdevs
[
i
].
board_name_index
],
...
...
@@ -9283,20 +9292,6 @@ aic7xxx_detect(Scsi_Host_Template *template)
pci_write_config_dword
(
pdev
,
DEVCONFIG
,
devconfig
);
#endif
/* AIC7XXX_STRICT_PCI_SETUP */
if
(
temp_p
->
base
&&
!
request_region
(
temp_p
->
base
,
MAXREG
-
MINREG
,
"aic7xxx"
))
{
printk
(
"aic7xxx: <%s> at PCI %d/%d/%d
\n
"
,
board_names
[
aic_pdevs
[
i
].
board_name_index
],
temp_p
->
pci_bus
,
PCI_SLOT
(
temp_p
->
pci_device_fn
),
PCI_FUNC
(
temp_p
->
pci_device_fn
));
printk
(
"aic7xxx: I/O ports already in use, ignoring.
\n
"
);
kfree
(
temp_p
);
temp_p
=
NULL
;
continue
;
}
temp_p
->
unpause
=
INTEN
;
temp_p
->
pause
=
temp_p
->
unpause
|
PAUSE
;
if
(
((
temp_p
->
base
==
0
)
&&
...
...
@@ -9309,9 +9304,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
PCI_SLOT
(
temp_p
->
pci_device_fn
),
PCI_FUNC
(
temp_p
->
pci_device_fn
));
printk
(
"aic7xxx: Controller disabled by BIOS, ignoring.
\n
"
);
kfree
(
temp_p
);
temp_p
=
NULL
;
continue
;
goto
skip_pci_controller
;
}
#ifdef MMAPIO
...
...
@@ -9353,9 +9346,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
PCI_SLOT
(
temp_p
->
pci_device_fn
),
PCI_FUNC
(
temp_p
->
pci_device_fn
));
printk
(
"aic7xxx: Controller disabled by BIOS, ignoring.
\n
"
);
kfree
(
temp_p
);
temp_p
=
NULL
;
continue
;
goto
skip_pci_controller
;
}
}
}
...
...
@@ -9398,10 +9389,7 @@ aic7xxx_detect(Scsi_Host_Template *template)
if
(
aic7xxx_chip_reset
(
temp_p
)
==
-
1
)
{
release_region
(
temp_p
->
base
,
MAXREG
-
MINREG
);
kfree
(
temp_p
);
temp_p
=
NULL
;
continue
;
goto
skip_pci_controller
;
}
/*
* Very quickly put the term setting back into the register since
...
...
@@ -9687,6 +9675,10 @@ aic7xxx_detect(Scsi_Host_Template *template)
}
temp_p
->
next
=
NULL
;
found
++
;
continue
;
skip_pci_controller:
pci_release_regions
(
temp_p
->
pdev
);
kfree
(
temp_p
);
}
/* Found an Adaptec PCI device. */
else
/* Well, we found one, but we couldn't get any memory */
{
...
...
@@ -10969,14 +10961,16 @@ aic7xxx_release(struct Scsi_Host *host)
if
(
p
->
irq
)
free_irq
(
p
->
irq
,
p
);
if
(
p
->
base
)
release_region
(
p
->
base
,
MAXREG
-
MINREG
);
#ifdef MMAPIO
if
(
p
->
maddr
)
{
iounmap
((
void
*
)
(((
unsigned
long
)
p
->
maddr
)
&
PAGE_MASK
));
}
#endif
/* MMAPIO */
if
(
!
p
->
pdev
)
release_region
(
p
->
base
,
MAXREG
-
MINREG
);
else
pci_release_regions
(
p
->
pdev
);
prev
=
NULL
;
next
=
first_aic7xxx
;
while
(
next
!=
NULL
)
...
...
drivers/scsi/aic7xxx_old/aic7xxx.h
View file @
5d7fa0ad
...
...
@@ -45,6 +45,7 @@
can_queue: 255,
/* max simultaneous cmds */
\
this_id: -1,
/* scsi id of host adapter */
\
sg_tablesize: 0,
/* max scatter-gather cmds */
\
max_sectors: 2048,
/* max physical sectors in 1 cmd */
\
cmd_per_lun: 3,
/* cmds per lun (linked cmds) */
\
present: 0,
/* number of 7xxx's present */
\
unchecked_isa_dma: 0,
/* no memory DMA restrictions */
\
...
...
drivers/scsi/scsi.c
View file @
5d7fa0ad
...
...
@@ -160,15 +160,13 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt);
*/
void
scsi_initialize_queue
(
Scsi_Device
*
SDpnt
,
struct
Scsi_Host
*
SHpnt
)
{
request_queue_t
*
q
=
&
SDpnt
->
request_queue
;
request_queue_t
*
q
=
SDpnt
->
request_queue
;
/*
* tell block layer about assigned host_lock for this host
*/
blk_init_queue
(
q
,
scsi_request_fn
,
SHpnt
->
host_lock
);
q
->
queuedata
=
(
void
*
)
SDpnt
;
/* Hardware imposed limit. */
blk_queue_max_hw_segments
(
q
,
SHpnt
->
sg_tablesize
);
...
...
@@ -223,7 +221,7 @@ __setup("scsi_logging=", scsi_logging_setup);
static
void
scsi_wait_done
(
Scsi_Cmnd
*
SCpnt
)
{
struct
request
*
req
=
SCpnt
->
request
;
struct
request_queue
*
q
=
&
SCpnt
->
device
->
request_queue
;
struct
request_queue
*
q
=
SCpnt
->
device
->
request_queue
;
unsigned
long
flags
;
ASSERT_LOCK
(
q
->
queue_lock
,
0
);
...
...
@@ -656,17 +654,14 @@ int scsi_mlqueue_insert(Scsi_Cmnd * cmd, int reason)
*/
void
scsi_release_command
(
Scsi_Cmnd
*
SCpnt
)
{
request_queue_t
*
q
=
&
SCpnt
->
device
->
request_queue
;
__scsi_release_command
(
SCpnt
);
/*
* Finally, hit the queue request function to make sure that
* the device is actually busy if there are requests present.
* This won't block - if the device cannot take any more, life
* will go on.
*/
scsi_queue_next_request
(
q
,
NULL
);
scsi_queue_next_request
(
SCpnt
->
device
->
request_queue
,
NULL
);
}
/*
...
...
@@ -810,13 +805,12 @@ void scsi_wait_req (Scsi_Request * SRpnt, const void *cmnd ,
int
timeout
,
int
retries
)
{
DECLARE_COMPLETION
(
wait
);
request_queue_t
*
q
=
&
SRpnt
->
sr_device
->
request_queue
;
SRpnt
->
sr_request
->
waiting
=
&
wait
;
SRpnt
->
sr_request
->
rq_status
=
RQ_SCSI_BUSY
;
scsi_do_req
(
SRpnt
,
(
void
*
)
cmnd
,
buffer
,
bufflen
,
scsi_wait_done
,
timeout
,
retries
);
generic_unplug_device
(
q
);
generic_unplug_device
(
SRpnt
->
sr_device
->
request_queue
);
wait_for_completion
(
&
wait
);
SRpnt
->
sr_request
->
waiting
=
NULL
;
if
(
SRpnt
->
sr_command
!=
NULL
)
...
...
@@ -1912,10 +1906,8 @@ void scsi_device_put(struct scsi_device *sdev)
*/
int
scsi_slave_attach
(
struct
scsi_device
*
sdev
)
{
/* all this code is now handled elsewhere
if (sdev->attached++ == 0) {
/*
* No one was attached.
*/
scsi_build_commandblocks(sdev);
if (sdev->current_queue_depth == 0) {
printk(KERN_ERR "scsi: Allocation failure during"
...
...
@@ -1935,6 +1927,8 @@ int scsi_slave_attach(struct scsi_device *sdev)
scsi_adjust_queue_depth(sdev, 0,
sdev->host->cmd_per_lun);
}
*/
sdev
->
attached
++
;
return
0
;
}
...
...
@@ -1950,9 +1944,12 @@ int scsi_slave_attach(struct scsi_device *sdev)
*/
void
scsi_slave_detach
(
struct
scsi_device
*
sdev
)
{
/*
if (--sdev->attached == 0) {
scsi_release_commandblocks(sdev);
}
*/
sdev
->
attached
--
;
}
/*
* This entry point should be called by a loadable module if it is trying
...
...
drivers/scsi/scsi.h
View file @
5d7fa0ad
...
...
@@ -569,14 +569,12 @@ struct scsi_device {
/*
* This information is private to the scsi mid-layer.
*/
struct
scsi_device
*
next
;
/* Used for linked list */
struct
scsi_device
*
prev
;
/* Used for linked list */
struct
list_head
siblings
;
/* list of all devices on this host */
struct
list_head
same_target_siblings
;
/* just the devices sharing same target id */
wait_queue_head_t
scpnt_wait
;
/* Used to wait if
device is busy */
struct
Scsi_Host
*
host
;
request_queue_t
request_queue
;
request_queue_t
*
request_queue
;
atomic_t
device_active
;
/* commands checked out for device */
volatile
unsigned
short
device_busy
;
/* commands actually active on low-level */
struct
list_head
free_cmnds
;
/* list of available Scsi_Cmnd structs */
...
...
@@ -894,11 +892,9 @@ extern int scsi_reset_provider(Scsi_Device *, int);
* would be adjustable from 0 to depth.
**/
static
inline
void
scsi_activate_tcq
(
Scsi_Device
*
SDpnt
,
int
depth
)
{
request_queue_t
*
q
=
&
SDpnt
->
request_queue
;
if
(
SDpnt
->
tagged_supported
)
{
if
(
!
blk_queue_tagged
(
q
))
blk_queue_init_tags
(
q
,
depth
);
if
(
!
blk_queue_tagged
(
SDpnt
->
request_queue
))
blk_queue_init_tags
(
SDpnt
->
request_queue
,
depth
);
scsi_adjust_queue_depth
(
SDpnt
,
MSG_ORDERED_TAG
,
depth
);
}
}
...
...
@@ -908,10 +904,8 @@ static inline void scsi_activate_tcq(Scsi_Device *SDpnt, int depth) {
* @SDpnt: device to turn off TCQ for
**/
static
inline
void
scsi_deactivate_tcq
(
Scsi_Device
*
SDpnt
,
int
depth
)
{
request_queue_t
*
q
=
&
SDpnt
->
request_queue
;
if
(
blk_queue_tagged
(
q
))
blk_queue_free_tags
(
q
);
if
(
blk_queue_tagged
(
SDpnt
->
request_queue
))
blk_queue_free_tags
(
SDpnt
->
request_queue
);
scsi_adjust_queue_depth
(
SDpnt
,
0
,
depth
);
}
...
...
@@ -957,7 +951,7 @@ static inline Scsi_Cmnd *scsi_find_tag(Scsi_Device *SDpnt, int tag) {
/* single command, look in space */
return
SDpnt
->
current_cmnd
;
req
=
blk_queue_find_tag
(
&
SDpnt
->
request_queue
,
tag
);
req
=
blk_queue_find_tag
(
SDpnt
->
request_queue
,
tag
);
if
(
req
==
NULL
)
return
NULL
;
...
...
drivers/scsi/scsi_error.c
View file @
5d7fa0ad
...
...
@@ -1487,7 +1487,7 @@ static void scsi_restart_operations(struct Scsi_Host *shost)
break
;
}
__blk_run_queue
(
&
sdev
->
request_queue
);
__blk_run_queue
(
sdev
->
request_queue
);
}
spin_unlock_irqrestore
(
shost
->
host_lock
,
flags
);
}
...
...
drivers/scsi/scsi_lib.c
View file @
5d7fa0ad
...
...
@@ -57,9 +57,8 @@ struct scsi_host_sg_pool scsi_sg_pools[SG_MEMPOOL_NR] = {
*/
int
scsi_insert_special_cmd
(
Scsi_Cmnd
*
SCpnt
,
int
at_head
)
{
request_queue_t
*
q
=
&
SCpnt
->
device
->
request_queue
;
blk_insert_request
(
q
,
SCpnt
->
request
,
at_head
,
SCpnt
);
blk_insert_request
(
SCpnt
->
device
->
request_queue
,
SCpnt
->
request
,
at_head
,
SCpnt
);
return
0
;
}
...
...
@@ -85,16 +84,13 @@ int scsi_insert_special_cmd(Scsi_Cmnd * SCpnt, int at_head)
*/
int
scsi_insert_special_req
(
Scsi_Request
*
SRpnt
,
int
at_head
)
{
request_queue_t
*
q
=
&
SRpnt
->
sr_device
->
request_queue
;
/* This is used to insert SRpnt specials. Because users of
* this function are apt to reuse requests with no modification,
* we have to sanitise the request flags here
*/
SRpnt
->
sr_request
->
flags
&=
~
REQ_DONTPREP
;
blk_insert_request
(
q
,
SRpnt
->
sr_request
,
at_head
,
SRpnt
);
blk_insert_request
(
SRpnt
->
sr_device
->
request_queue
,
SRpnt
->
sr_request
,
at_head
,
SRpnt
);
return
0
;
}
...
...
@@ -215,7 +211,7 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
{
int
all_clear
;
unsigned
long
flags
;
Scsi_Device
*
SDpnt
;
Scsi_Device
*
SDpnt
,
*
SDpnt2
;
struct
Scsi_Host
*
SHpnt
;
ASSERT_LOCK
(
q
->
queue_lock
,
0
);
...
...
@@ -256,17 +252,17 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
* with special case code, then spin off separate versions and
* use function pointers to pick the right one.
*/
if
(
SDpnt
->
single_lun
&&
blk_queue_empty
(
q
)
&&
SDpnt
->
device_busy
==
0
)
{
list_for_each_entry
(
SDpnt
,
&
SHpnt
->
my_devices
,
siblings
)
{
if
(((
SHpnt
->
can_queue
>
0
)
&&
(
SHpnt
->
host_busy
>=
SHpnt
->
can_queue
))
||
(
SHpnt
->
host_blocked
)
||
(
SHpnt
->
host_self_blocked
)
||
(
SDpnt
->
device_blocked
))
{
if
(
SDpnt
->
single_lun
&&
blk_queue_empty
(
q
)
&&
SDpnt
->
device_busy
==
0
&&
!
SHpnt
->
host_blocked
&&
!
SHpnt
->
host_self_blocked
&&
!
((
SHpnt
->
can_queue
>
0
)
&&
(
SHpnt
->
host_busy
>=
SHpnt
->
can_queue
)))
{
list_for_each_entry
(
SDpnt2
,
&
SDpnt
->
same_target_siblings
,
same_target_siblings
)
{
if
(
!
SDpnt2
->
device_blocked
&&
!
blk_queue_empty
(
SDpnt2
->
request_queue
))
{
__blk_run_queue
(
SDpnt2
->
request_queue
);
break
;
}
__blk_run_queue
(
&
SDpnt
->
request_queue
);
}
}
...
...
@@ -289,7 +285,7 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
if
(
SDpnt
->
device_blocked
||
!
SDpnt
->
starved
)
{
continue
;
}
__blk_run_queue
(
&
SDpnt
->
request_queue
);
__blk_run_queue
(
SDpnt
->
request_queue
);
all_clear
=
0
;
}
if
(
SDpnt
==
NULL
&&
all_clear
)
{
...
...
@@ -327,7 +323,7 @@ static Scsi_Cmnd *scsi_end_request(Scsi_Cmnd * SCpnt,
int
sectors
,
int
requeue
)
{
request_queue_t
*
q
=
&
SCpnt
->
device
->
request_queue
;
request_queue_t
*
q
=
SCpnt
->
device
->
request_queue
;
struct
request
*
req
=
SCpnt
->
request
;
unsigned
long
flags
;
...
...
@@ -497,7 +493,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
{
int
result
=
SCpnt
->
result
;
int
this_count
=
SCpnt
->
bufflen
>>
9
;
request_queue_t
*
q
=
&
SCpnt
->
device
->
request_queue
;
request_queue_t
*
q
=
SCpnt
->
device
->
request_queue
;
struct
request
*
req
=
SCpnt
->
request
;
/*
...
...
@@ -1094,7 +1090,7 @@ void scsi_unblock_requests(struct Scsi_Host * SHpnt)
SHpnt
->
host_self_blocked
=
FALSE
;
/* Now that we are unblocked, try to start the queues. */
list_for_each_entry
(
SDloop
,
&
SHpnt
->
my_devices
,
siblings
)
scsi_queue_next_request
(
&
SDloop
->
request_queue
,
NULL
);
scsi_queue_next_request
(
SDloop
->
request_queue
,
NULL
);
}
/*
...
...
drivers/scsi/scsi_scan.c
View file @
5d7fa0ad
...
...
@@ -371,7 +371,7 @@ static void print_inquiry(unsigned char *inq_result)
*/
static
void
scsi_initialize_merge_fn
(
struct
scsi_device
*
sd
)
{
request_queue_t
*
q
=
&
sd
->
request_queue
;
request_queue_t
*
q
=
sd
->
request_queue
;
struct
Scsi_Host
*
sh
=
sd
->
host
;
struct
device
*
dev
=
scsi_get_device
(
sh
);
u64
bounce_limit
;
...
...
@@ -407,14 +407,12 @@ static void scsi_initialize_merge_fn(struct scsi_device *sd)
* Scsi_Device pointer, or NULL on failure.
**/
static
struct
scsi_device
*
scsi_alloc_sdev
(
struct
Scsi_Host
*
shost
,
uint
channel
,
uint
id
,
uint
lun
)
struct
request_queue
**
q
,
uint
channel
,
uint
id
,
uint
lun
)
{
struct
scsi_device
*
sdev
,
*
device
;
sdev
=
kmalloc
(
sizeof
(
*
sdev
),
GFP_ATOMIC
);
if
(
sdev
==
NULL
)
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
else
{
if
(
sdev
!=
NULL
)
{
memset
(
sdev
,
0
,
sizeof
(
Scsi_Device
));
sdev
->
vendor
=
scsi_null_device_strs
;
sdev
->
model
=
scsi_null_device_strs
;
...
...
@@ -436,18 +434,32 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
* doesn't
*/
sdev
->
borken
=
1
;
if
(
shost
->
hostt
->
slave_alloc
)
if
(
shost
->
hostt
->
slave_alloc
(
sdev
))
{
kfree
(
sdev
);
return
NULL
;
}
scsi_initialize_queue
(
sdev
,
shost
);
sdev
->
request_queue
.
queuedata
=
(
void
*
)
sdev
;
scsi_initialize_merge_fn
(
sdev
);
if
(
!
q
||
*
q
==
NULL
)
{
sdev
->
request_queue
=
kmalloc
(
sizeof
(
struct
request_queue
),
GFP_ATOMIC
);
if
(
sdev
->
request_queue
==
NULL
)
{
goto
out_bail
;
}
memset
(
sdev
->
request_queue
,
0
,
sizeof
(
struct
request_queue
));
scsi_initialize_queue
(
sdev
,
shost
);
scsi_initialize_merge_fn
(
sdev
);
}
else
{
sdev
->
request_queue
=
*
q
;
*
q
=
NULL
;
}
sdev
->
request_queue
->
queuedata
=
sdev
;
scsi_adjust_queue_depth
(
sdev
,
0
,
sdev
->
host
->
cmd_per_lun
);
scsi_build_commandblocks
(
sdev
);
if
(
sdev
->
current_queue_depth
==
0
)
{
goto
out_bail
;
}
init_waitqueue_head
(
&
sdev
->
scpnt_wait
);
if
(
shost
->
hostt
->
slave_alloc
)
if
(
shost
->
hostt
->
slave_alloc
(
sdev
))
{
goto
out_bail
;
}
/*
* If there are any same target siblings, add this to the
* sibling list
...
...
@@ -457,15 +469,35 @@ static struct scsi_device *scsi_alloc_sdev(struct Scsi_Host *shost,
device
->
channel
==
sdev
->
channel
)
{
list_add_tail
(
&
sdev
->
same_target_siblings
,
&
device
->
same_target_siblings
);
sdev
->
scsi_level
=
device
->
scsi_level
;
break
;
}
}
/*
* If there wasn't another lun already configured at this
* target, then default this device to SCSI_2 until we
* know better
*/
if
(
!
sdev
->
scsi_level
)
sdev
->
scsi_level
=
SCSI_2
;
/*
* Add it to the end of the shost->my_devices list.
*/
list_add_tail
(
&
sdev
->
siblings
,
&
shost
->
my_devices
);
return
(
sdev
);
}
out_bail:
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
if
(
q
&&
sdev
->
request_queue
)
{
*
q
=
sdev
->
request_queue
;
sdev
->
request_queue
=
NULL
;
}
else
if
(
sdev
->
request_queue
)
{
blk_cleanup_queue
(
sdev
->
request_queue
);
kfree
(
sdev
->
request_queue
);
}
return
(
sdev
);
scsi_release_commandblocks
(
sdev
);
kfree
(
sdev
);
return
NULL
;
}
/**
...
...
@@ -481,7 +513,10 @@ static void scsi_free_sdev(struct scsi_device *sdev)
list_del
(
&
sdev
->
siblings
);
list_del
(
&
sdev
->
same_target_siblings
);
blk_cleanup_queue
(
&
sdev
->
request_queue
);
if
(
sdev
->
request_queue
!=
NULL
)
{
blk_cleanup_queue
(
sdev
->
request_queue
);
kfree
(
sdev
->
request_queue
);
}
scsi_release_commandblocks
(
sdev
);
if
(
sdev
->
host
->
hostt
->
slave_destroy
)
sdev
->
host
->
hostt
->
slave_destroy
(
sdev
);
...
...
@@ -1188,18 +1223,11 @@ static void scsi_probe_lun(Scsi_Request *sreq, char *inq_result,
* SCSI_SCAN_NO_RESPONSE: could not allocate or setup a Scsi_Device
* SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
**/
static
int
scsi_add_lun
(
Scsi_Device
*
sdev
scan
,
Scsi_Device
**
sdevnew
,
Scsi_Request
*
sreq
,
char
*
inq_result
,
int
*
bflags
)
static
int
scsi_add_lun
(
Scsi_Device
*
sdev
,
Scsi_Request
*
sreq
,
char
*
inq_result
,
int
*
bflags
)
{
Scsi_Device
*
sdev
;
char
devname
[
64
];
sdev
=
scsi_alloc_sdev
(
sdevscan
->
host
,
sdevscan
->
channel
,
sdevscan
->
id
,
sdevscan
->
lun
);
if
(
sdev
==
NULL
)
return
SCSI_SCAN_NO_RESPONSE
;
sdev
->
scsi_level
=
sdevscan
->
scsi_level
;
/*
* XXX do not save the inquiry, since it can change underneath us,
* save just vendor/model/rev.
...
...
@@ -1210,10 +1238,8 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
* scanning run at their own risk, or supply a user level program
* that can correctly scan.
*/
sdev
->
inquiry_len
=
sdevscan
->
inquiry_len
;
sdev
->
inquiry
=
kmalloc
(
sdev
->
inquiry_len
,
GFP_ATOMIC
);
if
(
sdev
->
inquiry
==
NULL
)
{
scsi_free_sdev
(
sdev
);
return
SCSI_SCAN_NO_RESPONSE
;
}
...
...
@@ -1335,8 +1361,8 @@ static int scsi_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
* function */
sdev
->
max_device_blocked
=
SCSI_DEFAULT_DEVICE_BLOCKED
;
if
(
sdevnew
!=
NULL
)
*
sdevnew
=
sdev
;
if
(
sdev
->
host
->
hostt
->
slave_configure
)
sdev
->
host
->
hostt
->
slave_configure
(
sdev
)
;
return
SCSI_SCAN_LUN_PRESENT
;
}
...
...
@@ -1365,8 +1391,9 @@ static void scsi_remove_lun(struct scsi_device *sdev)
* attached at the LUN
* SCSI_SCAN_LUN_PRESENT: a new Scsi_Device was allocated and initialized
**/
static
int
scsi_probe_and_add_lun
(
Scsi_Device
*
sdevscan
,
Scsi_Device
**
sdevnew
,
int
*
bflagsp
)
static
int
scsi_probe_and_add_lun
(
struct
Scsi_Host
*
host
,
struct
request_queue
**
q
,
uint
channel
,
uint
id
,
uint
lun
,
int
*
bflagsp
)
{
Scsi_Device
*
sdev
=
NULL
;
Scsi_Request
*
sreq
=
NULL
;
...
...
@@ -1374,47 +1401,27 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
int
bflags
;
int
res
;
/*
* Any command blocks allocated are fixed to use sdevscan->lun,
* so they must be allocated and released if sdevscan->lun
* changes.
*
* XXX optimize and don't call build/release commandblocks, instead
* modify the LUN value of the existing command block - this means
* the build/release calls would be moved to the alloc/free of
* sdevscan, and the modifying function would be called here.
*
* XXX maybe change scsi_release_commandblocks to not reset
* queue_depth to 0.
*/
sdevscan
->
new_queue_depth
=
1
;
scsi_build_commandblocks
(
sdevscan
);
if
(
sdevscan
->
current_queue_depth
==
0
)
goto
alloc_failed
;
/*
* Since we reuse the same sdevscan over and over with different
* target and lun values, we have to destroy and then recreate
* any possible low level attachments since they very will might
* also store the id and lun numbers in some form and need updating
* with each scan.
*/
if
(
sdevscan
->
host
->
hostt
->
slave_destroy
)
sdevscan
->
host
->
hostt
->
slave_destroy
(
sdevscan
);
if
(
sdevscan
->
host
->
hostt
->
slave_alloc
)
sdevscan
->
host
->
hostt
->
slave_alloc
(
sdevscan
);
sreq
=
scsi_allocate_request
(
sdevscan
);
if
(
sreq
==
NULL
)
goto
alloc_failed
;
sdev
=
scsi_alloc_sdev
(
host
,
q
,
channel
,
id
,
lun
);
if
(
sdev
==
NULL
)
return
SCSI_SCAN_NO_RESPONSE
;
sreq
=
scsi_allocate_request
(
sdev
);
if
(
sreq
==
NULL
)
{
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
res
=
SCSI_SCAN_NO_RESPONSE
;
goto
bail_out
;
}
/*
* The sreq is for use only with sdevscan.
*/
scsi_result
=
kmalloc
(
256
,
GFP_ATOMIC
|
(
sdevscan
->
host
->
unchecked_isa_dma
)
?
(
host
->
unchecked_isa_dma
)
?
GFP_DMA
:
0
);
if
(
scsi_result
==
NULL
)
goto
alloc_failed
;
if
(
scsi_result
==
NULL
)
{
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
res
=
SCSI_SCAN_NO_RESPONSE
;
goto
bail_out
;
}
scsi_probe_lun
(
sreq
,
scsi_result
,
&
bflags
);
if
(
sreq
->
sr_result
)
...
...
@@ -1439,10 +1446,8 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
" no device added
\n
"
));
res
=
SCSI_SCAN_TARGET_PRESENT
;
}
else
{
res
=
scsi_add_lun
(
sdevscan
,
&
sdev
,
sreq
,
scsi_result
,
&
bflags
);
res
=
scsi_add_lun
(
sdev
,
sreq
,
scsi_result
,
&
bflags
);
if
(
res
==
SCSI_SCAN_LUN_PRESENT
)
{
BUG_ON
(
sdev
==
NULL
);
if
((
bflags
&
BLIST_KEY
)
!=
0
)
{
sdev
->
lockable
=
0
;
scsi_unlock_floptical
(
sreq
,
...
...
@@ -1452,31 +1457,25 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
* the INQUIRY data.
*/
}
/*
* "hardcoded" scans of a single LUN need
* to know the sdev just allocated.
*/
if
(
sdevnew
!=
NULL
)
*
sdevnew
=
sdev
;
if
(
bflagsp
!=
NULL
)
*
bflagsp
=
bflags
;
}
}
}
kfree
(
scsi_result
);
scsi_release_request
(
sreq
);
scsi_release_commandblocks
(
sdevscan
);
return
res
;
alloc_failed:
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
bail_out:
if
(
scsi_result
!=
NULL
)
kfree
(
scsi_result
);
if
(
sreq
!=
NULL
)
scsi_release_request
(
sreq
);
if
(
sdevscan
->
current_queue_depth
!=
0
)
scsi_release_commandblocks
(
sdevscan
);
return
SCSI_SCAN_NO_RESPONSE
;
if
(
res
!=
SCSI_SCAN_LUN_PRESENT
)
{
if
(
q
)
{
*
q
=
sdev
->
request_queue
;
sdev
->
request_queue
=
NULL
;
}
scsi_free_sdev
(
sdev
);
}
return
res
;
}
/**
...
...
@@ -1492,16 +1491,15 @@ static int scsi_probe_and_add_lun(Scsi_Device *sdevscan, Scsi_Device **sdevnew,
*
* Modifies sdevscan->lun.
**/
static
void
scsi_sequential_lun_scan
(
Scsi_Device
*
sdevscan
,
int
bflags
,
int
lun0_res
)
static
void
scsi_sequential_lun_scan
(
struct
Scsi_Host
*
shost
,
struct
request_queue
**
q
,
uint
channel
,
uint
id
,
int
bflags
,
int
lun0_res
,
int
scsi_level
)
{
struct
Scsi_Host
*
shost
=
sdevscan
->
host
;
unsigned
int
sparse_lun
;
unsigned
int
max_dev_lun
;
unsigned
int
sparse_lun
,
lun
,
max_dev_lun
;
SCSI_LOG_SCAN_BUS
(
3
,
printk
(
KERN_INFO
"scsi scan: Sequential scan of"
" host %d channel %d id %d
\n
"
,
s
devscan
->
host
->
host_no
,
sdevscan
->
channel
,
sdevscan
->
id
));
" host %d channel %d id %d
\n
"
,
shost
->
host_no
,
channel
,
id
));
max_dev_lun
=
min
(
max_scsi_luns
,
shost
->
max_lun
);
/*
...
...
@@ -1526,11 +1524,19 @@ static void scsi_sequential_lun_scan(Scsi_Device *sdevscan, int bflags,
* If less than SCSI_1_CSS, and no special lun scaning, stop
* scanning; this matches 2.4 behaviour, but could just be a bug
* (to continue scanning a SCSI_1_CSS device).
*/
*
* This test is broken. We might not have any device on lun0 for
* a sparselun device, and if that's the case then how would we
* know the real scsi_level, eh? It might make sense to just not
* scan any SCSI_1 device for non-0 luns, but that check would best
* go into scsi_alloc_sdev() and just have it return null when asked
* to alloc an sdev for lun > 0 on an already found SCSI_1 device.
*
if ((sdevscan->scsi_level < SCSI_1_CCS) &&
((bflags & (BLIST_FORCELUN | BLIST_SPARSELUN | BLIST_MAX5LUN))
== 0))
return;
*/
/*
* If this device is known to support multiple units, override
* the other settings, and scan all of them.
...
...
@@ -1546,7 +1552,7 @@ static void scsi_sequential_lun_scan(Scsi_Device *sdevscan, int bflags,
* Do not scan SCSI-2 or lower device past LUN 7, unless
* BLIST_LARGELUN.
*/
if
(
(
sdevscan
->
scsi_level
<
SCSI_3
)
&&
!
(
bflags
&
BLIST_LARGELUN
))
if
(
scsi_level
<
SCSI_3
&&
!
(
bflags
&
BLIST_LARGELUN
))
max_dev_lun
=
min
(
8U
,
max_dev_lun
);
/*
...
...
@@ -1554,8 +1560,8 @@ static void scsi_sequential_lun_scan(Scsi_Device *sdevscan, int bflags,
* until we reach the max, or no LUN is found and we are not
* sparse_lun.
*/
for
(
sdevscan
->
lun
=
1
;
sdevscan
->
lun
<
max_dev_lun
;
++
sdevscan
->
lun
)
if
((
scsi_probe_and_add_lun
(
s
devscan
,
NULL
,
NULL
)
for
(
lun
=
1
;
lun
<
max_dev_lun
;
++
lun
)
if
((
scsi_probe_and_add_lun
(
s
host
,
q
,
channel
,
id
,
lun
,
NULL
)
!=
SCSI_SCAN_LUN_PRESENT
)
&&
!
sparse_lun
)
return
;
}
...
...
@@ -1608,7 +1614,8 @@ static int scsilun_to_int(ScsiLun *scsilun)
* 0: scan completed (or no memory, so further scanning is futile)
* 1: no report lun scan, or not configured
**/
static
int
scsi_report_lun_scan
(
Scsi_Device
*
sdevscan
)
static
int
scsi_report_lun_scan
(
Scsi_Device
*
sdev
,
struct
request_queue
**
q
,
int
bflags
)
{
#ifdef CONFIG_SCSI_REPORT_LUNS
...
...
@@ -1625,38 +1632,19 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
/*
* Only support SCSI-3 and up devices.
*/
if
(
sdev
scan
->
scsi_level
<
SCSI_3
)
if
(
sdev
->
scsi_level
<
SCSI_3
)
return
1
;
if
(
bflags
&
BLIST_NOLUN
)
return
0
;
sdevscan
->
new_queue_depth
=
1
;
scsi_build_commandblocks
(
sdevscan
);
if
(
sdevscan
->
current_queue_depth
==
0
)
{
sreq
=
scsi_allocate_request
(
sdev
);
if
(
sreq
==
NULL
)
{
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
/*
* We are out of memory, don't try scanning any further.
*/
return
0
;
}
/*
* Since we reuse the same sdevscan over and over with different
* target and lun values, we have to destroy and then recreate
* any possible low level attachments since they very will might
* also store the id and lun numbers in some form and need updating
* with each scan.
*
* This is normally handled in probe_and_add_lun, but since this
* one particular function wants to scan lun 0 on each device
* itself and will possibly pick up a resed sdevscan when doing
* so, it also needs this hack.
*/
if
(
sdevscan
->
host
->
hostt
->
slave_destroy
)
sdevscan
->
host
->
hostt
->
slave_destroy
(
sdevscan
);
if
(
sdevscan
->
host
->
hostt
->
slave_alloc
)
sdevscan
->
host
->
hostt
->
slave_alloc
(
sdevscan
);
sreq
=
scsi_allocate_request
(
sdevscan
);
sprintf
(
devname
,
"host %d channel %d id %d"
,
sdevscan
->
host
->
host_no
,
sdevscan
->
channel
,
sdevscan
->
id
);
sprintf
(
devname
,
"host %d channel %d id %d"
,
sdev
->
host
->
host_no
,
sdev
->
channel
,
sdev
->
id
);
/*
* Allocate enough to hold the header (the same size as one ScsiLun)
* plus the max number of luns we are requesting.
...
...
@@ -1669,11 +1657,11 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
*/
length
=
(
max_scsi_report_luns
+
1
)
*
sizeof
(
ScsiLun
);
lun_data
=
(
ScsiLun
*
)
kmalloc
(
length
,
GFP_ATOMIC
|
(
sdev
scan
->
host
->
unchecked_isa_dma
?
(
sdev
->
host
->
unchecked_isa_dma
?
GFP_DMA
:
0
));
if
(
lun_data
==
NULL
)
{
printk
(
ALLOC_FAILURE_MSG
,
__FUNCTION__
);
scsi_release_
commandblocks
(
sdevscan
);
scsi_release_
request
(
sreq
);
/*
* We are out of memory, don't try scanning any further.
*/
...
...
@@ -1723,7 +1711,6 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
||
sreq
->
sr_sense_buffer
[
2
]
!=
UNIT_ATTENTION
)
break
;
}
scsi_release_commandblocks
(
sdevscan
);
if
(
sreq
->
sr_result
)
{
/*
...
...
@@ -1751,8 +1738,8 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
num_luns
=
(
length
/
sizeof
(
ScsiLun
));
SCSI_LOG_SCAN_BUS
(
3
,
printk
(
KERN_INFO
"scsi scan: REPORT LUN scan of"
" host %d channel %d id %d
\n
"
,
sdev
scan
->
host
->
host_no
,
sdev
scan
->
channel
,
sdevscan
->
id
));
" host %d channel %d id %d
\n
"
,
sdev
->
host
->
host_no
,
sdev
->
channel
,
sdev
->
id
));
/*
* Scan the luns in lun_data. The entry at offset 0 is really
* the header, so start at 1 and go up to and including num_luns.
...
...
@@ -1782,22 +1769,22 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
/*
* LUN 0 has already been scanned.
*/
}
else
if
(
lun
>
sdev
scan
->
host
->
max_lun
)
{
}
else
if
(
lun
>
sdev
->
host
->
max_lun
)
{
printk
(
KERN_WARNING
"scsi: %s lun%d has a LUN larger"
" than allowed by the host adapter
\n
"
,
devname
,
lun
);
}
else
{
int
res
;
sdevscan
->
lun
=
lun
;
res
=
scsi_probe_and_add_lun
(
sdevscan
,
NULL
,
NULL
);
res
=
scsi_probe_and_add_lun
(
sdev
->
host
,
q
,
sdev
->
channel
,
sdev
->
id
,
lun
,
NULL
);
if
(
res
==
SCSI_SCAN_NO_RESPONSE
)
{
/*
* Got some results, but now none, abort.
*/
printk
(
KERN_ERR
"scsi: Unexpected response"
" from %s lun %d while scanning, scan"
" aborted
\n
"
,
devname
,
sdevscan
->
lun
);
" aborted
\n
"
,
devname
,
lun
);
break
;
}
}
...
...
@@ -1814,38 +1801,22 @@ static int scsi_report_lun_scan(Scsi_Device *sdevscan)
int
scsi_add_single_device
(
uint
host
,
uint
channel
,
uint
id
,
uint
lun
)
{
struct
scsi_device
*
sdevscan
,
*
sdev
;
struct
Scsi_Host
*
shost
;
int
error
=
-
ENODEV
;
struct
scsi_device
*
sdev
;
shost
=
scsi_host_hn_get
(
host
);
if
(
!
shost
)
return
-
ENODEV
;
sdev
=
scsi_find_device
(
shost
,
channel
,
id
,
lun
);
if
(
sdev
)
goto
out
;
error
=
-
ENOMEM
;
sdevscan
=
scsi_alloc_sdev
(
shost
,
channel
,
id
,
lun
);
if
(
!
sdevscan
)
if
(
scsi_find_device
(
shost
,
channel
,
id
,
lun
)
!=
NULL
)
goto
out
;
if
(
!
list_empty
(
&
sdevscan
->
same_target_siblings
))
{
sdev
=
list_entry
(
&
sdevscan
->
same_target_siblings
,
Scsi_Device
,
same_target_siblings
);
sdevscan
->
scsi_level
=
sdev
->
scsi_level
;
sdev
=
NULL
;
}
else
sdevscan
->
scsi_level
=
SCSI_2
;
error
=
scsi_probe_and_add_lun
(
sdevscan
,
&
sdev
,
NULL
);
scsi_free_sdev
(
sdevscan
);
if
(
error
!=
SCSI_SCAN_LUN_PRESENT
)
goto
out
;
scsi_attach_device
(
sdev
);
error
=
0
;
if
(
scsi_probe_and_add_lun
(
shost
,
NULL
,
channel
,
id
,
lun
,
NULL
)
==
SCSI_SCAN_LUN_PRESENT
)
{
error
=
0
;
sdev
=
scsi_find_device
(
shost
,
channel
,
id
,
lun
);
scsi_attach_device
(
sdev
);
}
out:
scsi_host_put
(
shost
);
return
error
;
...
...
@@ -1898,11 +1869,12 @@ int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
* First try a REPORT LUN scan, if that does not scan the target, do a
* sequential scan of LUNs on the target id.
**/
static
void
scsi_scan_target
(
Scsi_Device
*
sdevscan
,
struct
Scsi_Host
*
shost
,
static
void
scsi_scan_target
(
struct
Scsi_Host
*
shost
,
struct
request_queue
**
q
,
unsigned
int
channel
,
unsigned
int
id
)
{
int
bflags
;
int
bflags
=
0
;
int
res
;
struct
scsi_device
*
sdev
;
if
(
shost
->
this_id
==
id
)
/*
...
...
@@ -1910,36 +1882,29 @@ static void scsi_scan_target(Scsi_Device *sdevscan, struct Scsi_Host *shost,
*/
return
;
sdevscan
->
host
=
shost
;
sdevscan
->
id
=
id
;
sdevscan
->
channel
=
channel
;
/*
* Scan LUN 0, if there is some response, scan further. Ideally, we
* would not configure LUN 0 until all LUNs are scanned.
*
* The scsi_level is set (in scsi_probe_lun) if a target responds.
*/
sdevscan
->
lun
=
0
;
res
=
scsi_probe_and_add_lun
(
sdevscan
,
NULL
,
&
bflags
);
if
(
res
!=
SCSI_SCAN_NO_RESPONSE
)
{
/*
* Some scsi devices cannot properly handle a lun != 0.
* BLIST_NOLUN also prevents a REPORT LUN from being sent.
* Any multi-lun SCSI-3 device that hangs because of a
* REPORT LUN command is seriously broken.
*/
if
(
!
(
bflags
&
BLIST_NOLUN
))
res
=
scsi_probe_and_add_lun
(
shost
,
q
,
channel
,
id
,
0
,
&
bflags
);
if
(
res
==
SCSI_SCAN_LUN_PRESENT
)
{
sdev
=
scsi_find_device
(
shost
,
channel
,
id
,
0
);
if
(
scsi_report_lun_scan
(
sdev
,
q
,
bflags
)
!=
0
)
/*
* Ending the scan here if max_scsi_luns == 1
* breaks scanning of SPARSE, FORCE, MAX5 LUN
* devices, and the report lun scan.
* The REPORT LUN did not scan the target,
* do a sequential scan.
*/
if
(
scsi_report_lun_scan
(
sdevscan
)
!=
0
)
/*
* The REPORT LUN did not scan the target,
* do a sequential scan.
*/
scsi_sequential_lun_scan
(
sdevscan
,
bflags
,
res
);
scsi_sequential_lun_scan
(
shost
,
q
,
channel
,
id
,
bflags
,
res
,
sdev
->
scsi_level
);
}
else
if
(
res
==
SCSI_SCAN_TARGET_PRESENT
)
{
/*
* There's a target here, but lun 0 is offline so we
* can't use the report_lun scan. Fall back to a
* sequential lun scan with a bflags of SPARSELUN and
* a default scsi level of SCSI_2
*/
scsi_sequential_lun_scan
(
shost
,
q
,
channel
,
id
,
BLIST_SPARSELUN
,
SCSI_SCAN_TARGET_PRESENT
,
SCSI_2
);
}
}
...
...
@@ -1953,22 +1918,9 @@ static void scsi_scan_target(Scsi_Device *sdevscan, struct Scsi_Host *shost,
**/
void
scsi_scan_host
(
struct
Scsi_Host
*
shost
)
{
struct
scsi_device
*
sdevscan
;
struct
request_queue
*
q
=
NULL
;
uint
channel
,
id
,
order_id
;
/*
* The blk layer queue allocation is a bit expensive to
* repeat for each channel and id - for FCP max_id is near
* 255: each call to scsi_alloc_sdev() implies a call to
* blk_init_queue, and then blk_init_free_list, where 2 *
* queue_nr_requests requests are allocated. Don't do so
* here for scsi_scan_selected_lun, since we end up
* calling select_queue_depths with an extra Scsi_Device
* on the host_queue list.
*/
sdevscan
=
scsi_alloc_sdev
(
shost
,
0
,
0
,
0
);
if
(
sdevscan
==
NULL
)
return
;
/*
* The sdevscan host, channel, id and lun are filled in as
* needed to scan.
...
...
@@ -1991,11 +1943,13 @@ void scsi_scan_host(struct Scsi_Host *shost)
order_id
=
shost
->
max_id
-
id
-
1
;
else
order_id
=
id
;
scsi_scan_target
(
sdevscan
,
shost
,
channel
,
order_id
);
scsi_scan_target
(
shost
,
&
q
,
channel
,
order_id
);
}
}
scsi_free_sdev
(
sdevscan
);
if
(
q
)
{
blk_cleanup_queue
(
q
);
kfree
(
q
);
}
}
void
scsi_forget_host
(
struct
Scsi_Host
*
shost
)
...
...
@@ -2030,19 +1984,11 @@ struct scsi_device *scsi_get_host_dev(struct Scsi_Host *shost)
{
struct
scsi_device
*
sdev
;
sdev
=
scsi_alloc_sdev
(
shost
,
0
,
shost
->
this_id
,
0
);
sdev
=
scsi_alloc_sdev
(
shost
,
NULL
,
0
,
shost
->
this_id
,
0
);
if
(
sdev
)
{
scsi_build_commandblocks
(
sdev
);
if
(
sdev
->
current_queue_depth
==
0
)
goto
fail
;
sdev
->
borken
=
0
;
}
return
sdev
;
fail:
kfree
(
sdev
);
return
NULL
;
}
/*
...
...
drivers/scsi/sd.c
View file @
5d7fa0ad
...
...
@@ -301,10 +301,10 @@ static int sd_init_command(struct scsi_cmnd * SCpnt)
if
(
block
>
0xffffffff
)
{
SCpnt
->
cmnd
[
0
]
+=
READ_16
-
READ_6
;
SCpnt
->
cmnd
[
2
]
=
(
unsigned
char
)
(
block
>>
56
)
&
0xff
;
SCpnt
->
cmnd
[
3
]
=
(
unsigned
char
)
(
block
>>
48
)
&
0xff
;
SCpnt
->
cmnd
[
4
]
=
(
unsigned
char
)
(
block
>>
40
)
&
0xff
;
SCpnt
->
cmnd
[
5
]
=
(
unsigned
char
)
(
block
>>
32
)
&
0xff
;
SCpnt
->
cmnd
[
2
]
=
sizeof
(
block
)
>
4
?
(
unsigned
char
)
(
block
>>
56
)
&
0xff
:
0
;
SCpnt
->
cmnd
[
3
]
=
sizeof
(
block
)
>
4
?
(
unsigned
char
)
(
block
>>
48
)
&
0xff
:
0
;
SCpnt
->
cmnd
[
4
]
=
sizeof
(
block
)
>
4
?
(
unsigned
char
)
(
block
>>
40
)
&
0xff
:
0
;
SCpnt
->
cmnd
[
5
]
=
sizeof
(
block
)
>
4
?
(
unsigned
char
)
(
block
>>
32
)
&
0xff
:
0
;
SCpnt
->
cmnd
[
6
]
=
(
unsigned
char
)
(
block
>>
24
)
&
0xff
;
SCpnt
->
cmnd
[
7
]
=
(
unsigned
char
)
(
block
>>
16
)
&
0xff
;
SCpnt
->
cmnd
[
8
]
=
(
unsigned
char
)
(
block
>>
8
)
&
0xff
;
...
...
@@ -931,7 +931,7 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
if
(
longrc
)
{
memset
((
void
*
)
cmd
,
0
,
16
);
cmd
[
0
]
=
SERVICE_ACTION_IN
;
cmd
[
1
]
=
0x10
;
/* READ CAPACITY (16) */
cmd
[
1
]
=
SAI_READ_CAPACITY_16
;
cmd
[
13
]
=
12
;
memset
((
void
*
)
buffer
,
0
,
12
);
}
else
{
...
...
@@ -1002,21 +1002,25 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
sector_size
=
(
buffer
[
4
]
<<
24
)
|
(
buffer
[
5
]
<<
16
)
|
(
buffer
[
6
]
<<
8
)
|
buffer
[
7
];
if
(
buffer
[
0
]
==
0xff
&&
buffer
[
1
]
==
0xff
&&
buffer
[
2
]
==
0xff
&&
buffer
[
3
]
==
0xff
)
{
printk
(
KERN_NOTICE
"%s : very big device. try to use"
" READ CAPACITY(16).
\n
"
,
diskname
);
longrc
=
1
;
goto
repeat
;
buffer
[
2
]
==
0xff
&&
buffer
[
3
]
==
0xff
)
{
if
(
sizeof
(
sdkp
->
capacity
)
>
4
)
{
printk
(
KERN_NOTICE
"%s : very big device. try to use"
" READ CAPACITY(16).
\n
"
,
diskname
);
longrc
=
1
;
goto
repeat
;
}
else
{
printk
(
KERN_ERR
"%s: too big for kernel. Assuming maximum 2Tb
\n
"
,
diskname
);
}
}
sdkp
->
capacity
=
1
+
(((
sector_t
)
buffer
[
0
]
<<
24
)
|
(
buffer
[
1
]
<<
16
)
|
(
buffer
[
2
]
<<
8
)
|
buffer
[
3
]);
}
else
{
sdkp
->
capacity
=
1
+
(((
sector_t
)
buffer
[
0
]
<<
56
)
|
((
sector_t
)
buffer
[
1
]
<<
48
)
|
((
sector_t
)
buffer
[
2
]
<<
40
)
|
((
sector_t
)
buffer
[
3
]
<<
32
)
|
sdkp
->
capacity
=
1
+
(((
u64
)
buffer
[
0
]
<<
56
)
|
((
u64
)
buffer
[
1
]
<<
48
)
|
((
u64
)
buffer
[
2
]
<<
40
)
|
((
u64
)
buffer
[
3
]
<<
32
)
|
((
sector_t
)
buffer
[
4
]
<<
24
)
|
((
sector_t
)
buffer
[
5
]
<<
16
)
|
((
sector_t
)
buffer
[
6
]
<<
8
)
|
...
...
@@ -1056,7 +1060,7 @@ sd_read_capacity(struct scsi_disk *sdkp, char *diskname,
*/
int
hard_sector
=
sector_size
;
sector_t
sz
=
sdkp
->
capacity
*
(
hard_sector
/
256
);
request_queue_t
*
queue
=
&
sdp
->
request_queue
;
request_queue_t
*
queue
=
sdp
->
request_queue
;
sector_t
mb
;
blk_queue_hardsect_size
(
queue
,
hard_sector
);
...
...
@@ -1291,7 +1295,7 @@ static int sd_attach(struct scsi_device * sdp)
if
(
sdp
->
removable
)
gd
->
flags
|=
GENHD_FL_REMOVABLE
;
gd
->
private_data
=
&
sdkp
->
driver
;
gd
->
queue
=
&
sdkp
->
device
->
request_queue
;
gd
->
queue
=
sdkp
->
device
->
request_queue
;
sd_devlist_insert
(
sdkp
);
set_capacity
(
gd
,
sdkp
->
capacity
);
...
...
drivers/scsi/sg.c
View file @
5d7fa0ad
...
...
@@ -695,7 +695,7 @@ sg_common_write(Sg_fd * sfp, Sg_request * srp,
}
srp
->
my_cmdp
=
SRpnt
;
q
=
&
SRpnt
->
sr_device
->
request_queue
;
q
=
SRpnt
->
sr_device
->
request_queue
;
SRpnt
->
sr_request
->
rq_disk
=
sdp
->
disk
;
SRpnt
->
sr_sense_buffer
[
0
]
=
0
;
SRpnt
->
sr_cmd_len
=
hp
->
cmd_len
;
...
...
drivers/scsi/sr.c
View file @
5d7fa0ad
...
...
@@ -563,7 +563,7 @@ static int sr_attach(struct scsi_device *sdev)
register_cdrom
(
&
cd
->
cdi
);
set_capacity
(
disk
,
cd
->
capacity
);
disk
->
private_data
=
&
cd
->
driver
;
disk
->
queue
=
&
sdev
->
request_queue
;
disk
->
queue
=
sdev
->
request_queue
;
add_disk
(
disk
);
sr_devlist_insert
(
cd
);
...
...
@@ -672,7 +672,7 @@ static void get_sectorsize(struct scsi_cd *cd)
set_capacity
(
cd
->
disk
,
cd
->
capacity
);
}
queue
=
&
cd
->
device
->
request_queue
;
queue
=
cd
->
device
->
request_queue
;
blk_queue_hardsect_size
(
queue
,
sector_size
);
out:
kfree
(
buffer
);
...
...
include/scsi/scsi.h
View file @
5d7fa0ad
...
...
@@ -99,6 +99,8 @@ extern const unsigned char scsi_command_size[8];
#define READ_16 0x88
#define WRITE_16 0x8a
#define SERVICE_ACTION_IN 0x9e
/* values for service action in */
#define SAI_READ_CAPACITY_16 0x10
/*
...
...
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