Commit 324b683a authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://kernel.bkbits.net/lord/xfs-2.6

into home.osdl.org:/home/torvalds/v2.5/linux
parents 1ac6fcb7 5fc0a431
...@@ -82,9 +82,12 @@ do { \ ...@@ -82,9 +82,12 @@ do { \
int i; \ int i; \
Elf32_Off ofs = 0; \ Elf32_Off ofs = 0; \
for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \ for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \
struct elf_phdr phdr = vsyscall_phdrs[i]; \ struct elf32_phdr phdr = vsyscall_phdrs[i]; \
if (phdr.p_type == PT_LOAD) { \ if (phdr.p_type == PT_LOAD) { \
BUG_ON(ofs != 0); \
ofs = phdr.p_offset = offset; \ ofs = phdr.p_offset = offset; \
phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
phdr.p_filesz = phdr.p_memsz; \
offset += phdr.p_filesz; \ offset += phdr.p_filesz; \
} \ } \
else \ else \
...@@ -99,10 +102,10 @@ do { \ ...@@ -99,10 +102,10 @@ do { \
(const struct elf32_phdr *) (VSYSCALL32_BASE \ (const struct elf32_phdr *) (VSYSCALL32_BASE \
+ VSYSCALL32_EHDR->e_phoff); \ + VSYSCALL32_EHDR->e_phoff); \
int i; \ int i; \
for (i = 0; i < VSYSCALL32_EHDR->e_phnum; ++i) { \ for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \
if (vsyscall_phdrs[i].p_type == PT_LOAD) \ if (vsyscall_phdrs[i].p_type == PT_LOAD) \
DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr, \ DUMP_WRITE((void *) (u64) vsyscall_phdrs[i].p_vaddr, \
vsyscall_phdrs[i].p_filesz); \ PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
} \ } \
} while (0) } while (0)
......
...@@ -1800,7 +1800,6 @@ static int __init match_parm (char *s, const char *keywords[], int vals[], int m ...@@ -1800,7 +1800,6 @@ static int __init match_parm (char *s, const char *keywords[], int vals[], int m
#ifdef CONFIG_BLK_DEV_PDC4030 #ifdef CONFIG_BLK_DEV_PDC4030
static int __initdata probe_pdc4030; static int __initdata probe_pdc4030;
extern void init_pdc4030(void);
#endif #endif
#ifdef CONFIG_BLK_DEV_ALI14XX #ifdef CONFIG_BLK_DEV_ALI14XX
static int __initdata probe_ali14xx; static int __initdata probe_ali14xx;
...@@ -2238,8 +2237,9 @@ static void __init probe_for_hwifs (void) ...@@ -2238,8 +2237,9 @@ static void __init probe_for_hwifs (void)
#endif /* CONFIG_BLK_DEV_CMD640 */ #endif /* CONFIG_BLK_DEV_CMD640 */
#ifdef CONFIG_BLK_DEV_PDC4030 #ifdef CONFIG_BLK_DEV_PDC4030
{ {
extern int ide_probe_for_pdc4030(void); extern int pdc4030_init(void);
(void) ide_probe_for_pdc4030(); if (probe_pdc4030)
(void)pdc4030_init();
} }
#endif /* CONFIG_BLK_DEV_PDC4030 */ #endif /* CONFIG_BLK_DEV_PDC4030 */
#ifdef CONFIG_BLK_DEV_IDE_PMAC #ifdef CONFIG_BLK_DEV_IDE_PMAC
...@@ -2595,10 +2595,6 @@ int __init ide_init (void) ...@@ -2595,10 +2595,6 @@ int __init ide_init (void)
init_ide_data(); init_ide_data();
#ifdef CONFIG_BLK_DEV_PDC4030
if (probe_pdc4030)
init_pdc4030();
#endif
#ifdef CONFIG_BLK_DEV_ALI14XX #ifdef CONFIG_BLK_DEV_ALI14XX
if (probe_ali14xx) if (probe_ali14xx)
(void)ali14xx_init(); (void)ali14xx_init();
......
...@@ -147,8 +147,6 @@ int pdc4030_identify(ide_drive_t *drive) ...@@ -147,8 +147,6 @@ int pdc4030_identify(ide_drive_t *drive)
return pdc4030_cmd(drive, PROMISE_IDENTIFY); return pdc4030_cmd(drive, PROMISE_IDENTIFY);
} }
int enable_promise_support;
/* /*
* setup_pdc4030() * setup_pdc4030()
* Completes the setup of a Promise DC4030 controller card, once found. * Completes the setup of a Promise DC4030 controller card, once found.
...@@ -296,27 +294,24 @@ int __init detect_pdc4030(ide_hwif_t *hwif) ...@@ -296,27 +294,24 @@ int __init detect_pdc4030(ide_hwif_t *hwif)
} }
} }
int __init pdc4030_init(void)
int __init ide_probe_for_pdc4030(void)
{ {
unsigned int index; unsigned int index;
ide_hwif_t *hwif; ide_hwif_t *hwif;
#ifndef MODULE
if (enable_promise_support == 0)
return 0;
#endif
for (index = 0; index < MAX_HWIFS; index++) { for (index = 0; index < MAX_HWIFS; index++) {
hwif = &ide_hwifs[index]; hwif = &ide_hwifs[index];
if (hwif->chipset == ide_unknown && detect_pdc4030(hwif)) if (hwif->chipset == ide_unknown && detect_pdc4030(hwif)) {
return setup_pdc4030(hwif); if (!setup_pdc4030(hwif))
} return -ENODEV;
return 0; return 0;
}
}
return -ENODEV;
} }
static void __exit release_pdc4030(ide_hwif_t *hwif, ide_hwif_t *mate) #ifdef MODULE
static void __exit pdc4030_release_hwif(ide_hwif_t *hwif)
{ {
hwif->chipset = ide_unknown; hwif->chipset = ide_unknown;
hwif->selectproc = NULL; hwif->selectproc = NULL;
...@@ -327,72 +322,24 @@ static void __exit release_pdc4030(ide_hwif_t *hwif, ide_hwif_t *mate) ...@@ -327,72 +322,24 @@ static void __exit release_pdc4030(ide_hwif_t *hwif, ide_hwif_t *mate)
hwif->drives[1].keep_settings = 0; hwif->drives[1].keep_settings = 0;
hwif->drives[0].noprobe = 0; hwif->drives[0].noprobe = 0;
hwif->drives[1].noprobe = 0; hwif->drives[1].noprobe = 0;
if (mate != NULL) {
mate->chipset = ide_unknown;
mate->selectproc = NULL;
mate->serialized = 0;
mate->drives[0].io_32bit = 0;
mate->drives[1].io_32bit = 0;
mate->drives[0].keep_settings = 0;
mate->drives[1].keep_settings = 0;
mate->drives[0].noprobe = 0;
mate->drives[1].noprobe = 0;
}
} }
#ifndef MODULE static void __exit pdc4030_exit(void)
/*
* init_pdc4030:
*
* called by ide.c when parsing command line
*/
void __init init_pdc4030(void)
{ {
enable_promise_support = 1; unsigned int index;
for (index = 0; index < MAX_HWIFS; index++)
pdc4030_release_hwif(&ide_hwifs[index]);
} }
#else module_init(pdc4030_init);
module_exit(pdc4030_exit);
#endif
MODULE_AUTHOR("Peter Denison"); MODULE_AUTHOR("Peter Denison");
MODULE_DESCRIPTION("Support of Promise 4030 VLB series IDE chipsets"); MODULE_DESCRIPTION("Support of Promise 4030 VLB series IDE chipsets");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
static int __init pdc4030_mod_init(void)
{
if (enable_promise_support == 0)
enable_promise_support = 1;
if (!ide_probe_for_pdc4030())
return -ENODEV;
return 0;
}
module_init(pdc4030_mod_init);
static void __exit pdc4030_mod_exit(void)
{
unsigned int index;
ide_hwif_t *hwif;
if (enable_promise_support == 0)
return;
for (index = 0; index < MAX_HWIFS; index++) {
hwif = &ide_hwifs[index];
if (hwif->chipset == ide_pdc4030) {
ide_hwif_t *mate = &ide_hwifs[hwif->index+1];
if (mate->chipset == ide_pdc4030)
release_pdc4030(hwif, mate);
else
release_pdc4030(hwif, NULL);
}
}
enable_promise_support = 0;
}
module_exit(pdc4030_mod_exit);
#endif
/* /*
* promise_read_intr() is the handler for disk read/multread interrupts * promise_read_intr() is the handler for disk read/multread interrupts
*/ */
......
/* /*
* Version 2.9 * Version 2.11
* *
* AMD 755/756/766/8111 and nVidia nForce IDE driver for Linux. * AMD 755/756/766/8111 and nVidia nForce IDE driver for Linux.
* *
...@@ -65,7 +65,6 @@ static struct amd_ide_chip { ...@@ -65,7 +65,6 @@ static struct amd_ide_chip {
}; };
static struct amd_ide_chip *amd_config; static struct amd_ide_chip *amd_config;
static unsigned char amd_enabled;
static unsigned int amd_80w; static unsigned int amd_80w;
static unsigned int amd_clock; static unsigned int amd_clock;
...@@ -103,7 +102,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -103,7 +102,7 @@ static int amd74xx_get_info(char *buffer, char **addr, off_t offset, int count)
amd_print("----------AMD BusMastering IDE Configuration----------------"); amd_print("----------AMD BusMastering IDE Configuration----------------");
amd_print("Driver Version: 2.9"); amd_print("Driver Version: 2.11");
amd_print("South Bridge: %s", pci_name(bmide_dev)); amd_print("South Bridge: %s", pci_name(bmide_dev));
pci_read_config_byte(dev, PCI_REVISION_ID, &t); pci_read_config_byte(dev, PCI_REVISION_ID, &t);
...@@ -250,9 +249,6 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed) ...@@ -250,9 +249,6 @@ static int amd_set_drive(ide_drive_t *drive, u8 speed)
static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio) static void amd74xx_tune_drive(ide_drive_t *drive, u8 pio)
{ {
if (!((amd_enabled >> HWIF(drive)->channel) & 1))
return;
if (pio == 255) { if (pio == 255) {
amd_set_drive(drive, ide_find_best_mode(drive, XFER_PIO | XFER_EPIO)); amd_set_drive(drive, ide_find_best_mode(drive, XFER_PIO | XFER_EPIO));
return; return;
...@@ -330,9 +326,6 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char ...@@ -330,9 +326,6 @@ static unsigned int __init init_chipset_amd74xx(struct pci_dev *dev, const char
break; break;
} }
pci_read_config_dword(dev, AMD_IDE_ENABLE, &u);
amd_enabled = ((u & 1) ? 2 : 0) | ((u & 2) ? 1 : 0);
/* /*
* Take care of prefetch & postwrite. * Take care of prefetch & postwrite.
*/ */
...@@ -408,8 +401,8 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -408,8 +401,8 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif)
hwif->mwdma_mask = 0x07; hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07; hwif->swdma_mask = 0x07;
if (!(hwif->udma_four)) if (!hwif->udma_four)
hwif->udma_four = ((amd_enabled & amd_80w) >> hwif->channel) & 1; hwif->udma_four = (amd_80w >> hwif->channel) & 1;
hwif->ide_dma_check = &amd74xx_ide_dma_check; hwif->ide_dma_check = &amd74xx_ide_dma_check;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
...@@ -417,16 +410,6 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif) ...@@ -417,16 +410,6 @@ static void __init init_hwif_amd74xx(ide_hwif_t *hwif)
hwif->drives[1].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma;
} }
/*
* We allow the BM-DMA driver only work on enabled interfaces.
*/
static void __init init_dma_amd74xx(ide_hwif_t *hwif, unsigned long dmabase)
{
if ((amd_enabled >> hwif->channel) & 1)
ide_setup_dma(hwif, dmabase, 8);
}
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit amd74xx_probe(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t amd74xx_procs[] __initdata = { ...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t amd74xx_procs[] __initdata = {
static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *); static unsigned int init_chipset_amd74xx(struct pci_dev *, const char *);
static void init_hwif_amd74xx(ide_hwif_t *); static void init_hwif_amd74xx(ide_hwif_t *);
static void init_dma_amd74xx(ide_hwif_t *, unsigned long);
static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
...@@ -35,9 +34,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -35,9 +34,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_COBRA_7401, .device = PCI_DEVICE_ID_AMD_COBRA_7401,
.name = "AMD7401", .name = "AMD7401",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -48,9 +45,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -48,9 +45,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_VIPER_7409, .device = PCI_DEVICE_ID_AMD_VIPER_7409,
.name = "AMD7409", .name = "AMD7409",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -61,9 +56,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -61,9 +56,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_VIPER_7411, .device = PCI_DEVICE_ID_AMD_VIPER_7411,
.name = "AMD7411", .name = "AMD7411",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -74,9 +67,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -74,9 +67,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_OPUS_7441, .device = PCI_DEVICE_ID_AMD_OPUS_7441,
.name = "AMD7441", .name = "AMD7441",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -87,9 +78,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -87,9 +78,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_AMD_8111_IDE, .device = PCI_DEVICE_ID_AMD_8111_IDE,
.name = "AMD8111", .name = "AMD8111",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.autodma = AUTODMA, .autodma = AUTODMA,
.channels = 2, .channels = 2,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -101,9 +90,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -101,9 +90,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE, .device = PCI_DEVICE_ID_NVIDIA_NFORCE_IDE,
.name = "NFORCE", .name = "NFORCE",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
...@@ -115,9 +102,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = { ...@@ -115,9 +102,7 @@ static ide_pci_device_t amd74xx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE, .device = PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE,
.name = "NFORCE2", .name = "NFORCE2",
.init_chipset = init_chipset_amd74xx, .init_chipset = init_chipset_amd74xx,
.init_iops = NULL,
.init_hwif = init_hwif_amd74xx, .init_hwif = init_hwif_amd74xx,
.init_dma = init_dma_amd74xx,
.channels = 2, .channels = 2,
.autodma = AUTODMA, .autodma = AUTODMA,
.enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}}, .enablebits = {{0x50,0x02,0x02}, {0x50,0x01,0x01}},
......
/* /*
* *
* Version 3.37 * Version 3.38
* *
* VIA IDE driver for Linux. Supported southbridges: * VIA IDE driver for Linux. Supported southbridges:
* *
...@@ -96,7 +96,6 @@ static struct via_isa_bridge { ...@@ -96,7 +96,6 @@ static struct via_isa_bridge {
}; };
static struct via_isa_bridge *via_config; static struct via_isa_bridge *via_config;
static unsigned char via_enabled;
static unsigned int via_80w; static unsigned int via_80w;
static unsigned int via_clock; static unsigned int via_clock;
static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" }; static char *via_dma[] = { "MWDMA16", "UDMA33", "UDMA66", "UDMA100", "UDMA133" };
...@@ -146,7 +145,7 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count) ...@@ -146,7 +145,7 @@ static int via_get_info(char *buffer, char **addr, off_t offset, int count)
via_print("----------VIA BusMastering IDE Configuration" via_print("----------VIA BusMastering IDE Configuration"
"----------------"); "----------------");
via_print("Driver Version: 3.37"); via_print("Driver Version: 3.38");
via_print("South Bridge: VIA %s", via_print("South Bridge: VIA %s",
via_config->name); via_config->name);
...@@ -370,9 +369,6 @@ static int via_set_drive(ide_drive_t *drive, u8 speed) ...@@ -370,9 +369,6 @@ static int via_set_drive(ide_drive_t *drive, u8 speed)
static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio) static void via82cxxx_tune_drive(ide_drive_t *drive, u8 pio)
{ {
if (!((via_enabled >> HWIF(drive)->channel) & 1))
return;
if (pio == 255) { if (pio == 255) {
via_set_drive(drive, via_set_drive(drive,
ide_find_best_mode(drive, XFER_PIO | XFER_EPIO)); ide_find_best_mode(drive, XFER_PIO | XFER_EPIO));
...@@ -506,7 +502,6 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha ...@@ -506,7 +502,6 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
*/ */
pci_read_config_byte(dev, VIA_IDE_ENABLE, &v); pci_read_config_byte(dev, VIA_IDE_ENABLE, &v);
via_enabled = ((v & 1) ? 2 : 0) | ((v & 2) ? 1 : 0);
/* /*
* Set up FIFO sizes and thresholds. * Set up FIFO sizes and thresholds.
...@@ -523,9 +518,9 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha ...@@ -523,9 +518,9 @@ static unsigned int __init init_chipset_via82cxxx(struct pci_dev *dev, const cha
/* Fix FIFO split between channels */ /* Fix FIFO split between channels */
if (via_config->flags & VIA_SET_FIFO) { if (via_config->flags & VIA_SET_FIFO) {
t &= (t & 0x9f); t &= (t & 0x9f);
switch (via_enabled) { switch (v & 3) {
case 1: t |= 0x00; break; /* 16 on primary */ case 2: t |= 0x00; break; /* 16 on primary */
case 2: t |= 0x60; break; /* 16 on secondary */ case 1: t |= 0x60; break; /* 16 on secondary */
case 3: t |= 0x20; break; /* 8 pri 8 sec */ case 3: t |= 0x20; break; /* 8 pri 8 sec */
} }
} }
...@@ -603,8 +598,8 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) ...@@ -603,8 +598,8 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)
hwif->mwdma_mask = 0x07; hwif->mwdma_mask = 0x07;
hwif->swdma_mask = 0x07; hwif->swdma_mask = 0x07;
if (!(hwif->udma_four)) if (!hwif->udma_four)
hwif->udma_four = ((via_enabled & via_80w) >> hwif->channel) & 1; hwif->udma_four = (via_80w >> hwif->channel) & 1;
hwif->ide_dma_check = &via82cxxx_ide_dma_check; hwif->ide_dma_check = &via82cxxx_ide_dma_check;
if (!noautodma) if (!noautodma)
hwif->autodma = 1; hwif->autodma = 1;
...@@ -612,20 +607,6 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif) ...@@ -612,20 +607,6 @@ static void __init init_hwif_via82cxxx(ide_hwif_t *hwif)
hwif->drives[1].autodma = hwif->autodma; hwif->drives[1].autodma = hwif->autodma;
} }
/**
* init_dma_via82cxxx - set up for IDE DMA
* @hwif: IDE interface
* @dmabase: DMA base address
*
* We allow the BM-DMA driver to only work on enabled interfaces.
*/
static void __init init_dma_via82cxxx(ide_hwif_t *hwif, unsigned long dmabase)
{
if ((via_enabled >> hwif->channel) & 1)
ide_setup_dma(hwif, dmabase, 8);
}
extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *); extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id) static int __devinit via_init_one(struct pci_dev *dev, const struct pci_device_id *id)
......
...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t via_procs[] __initdata = { ...@@ -27,7 +27,6 @@ static ide_pci_host_proc_t via_procs[] __initdata = {
static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *); static unsigned int init_chipset_via82cxxx(struct pci_dev *, const char *);
static void init_hwif_via82cxxx(ide_hwif_t *); static void init_hwif_via82cxxx(ide_hwif_t *);
static void init_dma_via82cxxx(ide_hwif_t *, unsigned long);
static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
{ /* 0 */ { /* 0 */
...@@ -35,9 +34,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { ...@@ -35,9 +34,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_VIA_82C576_1, .device = PCI_DEVICE_ID_VIA_82C576_1,
.name = "VP_IDE", .name = "VP_IDE",
.init_chipset = init_chipset_via82cxxx, .init_chipset = init_chipset_via82cxxx,
.init_iops = NULL,
.init_hwif = init_hwif_via82cxxx, .init_hwif = init_hwif_via82cxxx,
.init_dma = init_dma_via82cxxx,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
...@@ -48,9 +45,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = { ...@@ -48,9 +45,7 @@ static ide_pci_device_t via82cxxx_chipsets[] __devinitdata = {
.device = PCI_DEVICE_ID_VIA_82C586_1, .device = PCI_DEVICE_ID_VIA_82C586_1,
.name = "VP_IDE", .name = "VP_IDE",
.init_chipset = init_chipset_via82cxxx, .init_chipset = init_chipset_via82cxxx,
.init_iops = NULL,
.init_hwif = init_hwif_via82cxxx, .init_hwif = init_hwif_via82cxxx,
.init_dma = init_dma_via82cxxx,
.channels = 2, .channels = 2,
.autodma = NOAUTODMA, .autodma = NOAUTODMA,
.enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}}, .enablebits = {{0x40,0x02,0x02}, {0x40,0x01,0x01}},
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/namei.h> #include <linux/namei.h>
#include <linux/usbdevice_fs.h> #include <linux/usbdevice_fs.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/parser.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
static struct super_operations usbfs_ops; static struct super_operations usbfs_ops;
...@@ -62,76 +63,87 @@ static umode_t devmode = S_IWUSR | S_IRUGO; ...@@ -62,76 +63,87 @@ static umode_t devmode = S_IWUSR | S_IRUGO;
static umode_t busmode = S_IXUGO | S_IRUGO; static umode_t busmode = S_IXUGO | S_IRUGO;
static umode_t listmode = S_IRUGO; static umode_t listmode = S_IRUGO;
enum {
Opt_devuid, Opt_devgid, Opt_devmode,
Opt_busuid, Opt_busgid, Opt_busmode,
Opt_listuid, Opt_listgid, Opt_listmode,
Opt_err,
};
static match_table_t tokens = {
{Opt_devuid, "devuid=%u"},
{Opt_devgid, "devgid=%u"},
{Opt_devmode, "devmode=%o"},
{Opt_busuid, "busuid=%u"},
{Opt_busgid, "busgid=%u"},
{Opt_busmode, "busmode=%o"},
{Opt_listuid, "listuid=%u"},
{Opt_listgid, "listgid=%u"},
{Opt_listmode, "listmode=%o"},
{Opt_err, NULL}
};
static int parse_options(struct super_block *s, char *data) static int parse_options(struct super_block *s, char *data)
{ {
char *curopt = NULL, *value; char *p;
int option;
while ((curopt = strsep(&data, ",")) != NULL) { while ((p = strsep(&data, ",")) != NULL) {
if (!*curopt) substring_t args[MAX_OPT_ARGS];
int token;
if (!*p)
continue; continue;
if ((value = strchr(curopt, '=')) != NULL)
*value++ = 0; token = match_token(p, tokens, args);
if (!strcmp(curopt, "devuid")) { switch (token) {
if (!value || !value[0]) case Opt_devuid:
return -EINVAL; if (match_int(&args[0], &option))
devuid = simple_strtoul(value, &value, 0);
if (*value)
return -EINVAL;
}
if (!strcmp(curopt, "devgid")) {
if (!value || !value[0])
return -EINVAL;
devgid = simple_strtoul(value, &value, 0);
if (*value)
return -EINVAL;
}
if (!strcmp(curopt, "devmode")) {
if (!value || !value[0])
return -EINVAL;
devmode = simple_strtoul(value, &value, 0) & S_IRWXUGO;
if (*value)
return -EINVAL;
}
if (!strcmp(curopt, "busuid")) {
if (!value || !value[0])
return -EINVAL;
busuid = simple_strtoul(value, &value, 0);
if (*value)
return -EINVAL;
}
if (!strcmp(curopt, "busgid")) {
if (!value || !value[0])
return -EINVAL; return -EINVAL;
busgid = simple_strtoul(value, &value, 0); devuid = option;
if (*value) break;
case Opt_devgid:
if (match_int(&args[0], &option))
return -EINVAL; return -EINVAL;
} devgid = option;
if (!strcmp(curopt, "busmode")) { break;
if (!value || !value[0]) case Opt_devmode:
if (match_octal(&args[0], &option))
return -EINVAL; return -EINVAL;
busmode = simple_strtoul(value, &value, 0) & S_IRWXUGO; devmode = option & S_IRWXUGO;
if (*value) break;
case Opt_busuid:
if (match_int(&args[0], &option))
return -EINVAL; return -EINVAL;
} busuid = option;
if (!strcmp(curopt, "listuid")) { break;
if (!value || !value[0]) case Opt_busgid:
if (match_int(&args[0], &option))
return -EINVAL; return -EINVAL;
listuid = simple_strtoul(value, &value, 0); busgid = option;
if (*value) break;
case Opt_busmode:
if (match_octal(&args[0], &option))
return -EINVAL; return -EINVAL;
} busmode = option & S_IRWXUGO;
if (!strcmp(curopt, "listgid")) { break;
if (!value || !value[0]) case Opt_listuid:
if (match_int(&args[0], &option))
return -EINVAL; return -EINVAL;
listgid = simple_strtoul(value, &value, 0); listuid = option;
if (*value) break;
case Opt_listgid:
if (match_int(&args[0], &option))
return -EINVAL; return -EINVAL;
} listgid = option;
if (!strcmp(curopt, "listmode")) { break;
if (!value || !value[0]) case Opt_listmode:
if (match_octal(&args[0], &option))
return -EINVAL; return -EINVAL;
listmode = simple_strtoul(value, &value, 0) & S_IRWXUGO; listmode = option & S_IRWXUGO;
if (*value) break;
default:
err("usbfs: unrecognised mount option \"%s\" "
"or missing value\n", p);
return -EINVAL; return -EINVAL;
} }
} }
...@@ -139,9 +151,6 @@ static int parse_options(struct super_block *s, char *data) ...@@ -139,9 +151,6 @@ static int parse_options(struct super_block *s, char *data)
return 0; return 0;
} }
/* --------------------------------------------------------------------- */
static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev) static struct inode *usbfs_get_inode (struct super_block *sb, int mode, dev_t dev)
{ {
struct inode *inode = new_inode(sb); struct inode *inode = new_inode(sb);
......
...@@ -99,82 +99,6 @@ static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) ...@@ -99,82 +99,6 @@ static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space)
return out - buf; return out - buf;
} }
static int uhci_show_sc(int port, unsigned short status, char *buf, int len)
{
char *out = buf;
/* Try to make sure there's enough memory */
if (len < 80)
return 0;
out += sprintf(out, " stat%d = %04x %s%s%s%s%s%s%s%s\n",
port,
status,
(status & USBPORTSC_SUSP) ? "PortSuspend " : "",
(status & USBPORTSC_PR) ? "PortReset " : "",
(status & USBPORTSC_LSDA) ? "LowSpeed " : "",
(status & USBPORTSC_RD) ? "ResumeDetect " : "",
(status & USBPORTSC_PEC) ? "EnableChange " : "",
(status & USBPORTSC_PE) ? "PortEnabled " : "",
(status & USBPORTSC_CSC) ? "ConnectChange " : "",
(status & USBPORTSC_CCS) ? "PortConnected " : "");
return out - buf;
}
static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len)
{
char *out = buf;
unsigned int io_addr = uhci->io_addr;
unsigned short usbcmd, usbstat, usbint, usbfrnum;
unsigned int flbaseadd;
unsigned char sof;
unsigned short portsc1, portsc2;
/* Try to make sure there's enough memory */
if (len < 80 * 6)
return 0;
usbcmd = inw(io_addr + 0);
usbstat = inw(io_addr + 2);
usbint = inw(io_addr + 4);
usbfrnum = inw(io_addr + 6);
flbaseadd = inl(io_addr + 8);
sof = inb(io_addr + 12);
portsc1 = inw(io_addr + 16);
portsc2 = inw(io_addr + 18);
out += sprintf(out, " usbcmd = %04x %s%s%s%s%s%s%s%s\n",
usbcmd,
(usbcmd & USBCMD_MAXP) ? "Maxp64 " : "Maxp32 ",
(usbcmd & USBCMD_CF) ? "CF " : "",
(usbcmd & USBCMD_SWDBG) ? "SWDBG " : "",
(usbcmd & USBCMD_FGR) ? "FGR " : "",
(usbcmd & USBCMD_EGSM) ? "EGSM " : "",
(usbcmd & USBCMD_GRESET) ? "GRESET " : "",
(usbcmd & USBCMD_HCRESET) ? "HCRESET " : "",
(usbcmd & USBCMD_RS) ? "RS " : "");
out += sprintf(out, " usbstat = %04x %s%s%s%s%s%s\n",
usbstat,
(usbstat & USBSTS_HCH) ? "HCHalted " : "",
(usbstat & USBSTS_HCPE) ? "HostControllerProcessError " : "",
(usbstat & USBSTS_HSE) ? "HostSystemError " : "",
(usbstat & USBSTS_RD) ? "ResumeDetect " : "",
(usbstat & USBSTS_ERROR) ? "USBError " : "",
(usbstat & USBSTS_USBINT) ? "USBINT " : "");
out += sprintf(out, " usbint = %04x\n", usbint);
out += sprintf(out, " usbfrnum = (%d)%03x\n", (usbfrnum >> 10) & 1,
0xfff & (4*(unsigned int)usbfrnum));
out += sprintf(out, " flbaseadd = %08x\n", flbaseadd);
out += sprintf(out, " sof = %02x\n", sof);
out += uhci_show_sc(1, portsc1, out, len - (out - buf));
out += uhci_show_sc(2, portsc2, out, len - (out - buf));
return out - buf;
}
static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
{ {
char *out = buf; char *out = buf;
...@@ -274,6 +198,13 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space) ...@@ -274,6 +198,13 @@ static int uhci_show_qh(struct uhci_qh *qh, char *buf, int len, int space)
return out - buf; return out - buf;
} }
#define show_frame_num() \
if (!shown) { \
shown = 1; \
out += sprintf(out, "- Frame %d\n", i); \
}
#ifdef CONFIG_PROC_FS
static const char *qh_names[] = { static const char *qh_names[] = {
"skel_int128_qh", "skel_int64_qh", "skel_int128_qh", "skel_int64_qh",
"skel_int32_qh", "skel_int16_qh", "skel_int32_qh", "skel_int16_qh",
...@@ -283,18 +214,88 @@ static const char *qh_names[] = { ...@@ -283,18 +214,88 @@ static const char *qh_names[] = {
"skel_bulk_qh", "skel_term_qh" "skel_bulk_qh", "skel_term_qh"
}; };
#define show_frame_num() \
if (!shown) { \
shown = 1; \
out += sprintf(out, "- Frame %d\n", i); \
}
#define show_qh_name() \ #define show_qh_name() \
if (!shown) { \ if (!shown) { \
shown = 1; \ shown = 1; \
out += sprintf(out, "- %s\n", qh_names[i]); \ out += sprintf(out, "- %s\n", qh_names[i]); \
} }
static int uhci_show_sc(int port, unsigned short status, char *buf, int len)
{
char *out = buf;
/* Try to make sure there's enough memory */
if (len < 80)
return 0;
out += sprintf(out, " stat%d = %04x %s%s%s%s%s%s%s%s\n",
port,
status,
(status & USBPORTSC_SUSP) ? "PortSuspend " : "",
(status & USBPORTSC_PR) ? "PortReset " : "",
(status & USBPORTSC_LSDA) ? "LowSpeed " : "",
(status & USBPORTSC_RD) ? "ResumeDetect " : "",
(status & USBPORTSC_PEC) ? "EnableChange " : "",
(status & USBPORTSC_PE) ? "PortEnabled " : "",
(status & USBPORTSC_CSC) ? "ConnectChange " : "",
(status & USBPORTSC_CCS) ? "PortConnected " : "");
return out - buf;
}
static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len)
{
char *out = buf;
unsigned int io_addr = uhci->io_addr;
unsigned short usbcmd, usbstat, usbint, usbfrnum;
unsigned int flbaseadd;
unsigned char sof;
unsigned short portsc1, portsc2;
/* Try to make sure there's enough memory */
if (len < 80 * 6)
return 0;
usbcmd = inw(io_addr + 0);
usbstat = inw(io_addr + 2);
usbint = inw(io_addr + 4);
usbfrnum = inw(io_addr + 6);
flbaseadd = inl(io_addr + 8);
sof = inb(io_addr + 12);
portsc1 = inw(io_addr + 16);
portsc2 = inw(io_addr + 18);
out += sprintf(out, " usbcmd = %04x %s%s%s%s%s%s%s%s\n",
usbcmd,
(usbcmd & USBCMD_MAXP) ? "Maxp64 " : "Maxp32 ",
(usbcmd & USBCMD_CF) ? "CF " : "",
(usbcmd & USBCMD_SWDBG) ? "SWDBG " : "",
(usbcmd & USBCMD_FGR) ? "FGR " : "",
(usbcmd & USBCMD_EGSM) ? "EGSM " : "",
(usbcmd & USBCMD_GRESET) ? "GRESET " : "",
(usbcmd & USBCMD_HCRESET) ? "HCRESET " : "",
(usbcmd & USBCMD_RS) ? "RS " : "");
out += sprintf(out, " usbstat = %04x %s%s%s%s%s%s\n",
usbstat,
(usbstat & USBSTS_HCH) ? "HCHalted " : "",
(usbstat & USBSTS_HCPE) ? "HostControllerProcessError " : "",
(usbstat & USBSTS_HSE) ? "HostSystemError " : "",
(usbstat & USBSTS_RD) ? "ResumeDetect " : "",
(usbstat & USBSTS_ERROR) ? "USBError " : "",
(usbstat & USBSTS_USBINT) ? "USBINT " : "");
out += sprintf(out, " usbint = %04x\n", usbint);
out += sprintf(out, " usbfrnum = (%d)%03x\n", (usbfrnum >> 10) & 1,
0xfff & (4*(unsigned int)usbfrnum));
out += sprintf(out, " flbaseadd = %08x\n", flbaseadd);
out += sprintf(out, " sof = %02x\n", sof);
out += uhci_show_sc(1, portsc1, out, len - (out - buf));
out += uhci_show_sc(2, portsc2, out, len - (out - buf));
return out - buf;
}
static int uhci_show_urbp(struct uhci_hcd *uhci, struct urb_priv *urbp, char *buf, int len) static int uhci_show_urbp(struct uhci_hcd *uhci, struct urb_priv *urbp, char *buf, int len)
{ {
struct list_head *tmp; struct list_head *tmp;
...@@ -512,7 +513,6 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) ...@@ -512,7 +513,6 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len)
return out - buf; return out - buf;
} }
#ifdef CONFIG_PROC_FS
#define MAX_OUTPUT (64 * 1024) #define MAX_OUTPUT (64 * 1024)
static struct proc_dir_entry *uhci_proc_root = NULL; static struct proc_dir_entry *uhci_proc_root = NULL;
......
...@@ -2185,8 +2185,8 @@ static int uhci_reset(struct usb_hcd *hcd) ...@@ -2185,8 +2185,8 @@ static int uhci_reset(struct usb_hcd *hcd)
/* Maybe kick BIOS off this hardware. Then reset, so we won't get /* Maybe kick BIOS off this hardware. Then reset, so we won't get
* interrupts from any previous setup. * interrupts from any previous setup.
*/ */
pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
reset_hc(uhci); reset_hc(uhci);
pci_write_config_word(hcd->pdev, USBLEGSUP, USBLEGSUP_DEFAULT);
return 0; return 0;
} }
......
...@@ -186,8 +186,5 @@ config USB_XPAD ...@@ -186,8 +186,5 @@ config USB_XPAD
For information about how to connect the X-Box pad to USB, see For information about how to connect the X-Box pad to USB, see
Documentation/input/xpad.txt. Documentation/input/xpad.txt.
This driver is also available as a module ( = code which can be To compile this driver as a module, choose M here: the
inserted in and removed from the running kernel whenever you want). module will be called xpad.
The module will be called xpad. If you want to compile it as a
module, say M here and read <file:Documentation/modules.txt>.
...@@ -591,14 +591,14 @@ brlvger_write(struct file *file, const char __user *buffer, ...@@ -591,14 +591,14 @@ brlvger_write(struct file *file, const char __user *buffer,
int firstpart = 6 - off; int firstpart = 6 - off;
#ifdef WRITE_DEBUG #ifdef WRITE_DEBUG
dbg3("off: %d, rs: %d, count: %d, firstpart: %d", dbg3("off: %lld, rs: %d, count: %d, firstpart: %d",
off, rs, count, firstpart); off, rs, count, firstpart);
#endif #endif
firstpart = (firstpart < count) ? firstpart : count; firstpart = (firstpart < count) ? firstpart : count;
#ifdef WRITE_DEBUG #ifdef WRITE_DEBUG
dbg3("off: %d", off); dbg3("off: %lld", off);
dbg3("firstpart: %d", firstpart); dbg3("firstpart: %d", firstpart);
#endif #endif
...@@ -618,7 +618,7 @@ brlvger_write(struct file *file, const char __user *buffer, ...@@ -618,7 +618,7 @@ brlvger_write(struct file *file, const char __user *buffer,
off +=2; off +=2;
#ifdef WRITE_DEBUG #ifdef WRITE_DEBUG
dbg3("off: %d, rs: %d, count: %d, firstpart: %d, " dbg3("off: %lld, rs: %d, count: %d, firstpart: %d, "
"written: %d", off, rs, count, firstpart, written); "written: %d", off, rs, count, firstpart, written);
#endif #endif
} }
......
...@@ -189,8 +189,7 @@ struct udsl_vcc_data { ...@@ -189,8 +189,7 @@ struct udsl_vcc_data {
struct atm_vcc *vcc; struct atm_vcc *vcc;
/* raw cell reassembly */ /* raw cell reassembly */
struct sk_buff *skb; struct sk_buff *sarb;
unsigned int max_pdu;
}; };
/* send */ /* send */
...@@ -314,12 +313,10 @@ static void udsl_extract_cells (struct udsl_instance_data *instance, unsigned ch ...@@ -314,12 +313,10 @@ static void udsl_extract_cells (struct udsl_instance_data *instance, unsigned ch
{ {
struct udsl_vcc_data *cached_vcc = NULL; struct udsl_vcc_data *cached_vcc = NULL;
struct atm_vcc *vcc; struct atm_vcc *vcc;
struct sk_buff *skb; struct sk_buff *sarb;
struct udsl_vcc_data *vcc_data; struct udsl_vcc_data *vcc_data;
int cached_vci = 0; int cached_vci = 0;
unsigned int i; unsigned int i;
unsigned int length;
unsigned int pdu_length;
int pti; int pti;
int vci; int vci;
short cached_vpi = 0; short cached_vpi = 0;
...@@ -344,74 +341,73 @@ static void udsl_extract_cells (struct udsl_instance_data *instance, unsigned ch ...@@ -344,74 +341,73 @@ static void udsl_extract_cells (struct udsl_instance_data *instance, unsigned ch
} }
vcc = vcc_data->vcc; vcc = vcc_data->vcc;
sarb = vcc_data->sarb;
if (!vcc_data->skb && !(vcc_data->skb = dev_alloc_skb (vcc_data->max_pdu))) { if (sarb->tail + ATM_CELL_PAYLOAD > sarb->end) {
dbg ("udsl_extract_cells: no memory for skb (vcc: 0x%p)!", vcc); dbg ("udsl_extract_cells: buffer overrun (sarb->len %u, vcc: 0x%p)!", sarb->len, vcc);
if (pti)
atomic_inc (&vcc->stats->rx_err);
continue;
}
skb = vcc_data->skb;
if (skb->len + ATM_CELL_PAYLOAD > vcc_data->max_pdu) {
dbg ("udsl_extract_cells: buffer overrun (max_pdu: %u, skb->len %u, vcc: 0x%p)", vcc_data->max_pdu, skb->len, vcc);
/* discard cells already received */ /* discard cells already received */
skb_trim (skb, 0); skb_trim (sarb, 0);
DEBUG_ON (vcc_data->max_pdu < ATM_CELL_PAYLOAD);
} }
memcpy (skb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD); memcpy (sarb->tail, source + ATM_CELL_HEADER, ATM_CELL_PAYLOAD);
__skb_put (skb, ATM_CELL_PAYLOAD); __skb_put (sarb, ATM_CELL_PAYLOAD);
if (pti) { if (pti) {
struct sk_buff *skb;
unsigned int length;
unsigned int pdu_length;
length = (source [ATM_CELL_SIZE - 6] << 8) + source [ATM_CELL_SIZE - 5]; length = (source [ATM_CELL_SIZE - 6] << 8) + source [ATM_CELL_SIZE - 5];
/* guard against overflow */ /* guard against overflow */
if (length > ATM_MAX_AAL5_PDU) { if (length > ATM_MAX_AAL5_PDU) {
dbg ("udsl_extract_cells: bogus length %u (vcc: 0x%p)", length, vcc); dbg ("udsl_extract_cells: bogus length %u (vcc: 0x%p)!", length, vcc);
goto drop; atomic_inc (&vcc->stats->rx_err);
goto out;
} }
pdu_length = UDSL_NUM_CELLS (length) * ATM_CELL_PAYLOAD; pdu_length = UDSL_NUM_CELLS (length) * ATM_CELL_PAYLOAD;
if (skb->len < pdu_length) { if (sarb->len < pdu_length) {
dbg ("udsl_extract_cells: bogus pdu_length %u (skb->len: %u, vcc: 0x%p)", pdu_length, skb->len, vcc); dbg ("udsl_extract_cells: bogus pdu_length %u (sarb->len: %u, vcc: 0x%p)!", pdu_length, sarb->len, vcc);
goto drop; atomic_inc (&vcc->stats->rx_err);
goto out;
} }
if (crc32_be (~0, skb->tail - pdu_length, pdu_length) != 0xc704dd7b) { if (crc32_be (~0, sarb->tail - pdu_length, pdu_length) != 0xc704dd7b) {
dbg ("udsl_extract_cells: packet failed crc check (vcc: 0x%p)", vcc); dbg ("udsl_extract_cells: packet failed crc check (vcc: 0x%p)!", vcc);
goto drop; atomic_inc (&vcc->stats->rx_err);
goto out;
} }
if (!atm_charge (vcc, skb->truesize)) { vdbg ("udsl_extract_cells: got packet (length: %u, pdu_length: %u, vcc: 0x%p)", length, pdu_length, vcc);
dbg ("udsl_extract_cells: failed atm_charge (skb->truesize: %u)", skb->truesize);
goto drop_no_stats; /* atm_charge increments rx_drop */
}
/* now that we are sure to send the skb, it is ok to change skb->data */ if (!(skb = dev_alloc_skb (length))) {
if (skb->len > pdu_length) dbg ("udsl_extract_cells: no memory for skb (length: %u)!", length);
skb_pull (skb, skb->len - pdu_length); /* discard initial junk */ atomic_inc (&vcc->stats->rx_drop);
goto out;
}
skb_trim (skb, length); /* drop zero padding and trailer */ vdbg ("udsl_extract_cells: allocated new sk_buff (skb: 0x%p, skb->truesize: %u)", skb, skb->truesize);
atomic_inc (&vcc->stats->rx); if (!atm_charge (vcc, skb->truesize)) {
dbg ("udsl_extract_cells: failed atm_charge (skb->truesize: %u)!", skb->truesize);
dev_kfree_skb (skb);
goto out; /* atm_charge increments rx_drop */
}
PACKETDEBUG (skb->data, skb->len); memcpy (skb->data, sarb->tail - pdu_length, length);
__skb_put (skb, length);
vdbg ("udsl_extract_cells: sending skb 0x%p, skb->len %u, skb->truesize %u", skb, skb->len, skb->truesize); vdbg ("udsl_extract_cells: sending skb 0x%p, skb->len %u, skb->truesize %u", skb, skb->len, skb->truesize);
vcc->push (vcc, skb); PACKETDEBUG (skb->data, skb->len);
vcc_data->skb = NULL;
continue; vcc->push (vcc, skb);
drop: atomic_inc (&vcc->stats->rx);
atomic_inc (&vcc->stats->rx_err); out:
drop_no_stats: skb_trim (sarb, 0);
skb_trim (skb, 0);
} }
} }
} }
...@@ -871,6 +867,7 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci) ...@@ -871,6 +867,7 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
{ {
struct udsl_instance_data *instance = vcc->dev->dev_data; struct udsl_instance_data *instance = vcc->dev->dev_data;
struct udsl_vcc_data *new; struct udsl_vcc_data *new;
unsigned int max_pdu;
dbg ("udsl_atm_open: vpi %hd, vci %d", vpi, vci); dbg ("udsl_atm_open: vpi %hd, vci %d", vpi, vci);
...@@ -883,8 +880,10 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci) ...@@ -883,8 +880,10 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
return -EINVAL; return -EINVAL;
/* only support AAL5 */ /* only support AAL5 */
if ((vcc->qos.aal != ATM_AAL5) || (vcc->qos.rxtp.max_sdu < 0) || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) if ((vcc->qos.aal != ATM_AAL5) || (vcc->qos.rxtp.max_sdu < 0) || (vcc->qos.rxtp.max_sdu > ATM_MAX_AAL5_PDU)) {
dbg ("udsl_atm_open: unsupported ATM type %d!", vcc->qos.aal);
return -EINVAL; return -EINVAL;
}
if (!instance->firmware_loaded) { if (!instance->firmware_loaded) {
dbg ("udsl_atm_open: firmware not loaded!"); dbg ("udsl_atm_open: firmware not loaded!");
...@@ -894,11 +893,13 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci) ...@@ -894,11 +893,13 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
down (&instance->serialize); /* vs self, udsl_atm_close */ down (&instance->serialize); /* vs self, udsl_atm_close */
if (udsl_find_vcc (instance, vpi, vci)) { if (udsl_find_vcc (instance, vpi, vci)) {
dbg ("udsl_atm_open: %hd/%d already in use!", vpi, vci);
up (&instance->serialize); up (&instance->serialize);
return -EADDRINUSE; return -EADDRINUSE;
} }
if (!(new = kmalloc (sizeof (struct udsl_vcc_data), GFP_KERNEL))) { if (!(new = kmalloc (sizeof (struct udsl_vcc_data), GFP_KERNEL))) {
dbg ("udsl_atm_open: no memory for vcc_data!");
up (&instance->serialize); up (&instance->serialize);
return -ENOMEM; return -ENOMEM;
} }
...@@ -907,7 +908,15 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci) ...@@ -907,7 +908,15 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
new->vcc = vcc; new->vcc = vcc;
new->vpi = vpi; new->vpi = vpi;
new->vci = vci; new->vci = vci;
new->max_pdu = max (1, UDSL_NUM_CELLS (vcc->qos.rxtp.max_sdu)) * ATM_CELL_PAYLOAD;
/* udsl_extract_cells requires at least one cell */
max_pdu = max (1, UDSL_NUM_CELLS (vcc->qos.rxtp.max_sdu)) * ATM_CELL_PAYLOAD;
if (!(new->sarb = alloc_skb (max_pdu, GFP_KERNEL))) {
dbg ("udsl_atm_open: no memory for SAR buffer!");
kfree (new);
up (&instance->serialize);
return -ENOMEM;
}
vcc->dev_data = new; vcc->dev_data = new;
vcc->vpi = vpi; vcc->vpi = vpi;
...@@ -925,7 +934,7 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci) ...@@ -925,7 +934,7 @@ static int udsl_atm_open (struct atm_vcc *vcc, short vpi, int vci)
tasklet_schedule (&instance->receive_tasklet); tasklet_schedule (&instance->receive_tasklet);
dbg ("udsl_atm_open: allocated vcc data 0x%p (max_pdu: %u)", new, new->max_pdu); dbg ("udsl_atm_open: allocated vcc data 0x%p (max_pdu: %u)", new, max_pdu);
return 0; return 0;
} }
...@@ -952,9 +961,8 @@ static void udsl_atm_close (struct atm_vcc *vcc) ...@@ -952,9 +961,8 @@ static void udsl_atm_close (struct atm_vcc *vcc)
list_del (&vcc_data->list); list_del (&vcc_data->list);
tasklet_enable (&instance->receive_tasklet); tasklet_enable (&instance->receive_tasklet);
if (vcc_data->skb) kfree_skb (vcc_data->sarb);
dev_kfree_skb (vcc_data->skb); vcc_data->sarb = NULL;
vcc_data->skb = NULL;
kfree (vcc_data); kfree (vcc_data);
vcc->dev_data = NULL; vcc->dev_data = NULL;
...@@ -1216,7 +1224,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf) ...@@ -1216,7 +1224,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
for (i = 0; i < num_rcv_urbs; i++) for (i = 0; i < num_rcv_urbs; i++)
if ((result = usb_unlink_urb (instance->receivers [i].urb)) < 0) if ((result = usb_unlink_urb (instance->receivers [i].urb)) < 0)
dbg ("udsl_usb_disconnect: usb_unlink_urb on receive urb %d returned %d", i, result); dbg ("udsl_usb_disconnect: usb_unlink_urb on receive urb %d returned %d!", i, result);
/* wait for completion handlers to finish */ /* wait for completion handlers to finish */
do { do {
...@@ -1252,7 +1260,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf) ...@@ -1252,7 +1260,7 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
for (i = 0; i < num_snd_urbs; i++) for (i = 0; i < num_snd_urbs; i++)
if ((result = usb_unlink_urb (instance->senders [i].urb)) < 0) if ((result = usb_unlink_urb (instance->senders [i].urb)) < 0)
dbg ("udsl_usb_disconnect: usb_unlink_urb on send urb %d returned %d", i, result); dbg ("udsl_usb_disconnect: usb_unlink_urb on send urb %d returned %d!", i, result);
/* wait for completion handlers to finish */ /* wait for completion handlers to finish */
do { do {
...@@ -1298,11 +1306,9 @@ static void udsl_usb_disconnect (struct usb_interface *intf) ...@@ -1298,11 +1306,9 @@ static void udsl_usb_disconnect (struct usb_interface *intf)
static int __init udsl_usb_init (void) static int __init udsl_usb_init (void)
{ {
struct sk_buff *skb; /* dummy for sizeof */
dbg ("udsl_usb_init: driver version " DRIVER_VERSION); dbg ("udsl_usb_init: driver version " DRIVER_VERSION);
if (sizeof (struct udsl_control) > sizeof (skb->cb)) { if (sizeof (struct udsl_control) > sizeof (((struct sk_buff *)0)->cb)) {
printk (KERN_ERR __FILE__ ": unusable with this kernel!\n"); printk (KERN_ERR __FILE__ ": unusable with this kernel!\n");
return -EIO; return -EIO;
} }
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
Change History Change History
2003sep04 LPM (Keyspan) add support for new single port product USA19HS.
Improve setup message handling for all devices.
Wed Feb 19 22:00:00 PST 2003 (Jeffrey S. Laing <keyspan@jsl.com>) Wed Feb 19 22:00:00 PST 2003 (Jeffrey S. Laing <keyspan@jsl.com>)
Merged the current (1/31/03) Keyspan code with the current (2.4.21-pre4) Merged the current (1/31/03) Keyspan code with the current (2.4.21-pre4)
Linux source tree. The Linux tree lacked support for the 49WLC and Linux source tree. The Linux tree lacked support for the 49WLC and
...@@ -172,6 +175,7 @@ struct keyspan_port_private { ...@@ -172,6 +175,7 @@ struct keyspan_port_private {
int baud; int baud;
int old_baud; int old_baud;
unsigned int cflag; unsigned int cflag;
unsigned int old_cflag;
enum {flow_none, flow_cts, flow_xon} flow_control; enum {flow_none, flow_cts, flow_xon} flow_control;
int rts_state; /* Handshaking pins (outputs) */ int rts_state; /* Handshaking pins (outputs) */
int dtr_state; int dtr_state;
...@@ -187,11 +191,12 @@ struct keyspan_port_private { ...@@ -187,11 +191,12 @@ struct keyspan_port_private {
/* Include Keyspan message headers. All current Keyspan Adapters /* Include Keyspan message headers. All current Keyspan Adapters
make use of one of three message formats which are referred make use of one of four message formats which are referred
to as USA-26, USA-28 and USA-49 by Keyspan and within this driver. */ to as USA-26, USA-28 and USA-49, USA-90 by Keyspan and within this driver. */
#include "keyspan_usa26msg.h" #include "keyspan_usa26msg.h"
#include "keyspan_usa28msg.h" #include "keyspan_usa28msg.h"
#include "keyspan_usa49msg.h" #include "keyspan_usa49msg.h"
#include "keyspan_usa90msg.h"
/* Functions used by new usb-serial code. */ /* Functions used by new usb-serial code. */
...@@ -346,8 +351,8 @@ static int keyspan_ioctl(struct usb_serial_port *port, struct file *file, ...@@ -346,8 +351,8 @@ static int keyspan_ioctl(struct usb_serial_port *port, struct file *file,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
} }
/* Write function is generic for the three protocols used /* Write function is similar for the four protocols used
with only a minor change for usa49 required */ with only a minor change for usa90 (usa19hs) required */
static int keyspan_write(struct usb_serial_port *port, int from_user, static int keyspan_write(struct usb_serial_port *port, int from_user,
const unsigned char *buf, int count) const unsigned char *buf, int count)
{ {
...@@ -356,18 +361,26 @@ static int keyspan_write(struct usb_serial_port *port, int from_user, ...@@ -356,18 +361,26 @@ static int keyspan_write(struct usb_serial_port *port, int from_user,
int flip; int flip;
int left, todo; int left, todo;
struct urb *this_urb; struct urb *this_urb;
int err; int err, maxDataLen, dataOffset;
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
d_details = p_priv->device_details; d_details = p_priv->device_details;
if (d_details->msg_format == msg_usa90) {
maxDataLen = 64;
dataOffset = 0;
} else {
maxDataLen = 63;
dataOffset = 1;
}
dbg("%s - for port %d (%d chars), flip=%d", dbg("%s - for port %d (%d chars), flip=%d",
__FUNCTION__, port->number, count, p_priv->out_flip); __FUNCTION__, port->number, count, p_priv->out_flip);
for (left = count; left > 0; left -= todo) { for (left = count; left > 0; left -= todo) {
todo = left; todo = left;
if (todo > 63) if (todo > maxDataLen)
todo = 63; todo = maxDataLen;
flip = p_priv->out_flip; flip = p_priv->out_flip;
...@@ -390,20 +403,20 @@ static int keyspan_write(struct usb_serial_port *port, int from_user, ...@@ -390,20 +403,20 @@ static int keyspan_write(struct usb_serial_port *port, int from_user,
break; break;
} }
/* First byte in buffer is "last flag" - unused so /* First byte in buffer is "last flag" (except for usa19hx) - unused so
for now so set to zero */ for now so set to zero */
((char *)this_urb->transfer_buffer)[0] = 0; ((char *)this_urb->transfer_buffer)[0] = 0;
if (from_user) { if (from_user) {
if (copy_from_user(this_urb->transfer_buffer + 1, buf, todo)) if (copy_from_user(this_urb->transfer_buffer + dataOffset, buf, todo))
return -EFAULT; return -EFAULT;
} else { } else {
memcpy (this_urb->transfer_buffer + 1, buf, todo); memcpy (this_urb->transfer_buffer + dataOffset, buf, todo);
} }
buf += todo; buf += todo;
/* send the data out the bulk port */ /* send the data out the bulk port */
this_urb->transfer_buffer_length = todo + 1; this_urb->transfer_buffer_length = todo + dataOffset;
this_urb->transfer_flags &= ~URB_ASYNC_UNLINK; this_urb->transfer_flags &= ~URB_ASYNC_UNLINK;
this_urb->dev = port->serial->dev; this_urb->dev = port->serial->dev;
...@@ -443,9 +456,12 @@ static void usa26_indat_callback(struct urb *urb, struct pt_regs *regs) ...@@ -443,9 +456,12 @@ static void usa26_indat_callback(struct urb *urb, struct pt_regs *regs)
if (urb->actual_length) { if (urb->actual_length) {
/* 0x80 bit is error flag */ /* 0x80 bit is error flag */
if ((data[0] & 0x80) == 0) { if ((data[0] & 0x80) == 0) {
/* no error on any byte */ /* no errors on individual bytes, only possible overrun err*/
if (data[0] & RXERROR_OVERRUN)
err = TTY_OVERRUN;
else err = 0;
for (i = 1; i < urb->actual_length ; ++i) { for (i = 1; i < urb->actual_length ; ++i) {
tty_insert_flip_char(tty, data[i], 0); tty_insert_flip_char(tty, data[i], err);
} }
} else { } else {
/* some bytes had errors, every byte has status */ /* some bytes had errors, every byte has status */
...@@ -474,7 +490,7 @@ static void usa26_indat_callback(struct urb *urb, struct pt_regs *regs) ...@@ -474,7 +490,7 @@ static void usa26_indat_callback(struct urb *urb, struct pt_regs *regs)
return; return;
} }
/* Outdat handling is common for usa26, usa28 and usa49 messages */ /* Outdat handling is common for all devices */
static void usa2x_outdat_callback(struct urb *urb, struct pt_regs *regs) static void usa2x_outdat_callback(struct urb *urb, struct pt_regs *regs)
{ {
struct usb_serial_port *port; struct usb_serial_port *port;
...@@ -861,29 +877,172 @@ static void usa49_outcont_callback(struct urb *urb, struct pt_regs *regs) ...@@ -861,29 +877,172 @@ static void usa49_outcont_callback(struct urb *urb, struct pt_regs *regs)
dbg ("%s", __FUNCTION__); dbg ("%s", __FUNCTION__);
} }
static void usa90_indat_callback(struct urb *urb, struct pt_regs *regs)
{
int i, err;
int endpoint;
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
struct tty_struct *tty;
unsigned char *data = urb->transfer_buffer;
dbg ("%s", __FUNCTION__);
endpoint = usb_pipeendpoint(urb->pipe);
if (urb->status) {
dbg("%s - nonzero status: %x on endpoint %d.",
__FUNCTION__, urb->status, endpoint);
return;
}
port = (struct usb_serial_port *) urb->context;
p_priv = usb_get_serial_port_data(port);
tty = port->tty;
if (urb->actual_length) {
/* if current mode is DMA, looks like usa28 format
otherwise looks like usa26 data format */
if (p_priv->baud > 57600) {
for (i = 0; i < urb->actual_length ; ++i)
tty_insert_flip_char(tty, data[i], 0);
}
else {
/* 0x80 bit is error flag */
if ((data[0] & 0x80) == 0) {
/* no errors on individual bytes, only possible overrun err*/
if (data[0] & RXERROR_OVERRUN)
err = TTY_OVERRUN;
else err = 0;
for (i = 1; i < urb->actual_length ; ++i)
tty_insert_flip_char(tty, data[i], err);
}
else {
/* some bytes had errors, every byte has status */
dbg("%s - RX error!!!!", __FUNCTION__);
for (i = 0; i + 1 < urb->actual_length; i += 2) {
int stat = data[i], flag = 0;
if (stat & RXERROR_OVERRUN)
flag |= TTY_OVERRUN;
if (stat & RXERROR_FRAMING)
flag |= TTY_FRAME;
if (stat & RXERROR_PARITY)
flag |= TTY_PARITY;
/* XXX should handle break (0x10) */
tty_insert_flip_char(tty, data[i+1], flag);
}
}
}
tty_flip_buffer_push(tty);
}
/* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev;
if (port->open_count)
if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err);
}
return;
}
static void usa90_instat_callback(struct urb *urb, struct pt_regs *regs)
{
unsigned char *data = urb->transfer_buffer;
struct keyspan_usa90_portStatusMessage *msg;
struct usb_serial *serial;
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
int old_dcd_state, err;
serial = (struct usb_serial *) urb->context;
if (urb->status) {
dbg("%s - nonzero status: %x", __FUNCTION__, urb->status);
return;
}
if (urb->actual_length < 14) {
dbg("%s - %d byte report??", __FUNCTION__, urb->actual_length);
goto exit;
}
msg = (struct keyspan_usa90_portStatusMessage *)data;
/* Now do something useful with the data */
port = serial->port[0];
p_priv = usb_get_serial_port_data(port);
/* Update handshaking pin state information */
old_dcd_state = p_priv->dcd_state;
p_priv->cts_state = ((msg->cts) ? 1 : 0);
p_priv->dsr_state = ((msg->dsr) ? 1 : 0);
p_priv->dcd_state = ((msg->dcd) ? 1 : 0);
p_priv->ri_state = ((msg->ri) ? 1 : 0);
if (port->tty && !C_CLOCAL(port->tty)
&& old_dcd_state != p_priv->dcd_state) {
if (old_dcd_state)
tty_hangup(port->tty);
/* else */
/* wake_up_interruptible(&p_priv->open_wait); */
}
/* Resubmit urb so we continue receiving */
urb->dev = serial->dev;
if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg("%s - resubmit read urb failed. (%d)", __FUNCTION__, err);
}
exit:
;
}
static void usa90_outcont_callback(struct urb *urb, struct pt_regs *regs)
{
struct usb_serial_port *port;
struct keyspan_port_private *p_priv;
port = (struct usb_serial_port *) urb->context;
p_priv = usb_get_serial_port_data(port);
if (p_priv->resend_cont) {
dbg ("%s - sending setup", __FUNCTION__);
keyspan_usa90_send_setup(port->serial, port, p_priv->resend_cont - 1);
}
}
static int keyspan_write_room (struct usb_serial_port *port) static int keyspan_write_room (struct usb_serial_port *port)
{ {
struct keyspan_port_private *p_priv; struct keyspan_port_private *p_priv;
const struct keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int flip; int flip;
int data_len;
struct urb *this_urb; struct urb *this_urb;
dbg("%s", __FUNCTION__); dbg("%s", __FUNCTION__);
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
d_details = p_priv->device_details; d_details = p_priv->device_details;
if (d_details->msg_format == msg_usa90)
data_len = 64;
else
data_len = 63;
flip = p_priv->out_flip; flip = p_priv->out_flip;
/* Check both endpoints to see if any are available. */ /* Check both endpoints to see if any are available. */
if ((this_urb = p_priv->out_urbs[flip]) != 0) { if ((this_urb = p_priv->out_urbs[flip]) != 0) {
if (this_urb->status != -EINPROGRESS) if (this_urb->status != -EINPROGRESS)
return (63); return (data_len);
flip = (flip + 1) & d_details->outdat_endp_flip; flip = (flip + 1) & d_details->outdat_endp_flip;
if ((this_urb = p_priv->out_urbs[flip]) != 0) if ((this_urb = p_priv->out_urbs[flip]) != 0)
if (this_urb->status != -EINPROGRESS) if (this_urb->status != -EINPROGRESS)
return (63); return (data_len);
} }
return (0); return (0);
} }
...@@ -902,17 +1061,24 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) ...@@ -902,17 +1061,24 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
const struct keyspan_device_details *d_details; const struct keyspan_device_details *d_details;
int i, err; int i, err;
int baud_rate, device_port;
struct urb *urb; struct urb *urb;
unsigned int cflag;
s_priv = usb_get_serial_data(serial); s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port); p_priv = usb_get_serial_port_data(port);
d_details = s_priv->device_details; d_details = p_priv->device_details;
dbg("%s - port%d.", __FUNCTION__, port->number); dbg("%s - port%d.", __FUNCTION__, port->number);
/* Set some sane defaults */ /* Set some sane defaults */
p_priv->rts_state = 1; p_priv->rts_state = 1;
p_priv->dtr_state = 1; p_priv->dtr_state = 1;
p_priv->baud = 9600;
/* force baud and lcr to be set on open */
p_priv->old_baud = 0;
p_priv->old_cflag = 0;
p_priv->out_flip = 0; p_priv->out_flip = 0;
p_priv->in_flip = 0; p_priv->in_flip = 0;
...@@ -922,7 +1088,10 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) ...@@ -922,7 +1088,10 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
if ((urb = p_priv->in_urbs[i]) == NULL) if ((urb = p_priv->in_urbs[i]) == NULL)
continue; continue;
urb->dev = serial->dev; urb->dev = serial->dev;
usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0);
/* make sure endpoint data toggle is synchronized with the device */
usb_clear_halt(urb->dev, urb->pipe);
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) {
dbg("%s - submit urb %d failed (%d)", __FUNCTION__, i, err); dbg("%s - submit urb %d failed (%d)", __FUNCTION__, i, err);
...@@ -937,12 +1106,29 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) ...@@ -937,12 +1106,29 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp)
/* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */
} }
// if the device is a USA49x, determine whether it is an W or WLC model /* get the terminal config for the setup message now so we don't
// and set the baud clock accordingly * need to send 2 of them */
cflag = port->tty->termios->c_cflag;
device_port = port->number - port->serial->minor;
/* Baud rate calculation takes baud rate as an integer
so other rates can be generated if desired. */
baud_rate = tty_get_baud_rate(port->tty);
/* If no match or invalid, leave as default */
if (baud_rate >= 0
&& d_details->calculate_baud_rate(baud_rate, d_details->baudclk,
NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) {
p_priv->baud = baud_rate;
}
/* set CTS/RTS handshake etc. */
p_priv->cflag = cflag;
p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none;
keyspan_send_setup(port, 1); keyspan_send_setup(port, 1);
//mdelay(100); //mdelay(100);
keyspan_set_termios(port, NULL); //keyspan_set_termios(port, NULL);
return (0); return (0);
} }
...@@ -977,7 +1163,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp) ...@@ -977,7 +1163,7 @@ static void keyspan_close(struct usb_serial_port *port, struct file *filp)
keyspan_send_setup(port, 2); keyspan_send_setup(port, 2);
/* pilot-xfer seems to work best with this delay */ /* pilot-xfer seems to work best with this delay */
mdelay(100); mdelay(100);
keyspan_set_termios(port, NULL); // keyspan_set_termios(port, NULL);
} }
/*while (p_priv->outcont_urb->status == -EINPROGRESS) { /*while (p_priv->outcont_urb->status == -EINPROGRESS) {
...@@ -1172,6 +1358,14 @@ static struct callbacks { ...@@ -1172,6 +1358,14 @@ static struct callbacks {
.outdat_callback = usa2x_outdat_callback, .outdat_callback = usa2x_outdat_callback,
.inack_callback = usa49_inack_callback, .inack_callback = usa49_inack_callback,
.outcont_callback = usa49_outcont_callback, .outcont_callback = usa49_outcont_callback,
}, {
/* msg_usa90 callbacks */
.instat_callback = usa90_instat_callback,
.glocont_callback = usa28_glocont_callback,
.indat_callback = usa90_indat_callback,
.outdat_callback = usa2x_outdat_callback,
.inack_callback = usa28_inack_callback,
.outcont_callback = usa90_outcont_callback,
} }
}; };
...@@ -1295,6 +1489,41 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, ...@@ -1295,6 +1489,41 @@ static int keyspan_usa19_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
return (KEYSPAN_BAUD_RATE_OK); return (KEYSPAN_BAUD_RATE_OK);
} }
/* usa19hs function doesn't require prescaler */
static int keyspan_usa19hs_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum)
{
u32 b16, /* baud rate times 16 (actual rate used internally) */
div; /* divisor */
dbg ("%s - %d.", __FUNCTION__, baud_rate);
/* prevent divide by zero... */
if( (b16 = (baud_rate * 16L)) == 0)
return (KEYSPAN_INVALID_BAUD_RATE);
/* calculate the divisor */
if( (div = (baudclk / b16)) == 0)
return (KEYSPAN_INVALID_BAUD_RATE);
if(div > 0xffff)
return (KEYSPAN_INVALID_BAUD_RATE);
/* return the counter values if non-null */
if (rate_low)
*rate_low = (u8) (div & 0xff);
if (rate_hi)
*rate_hi = (u8) ((div >> 8) & 0xff);
if (rate_low && rate_hi)
dbg ("%s - %d %02x %02x.", __FUNCTION__, baud_rate, *rate_hi, *rate_low);
return (KEYSPAN_BAUD_RATE_OK);
}
static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi, static int keyspan_usa19w_calc_baud(u32 baud_rate, u32 baudclk, u8 *rate_hi,
u8 *rate_low, u8 *prescaler, int portnum) u8 *rate_low, u8 *prescaler, int portnum)
{ {
...@@ -1447,6 +1676,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial, ...@@ -1447,6 +1676,7 @@ static int keyspan_usa26_send_setup(struct usb_serial *serial,
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
/* dbg ("%s - already writing", __FUNCTION__); */ /* dbg ("%s - already writing", __FUNCTION__); */
mdelay(5);
return(-1); return(-1);
} }
...@@ -1597,6 +1827,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial, ...@@ -1597,6 +1827,7 @@ static int keyspan_usa28_send_setup(struct usb_serial *serial,
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
dbg ("%s already writing", __FUNCTION__); dbg ("%s already writing", __FUNCTION__);
mdelay(5);
return(-1); return(-1);
} }
...@@ -1729,6 +1960,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1729,6 +1960,7 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
p_priv->resend_cont = reset_port + 1; p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) { if (this_urb->status == -EINPROGRESS) {
/* dbg ("%s - already writing", __FUNCTION__); */ /* dbg ("%s - already writing", __FUNCTION__); */
mdelay(5);
return(-1); return(-1);
} }
...@@ -1857,6 +2089,144 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial, ...@@ -1857,6 +2089,144 @@ static int keyspan_usa49_send_setup(struct usb_serial *serial,
return (0); return (0);
} }
static int keyspan_usa90_send_setup(struct usb_serial *serial,
struct usb_serial_port *port,
int reset_port)
{
struct keyspan_usa90_portControlMessage msg;
struct keyspan_serial_private *s_priv;
struct keyspan_port_private *p_priv;
const struct keyspan_device_details *d_details;
struct urb *this_urb;
int err;
u8 prescaler;
dbg ("%s", __FUNCTION__);
s_priv = usb_get_serial_data(serial);
p_priv = usb_get_serial_port_data(port);
d_details = s_priv->device_details;
/* only do something if we have a bulk out endpoint */
if ((this_urb = p_priv->outcont_urb) == NULL) {
dbg("%s - oops no urb.", __FUNCTION__);
return -1;
}
/* Save reset port val for resend.
Don't overwrite resend for open/close condition. */
if ((reset_port + 1) > p_priv->resend_cont)
p_priv->resend_cont = reset_port + 1;
if (this_urb->status == -EINPROGRESS) {
dbg ("%s already writing", __FUNCTION__);
mdelay(5);
return(-1);
}
memset(&msg, 0, sizeof (struct keyspan_usa90_portControlMessage));
/* Only set baud rate if it's changed */
if (p_priv->old_baud != p_priv->baud) {
p_priv->old_baud = p_priv->baud;
msg.setClocking = 0x01;
if (d_details->calculate_baud_rate
(p_priv->baud, d_details->baudclk, &msg.baudHi,
&msg.baudLo, &prescaler, 0) == KEYSPAN_INVALID_BAUD_RATE ) {
dbg("%s - Invalid baud rate %d requested, using 9600.", __FUNCTION__,
p_priv->baud);
p_priv->baud = 9600;
d_details->calculate_baud_rate (p_priv->baud, d_details->baudclk,
&msg.baudHi, &msg.baudLo, &prescaler, 0);
}
msg.setRxMode = 1;
msg.setTxMode = 1;
}
/* modes must always be correctly specified */
if (p_priv->baud > 57600)
{
msg.rxMode = RXMODE_DMA;
msg.txMode = TXMODE_DMA;
}
else
{
msg.rxMode = RXMODE_BYHAND;
msg.txMode = TXMODE_BYHAND;
}
msg.lcr = (p_priv->cflag & CSTOPB)? STOPBITS_678_2: STOPBITS_5678_1;
switch (p_priv->cflag & CSIZE) {
case CS5:
msg.lcr |= USA_DATABITS_5;
break;
case CS6:
msg.lcr |= USA_DATABITS_6;
break;
case CS7:
msg.lcr |= USA_DATABITS_7;
break;
case CS8:
msg.lcr |= USA_DATABITS_8;
break;
}
if (p_priv->cflag & PARENB) {
/* note USA_PARITY_NONE == 0 */
msg.lcr |= (p_priv->cflag & PARODD)?
USA_PARITY_ODD: USA_PARITY_EVEN;
}
if (p_priv->old_cflag != p_priv->cflag) {
p_priv->old_cflag = p_priv->cflag;
msg.setLcr = 0x01;
}
if (p_priv->flow_control == flow_cts)
msg.txFlowControl = TXFLOW_CTS;
msg.setTxFlowControl = 0x01;
msg.setRxFlowControl = 0x01;
msg.rxForwardingLength = 16;
msg.rxForwardingTimeout = 16;
msg.txAckSetting = 0;
msg.xonChar = 17;
msg.xoffChar = 19;
/* Opening port */
if (reset_port == 1) {
msg.portEnabled = 1;
msg.rxFlush = 1;
msg.txBreak = (p_priv->break_on);
}
/* Closing port */
else if (reset_port == 2) {
msg.portEnabled = 0;
}
/* Sending intermediate configs */
else {
if (port->open_count)
msg.portEnabled = 1;
msg.txBreak = (p_priv->break_on);
}
/* Do handshaking outputs */
msg.setRts = 0x01;
msg.rts = p_priv->rts_state;
msg.setDtr = 0x01;
msg.dtr = p_priv->dtr_state;
p_priv->resend_cont = 0;
memcpy (this_urb->transfer_buffer, &msg, sizeof(msg));
/* send the data out the device on control endpoint */
this_urb->transfer_buffer_length = sizeof(msg);
this_urb->dev = serial->dev;
if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) {
dbg("%s - usb_submit_urb(setup) failed (%d)", __FUNCTION__, err);
}
return (0);
}
static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
{ {
struct usb_serial *serial = port->serial; struct usb_serial *serial = port->serial;
...@@ -1878,9 +2248,13 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port) ...@@ -1878,9 +2248,13 @@ static void keyspan_send_setup(struct usb_serial_port *port, int reset_port)
case msg_usa49: case msg_usa49:
keyspan_usa49_send_setup(serial, port, reset_port); keyspan_usa49_send_setup(serial, port, reset_port);
break; break;
case msg_usa90:
keyspan_usa90_send_setup(serial, port, reset_port);
break;
} }
} }
/* Gets called by the "real" driver (ie once firmware is loaded /* Gets called by the "real" driver (ie once firmware is loaded
and renumeration has taken place. */ and renumeration has taken place. */
static int keyspan_startup (struct usb_serial *serial) static int keyspan_startup (struct usb_serial *serial)
......
...@@ -82,6 +82,10 @@ static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk, ...@@ -82,6 +82,10 @@ static int keyspan_usa28_calc_baud (u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low, u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum); u8 *prescaler, int portnum);
static int keyspan_usa19hs_calc_baud (u32 baud_rate, u32 baudclk,
u8 *rate_hi, u8 *rate_low,
u8 *prescaler, int portnum);
static int keyspan_usa28_send_setup (struct usb_serial *serial, static int keyspan_usa28_send_setup (struct usb_serial *serial,
struct usb_serial_port *port, struct usb_serial_port *port,
int reset_port); int reset_port);
...@@ -92,6 +96,9 @@ static int keyspan_usa49_send_setup (struct usb_serial *serial, ...@@ -92,6 +96,9 @@ static int keyspan_usa49_send_setup (struct usb_serial *serial,
struct usb_serial_port *port, struct usb_serial_port *port,
int reset_port); int reset_port);
static int keyspan_usa90_send_setup (struct usb_serial *serial,
struct usb_serial_port *port,
int reset_port);
/* Struct used for firmware - increased size of data section /* Struct used for firmware - increased size of data section
to allow Keyspan's 'C' firmware struct to be used unmodified */ to allow Keyspan's 'C' firmware struct to be used unmodified */
...@@ -183,6 +190,7 @@ struct ezusb_hex_record { ...@@ -183,6 +190,7 @@ struct ezusb_hex_record {
#define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */ #define KEYSPAN_USA18X_BAUDCLK (12000000L) /* a guess */
#define KEYSPAN_USA19_BAUDCLK (12000000L) #define KEYSPAN_USA19_BAUDCLK (12000000L)
#define KEYSPAN_USA19W_BAUDCLK (24000000L) #define KEYSPAN_USA19W_BAUDCLK (24000000L)
#define KEYSPAN_USA19HS_BAUDCLK (14769231L)
#define KEYSPAN_USA28_BAUDCLK (1843200L) #define KEYSPAN_USA28_BAUDCLK (1843200L)
#define KEYSPAN_USA28X_BAUDCLK (12000000L) #define KEYSPAN_USA28X_BAUDCLK (12000000L)
#define KEYSPAN_USA49W_BAUDCLK (48000000L) #define KEYSPAN_USA49W_BAUDCLK (48000000L)
...@@ -215,6 +223,7 @@ struct ezusb_hex_record { ...@@ -215,6 +223,7 @@ struct ezusb_hex_record {
#define keyspan_usa18x_product_id 0x0112 #define keyspan_usa18x_product_id 0x0112
#define keyspan_usa19_product_id 0x0107 #define keyspan_usa19_product_id 0x0107
#define keyspan_usa19qi_product_id 0x010c #define keyspan_usa19qi_product_id 0x010c
#define keyspan_usa19hs_product_id 0x0121
#define keyspan_mpr_product_id 0x011c #define keyspan_mpr_product_id 0x011c
#define keyspan_usa19qw_product_id 0x0119 #define keyspan_usa19qw_product_id 0x0119
#define keyspan_usa19w_product_id 0x0108 #define keyspan_usa19w_product_id 0x0108
...@@ -230,7 +239,7 @@ struct keyspan_device_details { ...@@ -230,7 +239,7 @@ struct keyspan_device_details {
/* product ID value */ /* product ID value */
int product_id; int product_id;
enum {msg_usa26, msg_usa28, msg_usa49} msg_format; enum {msg_usa26, msg_usa28, msg_usa49, msg_usa90} msg_format;
/* Number of physical ports */ /* Number of physical ports */
int num_ports; int num_ports;
...@@ -349,6 +358,22 @@ static const struct keyspan_device_details usa19w_device_details = { ...@@ -349,6 +358,22 @@ static const struct keyspan_device_details usa19w_device_details = {
.baudclk = KEYSPAN_USA19W_BAUDCLK, .baudclk = KEYSPAN_USA19W_BAUDCLK,
}; };
static const struct keyspan_device_details usa19hs_device_details = {
product_id: keyspan_usa19hs_product_id,
msg_format: msg_usa90,
num_ports: 1,
indat_endp_flip: 0,
outdat_endp_flip: 0,
indat_endpoints: {0x81},
outdat_endpoints: {0x01},
inack_endpoints: {-1},
outcont_endpoints: {0x02},
instat_endpoint: 0x82,
glocont_endpoint: -1,
calculate_baud_rate: keyspan_usa19hs_calc_baud,
baudclk: KEYSPAN_USA19HS_BAUDCLK,
};
static const struct keyspan_device_details usa28_device_details = { static const struct keyspan_device_details usa28_device_details = {
.product_id = keyspan_usa28_product_id, .product_id = keyspan_usa28_product_id,
.msg_format = msg_usa28, .msg_format = msg_usa28,
...@@ -437,6 +462,7 @@ static const struct keyspan_device_details *keyspan_devices[] = { ...@@ -437,6 +462,7 @@ static const struct keyspan_device_details *keyspan_devices[] = {
&usa19qi_device_details, &usa19qi_device_details,
&usa19qw_device_details, &usa19qw_device_details,
&usa19w_device_details, &usa19w_device_details,
&usa19hs_device_details,
&usa28_device_details, &usa28_device_details,
&usa28x_device_details, &usa28x_device_details,
&usa28xa_device_details, &usa28xa_device_details,
...@@ -464,6 +490,7 @@ static struct usb_device_id keyspan_ids_combined[] = { ...@@ -464,6 +490,7 @@ static struct usb_device_id keyspan_ids_combined[] = {
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19w_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qi_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19qw_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa19hs_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_mpr_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28_product_id) },
{ USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) }, { USB_DEVICE(KEYSPAN_VENDOR_ID, keyspan_usa28x_product_id) },
...@@ -544,8 +571,8 @@ static struct usb_serial_device_type keyspan_1port_device = { ...@@ -544,8 +571,8 @@ static struct usb_serial_device_type keyspan_1port_device = {
.short_name = "keyspan_1", .short_name = "keyspan_1",
.id_table = keyspan_1port_ids, .id_table = keyspan_1port_ids,
.num_interrupt_in = NUM_DONT_CARE, .num_interrupt_in = NUM_DONT_CARE,
.num_bulk_in = 3, .num_bulk_in = NUM_DONT_CARE,
.num_bulk_out = 4, .num_bulk_out = NUM_DONT_CARE,
.num_ports = 1, .num_ports = 1,
.open = keyspan_open, .open = keyspan_open,
.close = keyspan_close, .close = keyspan_close,
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
Keyspan USB Async Firmware to run on Anchor EZ-USB Keyspan USB Async Message Formats for the USA28X
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
...@@ -19,11 +19,7 @@ ...@@ -19,11 +19,7 @@
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
2. Redistributions in binary form must reproduce the above copyright 2. The name of InnoSys Incorporated may not be used to endorse or promote
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
Keyspan USB Async Firmware to run on Anchor EZ-USB Keyspan USB Async Message Formats for the USA26X
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
...@@ -19,11 +19,7 @@ ...@@ -19,11 +19,7 @@
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
2. Redistributions in binary form must reproduce the above copyright 2. The name of InnoSys Incorporated may not be used to endorse or promote
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved Copyright (C) 1998-2000 InnoSys Incorporated. All Rights Reserved
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
Keyspan USB Async Firmware to run on Anchor EZ-USB Keyspan USB Async Message Formats for the USA49W
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are modification, are permitted provided that the following conditions are
...@@ -19,11 +19,7 @@ ...@@ -19,11 +19,7 @@
This file is available under a BSD-style copyright This file is available under a BSD-style copyright
2. Redistributions in binary form must reproduce the above copyright 2. The name of InnoSys Incorporated may not be used to endorse or promote
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of InnoSys Incorporated may not be used to endorse or promote
products derived from this software without specific prior written products derived from this software without specific prior written
permission. permission.
......
/*
usa90msg.h
Copyright (c) 1998-2003 InnoSys Incorporated. All Rights Reserved
This file is available under a BSD-style copyright
Keyspan USB Async Message Formats for the USA19HS
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain this licence text
without modification, this list of conditions, and the following
disclaimer. The following copyright notice must appear immediately at
the beginning of all source files:
Copyright (c) 1998-2003 InnoSys Incorporated. All Rights Reserved
This file is available under a BSD-style copyright
2. The name of InnoSys Incorprated may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY INNOSYS CORP. ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Revisions:
2003feb14 add setTxMode/txMode and cancelRxXoff to portControl
2003mar21 change name of PARITY_0/1 to add MARK/SPACE
*/
#ifndef __USA90MSG__
#define __USA90MSG__
struct keyspan_usa90_portControlMessage
{
/*
there are three types of "commands" sent in the control message:
1. configuration changes which must be requested by setting
the corresponding "set" flag (and should only be requested
when necessary, to reduce overhead on the device):
*/
u8 setClocking, // host requests baud rate be set
baudLo, // host does baud divisor calculation
baudHi, // host does baud divisor calculation
setLcr, // host requests lcr be set
lcr, // use PARITY, STOPBITS, DATABITS below
setRxMode, // set receive mode
rxMode, // RXMODE_DMA or RXMODE_BYHAND
setTxMode, // set transmit mode
txMode, // TXMODE_DMA or TXMODE_BYHAND
setTxFlowControl, // host requests tx flow control be set
txFlowControl , // use TX_FLOW... bits below
setRxFlowControl, // host requests rx flow control be set
rxFlowControl, // use RX_FLOW... bits below
sendXoff, // host requests XOFF transmitted immediately
sendXon, // host requests XON char transmitted
xonChar, // specified in current character format
xoffChar, // specified in current character format
sendChar, // host requests char transmitted immediately
txChar, // character to send
setRts, // host requests RTS output be set
rts, // 1=on, 0=off
setDtr, // host requests DTR output be set
dtr; // 1=on, 0=off
/*
2. configuration data which is simply used as is
and must be specified correctly in every host message.
*/
u8 rxForwardingLength, // forward when this number of chars available
rxForwardingTimeout, // (1-31 in ms)
txAckSetting; // 0=don't ack, 1=normal, 2-255 TBD...
/*
3. Firmware states which cause actions if they change
and must be specified correctly in every host message.
*/
u8 portEnabled, // 0=disabled, 1=enabled
txFlush, // 0=normal, 1=toss outbound data
txBreak, // 0=break off, 1=break on
loopbackMode; // 0=no loopback, 1=loopback enabled
/*
4. commands which are flags only; these are processed in order
(so that, e.g., if rxFlush and rxForward flags are set, the
port will have no data to forward); any non-zero value
is respected
*/
u8 rxFlush, // toss inbound data
rxForward, // forward all inbound data, NOW (as if fwdLen==1)
cancelRxXoff, // cancel any receive XOFF state (_txXoff)
returnStatus; // return current status NOW
};
// defines for bits in lcr
#define USA_DATABITS_5 0x00
#define USA_DATABITS_6 0x01
#define USA_DATABITS_7 0x02
#define USA_DATABITS_8 0x03
#define STOPBITS_5678_1 0x00 // 1 stop bit for all byte sizes
#define STOPBITS_5_1p5 0x04 // 1.5 stop bits for 5-bit byte
#define STOPBITS_678_2 0x04 // 2 stop bits for 6-8 bit byte
#define USA_PARITY_NONE 0x00
#define USA_PARITY_ODD 0x08
#define USA_PARITY_EVEN 0x18
#define PARITY_MARK_1 0x28 // force parity MARK
#define PARITY_SPACE_0 0x38 // force parity SPACE
#define TXFLOW_CTS 0x04
#define TXFLOW_DSR 0x08
#define TXFLOW_XOFF 0x01
#define TXFLOW_XOFF_ANY 0x02
#define TXFLOW_XOFF_BITS (TXFLOW_XOFF | TXFLOW_XOFF_ANY)
#define RXFLOW_XOFF 0x10
#define RXFLOW_RTS 0x20
#define RXFLOW_DTR 0x40
#define RXFLOW_DSR_SENSITIVITY 0x80
#define RXMODE_BYHAND 0x00
#define RXMODE_DMA 0x02
#define TXMODE_BYHAND 0x00
#define TXMODE_DMA 0x02
// all things called "StatusMessage" are sent on the status endpoint
struct keyspan_usa90_portStatusMessage
{
u8 msr, // reports the actual MSR register
cts, // reports CTS pin
dcd, // reports DCD pin
dsr, // reports DSR pin
ri, // reports RI pin
_txXoff, // port is in XOFF state (we received XOFF)
rxBreak, // reports break state
rxOverrun, // count of overrun errors (since last reported)
rxParity, // count of parity errors (since last reported)
rxFrame, // count of frame errors (since last reported)
portState, // PORTSTATE_xxx bits (useful for debugging)
messageAck, // message acknowledgement
charAck, // character acknowledgement
controlResponse; // (value = returnStatus) a control message has been processed
};
// bits in RX data message when STAT byte is included
#define RXERROR_OVERRUN 0x02
#define RXERROR_PARITY 0x04
#define RXERROR_FRAMING 0x08
#define RXERROR_BREAK 0x10
#define PORTSTATE_ENABLED 0x80
#define PORTSTATE_TXFLUSH 0x01
#define PORTSTATE_TXBREAK 0x02
#define PORTSTATE_LOOPBACK 0x04
// MSR bits
#define MSR_dCTS 0x01 // CTS has changed since last report
#define MSR_dDSR 0x02
#define MSR_dRI 0x04
#define MSR_dDCD 0x08
#define MSR_CTS 0x10 // current state of CTS
#define MSR_DSR 0x20
#define MSR_RI 0x40
#define MSR_DCD 0x80
// ie: the maximum length of an endpoint buffer
#define MAX_DATA_LEN 64
#endif
...@@ -102,6 +102,7 @@ struct freecom_status { ...@@ -102,6 +102,7 @@ struct freecom_status {
/* All packets (except for status) are 64 bytes long. */ /* All packets (except for status) are 64 bytes long. */
#define FCM_PACKET_LENGTH 64 #define FCM_PACKET_LENGTH 64
#define FCM_STATUS_PACKET_LENGTH 4
static int static int
freecom_readdata (Scsi_Cmnd *srb, struct us_data *us, freecom_readdata (Scsi_Cmnd *srb, struct us_data *us,
...@@ -216,7 +217,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -216,7 +217,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
/* There are times we can optimize out this status read, but it /* There are times we can optimize out this status read, but it
* doesn't hurt us to always do it now. */ * doesn't hurt us to always do it now. */
result = usb_stor_bulk_transfer_buf (us, ipipe, fst, result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial); FCM_STATUS_PACKET_LENGTH, &partial);
US_DEBUGP("foo Status result %d %u\n", result, partial); US_DEBUGP("foo Status result %d %u\n", result, partial);
if (result != USB_STOR_XFER_GOOD) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
...@@ -256,10 +257,10 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -256,10 +257,10 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
/* get the data */ /* get the data */
result = usb_stor_bulk_transfer_buf (us, ipipe, fst, result = usb_stor_bulk_transfer_buf (us, ipipe, fst,
FCM_PACKET_LENGTH, &partial); FCM_STATUS_PACKET_LENGTH, &partial);
US_DEBUGP("bar Status result %d %u\n", result, partial); US_DEBUGP("bar Status result %d %u\n", result, partial);
if (result > USB_STOR_XFER_SHORT) if (result != USB_STOR_XFER_GOOD)
return USB_STOR_TRANSPORT_ERROR; return USB_STOR_TRANSPORT_ERROR;
US_DEBUG(pdump ((void *) fst, partial)); US_DEBUG(pdump ((void *) fst, partial));
...@@ -302,6 +303,9 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -302,6 +303,9 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
switch (us->srb->sc_data_direction) { switch (us->srb->sc_data_direction) {
case SCSI_DATA_READ: case SCSI_DATA_READ:
/* catch bogus "read 0 length" case */
if (!length)
break;
/* Make sure that the status indicates that the device /* Make sure that the status indicates that the device
* wants data as well. */ * wants data as well. */
if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) { if ((fst->Status & DRQ_STAT) == 0 || (fst->Reason & 3) != 2) {
...@@ -331,6 +335,9 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -331,6 +335,9 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
break; break;
case SCSI_DATA_WRITE: case SCSI_DATA_WRITE:
/* catch bogus "write 0 length" case */
if (!length)
break;
/* Make sure the status indicates that the device wants to /* Make sure the status indicates that the device wants to
* send us data. */ * send us data. */
/* !!IMPLEMENT!! */ /* !!IMPLEMENT!! */
...@@ -362,6 +369,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us) ...@@ -362,6 +369,7 @@ int freecom_transport(Scsi_Cmnd *srb, struct us_data *us)
break; break;
default: default:
/* should never hit here -- filtered in usb.c */
US_DEBUGP ("freecom unimplemented direction: %d\n", US_DEBUGP ("freecom unimplemented direction: %d\n",
us->srb->sc_data_direction); us->srb->sc_data_direction);
// Return fail, SCSI seems to handle this better. // Return fail, SCSI seems to handle this better.
......
...@@ -394,6 +394,12 @@ UNUSUAL_DEV( 0x0686, 0x4011, 0x0001, 0x0001, ...@@ -394,6 +394,12 @@ UNUSUAL_DEV( 0x0686, 0x4011, 0x0001, 0x0001,
"Dimage F300", "Dimage F300",
US_SC_SCSI, US_PR_BULK, NULL, 0 ), US_SC_SCSI, US_PR_BULK, NULL, 0 ),
/* Reported by Miguel A. Fosas <amn3s1a@ono.com> */
UNUSUAL_DEV( 0x0686, 0x4017, 0x0001, 0x0001,
"Minolta",
"DIMAGE E223",
US_SC_SCSI, US_PR_DEVICE, NULL, 0 ),
UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100, UNUSUAL_DEV( 0x0693, 0x0002, 0x0100, 0x0100,
"Hagiwara", "Hagiwara",
"FlashGate SmartMedia", "FlashGate SmartMedia",
...@@ -542,7 +548,7 @@ UNUSUAL_DEV( 0x07c4, 0xa400, 0x0000, 0xffff, ...@@ -542,7 +548,7 @@ UNUSUAL_DEV( 0x07c4, 0xa400, 0x0000, 0xffff,
* - They don't like the INQUIRY command. So we must handle this command * - They don't like the INQUIRY command. So we must handle this command
* of the SCSI layer ourselves. * of the SCSI layer ourselves.
*/ */
UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x9009, UNUSUAL_DEV( 0x07cf, 0x1001, 0x1000, 0x5009,
"Casio", "Casio",
"QV DigitalCamera", "QV DigitalCamera",
US_SC_8070, US_PR_CB, NULL, US_SC_8070, US_PR_CB, NULL,
......
...@@ -157,7 +157,10 @@ do { \ ...@@ -157,7 +157,10 @@ do { \
for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \ for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \
struct elf_phdr phdr = vsyscall_phdrs[i]; \ struct elf_phdr phdr = vsyscall_phdrs[i]; \
if (phdr.p_type == PT_LOAD) { \ if (phdr.p_type == PT_LOAD) { \
BUG_ON(ofs != 0); \
ofs = phdr.p_offset = offset; \ ofs = phdr.p_offset = offset; \
phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
phdr.p_filesz = phdr.p_memsz; \
offset += phdr.p_filesz; \ offset += phdr.p_filesz; \
} \ } \
else \ else \
...@@ -175,7 +178,7 @@ do { \ ...@@ -175,7 +178,7 @@ do { \
for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \ for (i = 0; i < VSYSCALL_EHDR->e_phnum; ++i) { \
if (vsyscall_phdrs[i].p_type == PT_LOAD) \ if (vsyscall_phdrs[i].p_type == PT_LOAD) \
DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \ DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
vsyscall_phdrs[i].p_filesz); \ PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
} \ } \
} while (0) } while (0)
......
...@@ -206,42 +206,46 @@ do { \ ...@@ -206,42 +206,46 @@ do { \
NEW_AUX_ENT(AT_SYSINFO_EHDR, (unsigned long) GATE_EHDR); \ NEW_AUX_ENT(AT_SYSINFO_EHDR, (unsigned long) GATE_EHDR); \
} while (0) } while (0)
/* /*
* These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out extra segments * These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
* containing the gate DSO contents. Dumping its contents makes post-mortem fully * extra segments containing the gate DSO contents. Dumping its
* interpretable later without matching up the same kernel and hardware config to see what * contents makes post-mortem fully interpretable later without matching up
* IP values meant. Dumping its extra ELF program headers includes all the other * the same kernel and hardware config to see what PC values meant.
* information a debugger needs to easily find how the gate DSO was being used. * Dumping its extra ELF program headers includes all the other information
* a debugger needs to easily find how the gate DSO was being used.
*/ */
#define ELF_CORE_EXTRA_PHDRS (GATE_EHDR->e_phnum) #define ELF_CORE_EXTRA_PHDRS (GATE_EHDR->e_phnum)
#define ELF_CORE_WRITE_EXTRA_PHDRS \ #define ELF_CORE_WRITE_EXTRA_PHDRS \
do { \ do { \
const struct elf_phdr *const gate_phdrs = \ const struct elf_phdr *const vsyscall_phdrs = \
(const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \ (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \
int i; \ int i; \
Elf64_Off ofs = 0; \ Elf32_Off ofs = 0; \
for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \ for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \
struct elf_phdr phdr = gate_phdrs[i]; \ struct elf_phdr phdr = vsyscall_phdrs[i]; \
if (phdr.p_type == PT_LOAD) { \ if (phdr.p_type == PT_LOAD) { \
BUG_ON(ofs != 0); \
ofs = phdr.p_offset = offset; \ ofs = phdr.p_offset = offset; \
phdr.p_memsz = PAGE_ALIGN(phdr.p_memsz); \
phdr.p_filesz = phdr.p_memsz; \
offset += phdr.p_filesz; \ offset += phdr.p_filesz; \
} else \ } \
else \
phdr.p_offset += ofs; \ phdr.p_offset += ofs; \
phdr.p_paddr = 0; /* match other core phdrs */ \ phdr.p_paddr = 0; /* match other core phdrs */ \
DUMP_WRITE(&phdr, sizeof(phdr)); \ DUMP_WRITE(&phdr, sizeof(phdr)); \
} \ } \
} while (0) } while (0)
#define ELF_CORE_WRITE_EXTRA_DATA \ #define ELF_CORE_WRITE_EXTRA_DATA \
do { \ do { \
const struct elf_phdr *const gate_phdrs = \ const struct elf_phdr *const vsyscall_phdrs = \
(const struct elf_phdr *) (GATE_ADDR \ (const struct elf_phdr *) (GATE_ADDR + GATE_EHDR->e_phoff); \
+ GATE_EHDR->e_phoff); \
int i; \ int i; \
for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \ for (i = 0; i < GATE_EHDR->e_phnum; ++i) { \
if (gate_phdrs[i].p_type == PT_LOAD) \ if (vsyscall_phdrs[i].p_type == PT_LOAD) \
DUMP_WRITE((void *) gate_phdrs[i].p_vaddr, \ DUMP_WRITE((void *) vsyscall_phdrs[i].p_vaddr, \
gate_phdrs[i].p_filesz); \ PAGE_ALIGN(vsyscall_phdrs[i].p_memsz)); \
} \ } \
} while (0) } while (0)
......
...@@ -1038,9 +1038,9 @@ void usb_show_string(struct usb_device *dev, char *id, int index); ...@@ -1038,9 +1038,9 @@ void usb_show_string(struct usb_device *dev, char *id, int index);
#define dbg(format, arg...) do {} while (0) #define dbg(format, arg...) do {} while (0)
#endif #endif
#define err(format, arg...) printk(KERN_ERR __FILE__ ": " format "\n" , ## arg) #define err(format, arg...) printk(KERN_ERR "%s: " format "\n" , __FILE__ , ## arg)
#define info(format, arg...) printk(KERN_INFO __FILE__ ": " format "\n" , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format "\n" , __FILE__ , ## arg)
#define warn(format, arg...) printk(KERN_WARNING __FILE__ ": " format "\n" , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format "\n" , __FILE__ , ## arg)
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
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