Commit 5d7fa0ad authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/davem/sparc-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents dff076a0 6ecabc8f
......@@ -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
......
......@@ -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
......
......@@ -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,
......
......@@ -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,
......
......@@ -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,
......
......@@ -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);
......
......@@ -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();
......
#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);
......@@ -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);
......
......@@ -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_intel_i460_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_84460GX,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
},
{ }
};
MODULE_DEVICE_TABLE(pci, agp_i460_pci_table);
MODULE_DEVICE_TABLE(pci, agp_intel_i460_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_intel_i460_pci_table,
.probe = agp_intel_i460_probe,
};
static int __init agp_i460_init(void)
static int __init agp_intel_i460_init(void)
{
int ret_val;
ret_val = pci_module_init(&agp_i460_pci_driver);
ret_val = pci_module_init(&agp_intel_i460_pci_driver);
if (ret_val)
agp_bridge.type = NOT_SUPPORTED;
return ret_val;
}
static void __exit agp_i460_cleanup(void)
static void __exit agp_intel_i460_cleanup(void)
{
agp_unregister_driver();
pci_unregister_driver(&agp_i460_pci_driver);
pci_unregister_driver(&agp_intel_i460_pci_driver);
}
module_init(agp_i460_init);
module_exit(agp_i460_cleanup);
module_init(agp_intel_i460_init);
module_exit(agp_intel_i460_cleanup);
MODULE_AUTHOR("Chris Ahna <Christopher.J.Ahna@intel.com>");
MODULE_LICENSE("GPL and additional rights");
......@@ -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,
......
This diff is collapsed.
......@@ -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;
......
......@@ -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 != 0x00) {
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 != 0x00));
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,
......
......@@ -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,
......
......@@ -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)
......
......@@ -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 */\
......
......@@ -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
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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);
}
/*
......
This diff is collapsed.
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment