Commit c4f065a4 authored by Anton Blanchard's avatar Anton Blanchard

Merge samba.org:/scratch/anton/linux-2.5

into samba.org:/scratch/anton/sfr
parents 0f4680e3 13619430
These instructions are deliberately very basic. If you want something clever,
go read the real docs ;-) Please don't add more stuff, but feel free to
correct my mistakes ;-) (mbligh@aracnet.com)
Thanks to John Levon, Dave Hansen, et al. for help writing this.
<test> is the thing you're trying to measure.
Make sure you have the correct System.map / vmlinux referenced!
IMHO it's easier to use "make install" for linux and hack /sbin/installkernel
to copy config files, system.map, vmlinux to /boot.
Readprofile
-----------
You need a fixed readprofile command for 2.5 ... either get hold of
a current version from:
http://www.kernel.org/pub/linux/utils/util-linux/
or get readprofile binary fixed for 2.5 / akpm's 2.5 patch from
ftp://ftp.kernel.org/pub/linux/kernel/people/mbligh/tools/readprofile/
Add "profile=2" to the kernel command line.
clear readprofile -r
<test>
dump output readprofile -m /boot/System.map > captured_profile
Oprofile
--------
get source (I use 0.5) from http://oprofile.sourceforge.net/
add "idle=poll" to the kernel command line
Configure with CONFIG_PROFILING=y and CONFIG_OPROFILE=y & reboot on new kernel
./configure --with-kernel-support
make install
One time setup (pick appropriate one for your CPU):
P3 opcontrol --setup --vmlinux=/boot/vmlinux \
--ctr0-event=CPU_CLK_UNHALTED --ctr0-count=100000
Athlon/x86-64 opcontrol --setup --vmlinux=/boot/vmlinux \
--ctr0-event=RETIRED_INSNS --ctr0-count=100000
P4 opcontrol --setup --vmlinux=/boot/vmlinux \
--ctr0-event=GLOBAL_POWER_EVENTS \
--ctr0-unit-mask=1 --ctr0-count=100000
start daemon opcontrol --start-daemon
clear opcontrol --reset
start opcontrol --start
<test>
stop opcontrol --stop
dump output oprofpp -dl -i /boot/vmlinux > output_file
...@@ -488,7 +488,7 @@ config NR_CPUS ...@@ -488,7 +488,7 @@ config NR_CPUS
# Common NUMA Features # Common NUMA Features
config NUMA config NUMA
bool "Numa Memory Allocation Support" bool "Numa Memory Allocation Support"
depends on (HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))) depends on (HIGHMEM64G && (X86_NUMAQ || (X86_SUMMIT && ACPI && !ACPI_HT_ONLY))) || X86_PC
config DISCONTIGMEM config DISCONTIGMEM
bool bool
......
...@@ -68,6 +68,7 @@ EXPORT_SYMBOL(EISA_bus); ...@@ -68,6 +68,7 @@ EXPORT_SYMBOL(EISA_bus);
EXPORT_SYMBOL(MCA_bus); EXPORT_SYMBOL(MCA_bus);
#ifdef CONFIG_DISCONTIGMEM #ifdef CONFIG_DISCONTIGMEM
EXPORT_SYMBOL(node_data); EXPORT_SYMBOL(node_data);
EXPORT_SYMBOL(physnode_map);
#endif #endif
#ifdef CONFIG_X86_NUMAQ #ifdef CONFIG_X86_NUMAQ
EXPORT_SYMBOL(xquad_portio); EXPORT_SYMBOL(xquad_portio);
......
...@@ -31,8 +31,7 @@ ...@@ -31,8 +31,7 @@
#include <asm/numaq.h> #include <asm/numaq.h>
/* These are needed before the pgdat's are created */ /* These are needed before the pgdat's are created */
unsigned long node_start_pfn[MAX_NUMNODES]; extern long node_start_pfn[], node_end_pfn[];
unsigned long node_end_pfn[MAX_NUMNODES];
#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
...@@ -65,26 +64,6 @@ static void __init smp_dump_qct(void) ...@@ -65,26 +64,6 @@ static void __init smp_dump_qct(void)
} }
} }
/*
* -----------------------------------------
*
* functions related to physnode_map
*
* -----------------------------------------
*/
/*
* physnode_map keeps track of the physical memory layout of the
* numaq nodes on a 256Mb break (each element of the array will
* represent 256Mb of memory and will be marked by the node id. so,
* if the first gig is on node 0, and the second gig is on node 1
* physnode_map will contain:
* physnode_map[0-3] = 0;
* physnode_map[4-7] = 1;
* physnode_map[8- ] = -1;
*/
int physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
EXPORT_SYMBOL(physnode_map);
/* /*
* for each node mark the regions * for each node mark the regions
* TOPOFMEM = hi_shrd_mem_start + hi_shrd_mem_size * TOPOFMEM = hi_shrd_mem_start + hi_shrd_mem_size
......
...@@ -966,6 +966,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus) ...@@ -966,6 +966,7 @@ static void __init smp_boot_cpus(unsigned int max_cpus)
if (APIC_init_uniprocessor()) if (APIC_init_uniprocessor())
printk(KERN_NOTICE "Local APIC not detected." printk(KERN_NOTICE "Local APIC not detected."
" Using dummy APIC emulation.\n"); " Using dummy APIC emulation.\n");
map_cpu_to_logical_apicid();
return; return;
} }
......
...@@ -57,8 +57,7 @@ static int num_memory_chunks; /* total number of memory chunks */ ...@@ -57,8 +57,7 @@ static int num_memory_chunks; /* total number of memory chunks */
static int zholes_size_init; static int zholes_size_init;
static unsigned long zholes_size[MAX_NUMNODES * MAX_NR_ZONES]; static unsigned long zholes_size[MAX_NUMNODES * MAX_NR_ZONES];
unsigned long node_start_pfn[MAX_NUMNODES]; extern unsigned long node_start_pfn[], node_end_pfn[];
unsigned long node_end_pfn[MAX_NUMNODES];
extern void * boot_ioremap(unsigned long, unsigned long); extern void * boot_ioremap(unsigned long, unsigned long);
...@@ -182,30 +181,19 @@ static __init void chunk_to_zones(unsigned long cstart, unsigned long cend, ...@@ -182,30 +181,19 @@ static __init void chunk_to_zones(unsigned long cstart, unsigned long cend,
} }
} }
/* static void __init initialize_physnode_map(void)
* physnode_map keeps track of the physical memory layout of the
* numaq nodes on a 256Mb break (each element of the array will
* represent 256Mb of memory and will be marked by the node id. so,
* if the first gig is on node 0, and the second gig is on node 1
* physnode_map will contain:
* physnode_map[0-3] = 0;
* physnode_map[4-7] = 1;
* physnode_map[8- ] = -1;
*/
int pfnnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
EXPORT_SYMBOL(pfnnode_map);
static void __init initialize_pfnnode_map(void)
{ {
unsigned long topofchunk, cur = 0;
int i; int i;
unsigned long pfn;
for (i = 0; i < num_memory_chunks; i++) { struct node_memory_chunk_s *nmcp;
cur = node_memory_chunk[i].start_pfn;
topofchunk = node_memory_chunk[i].end_pfn; /* Run the list of memory chunks and fill in the phymap. */
while (cur < topofchunk) { nmcp = node_memory_chunk;
pfnnode_map[PFN_TO_ELEMENT(cur)] = node_memory_chunk[i].nid; for (i = num_memory_chunks; --i >= 0; nmcp++) {
cur ++; for (pfn = nmcp->start_pfn; pfn <= nmcp->end_pfn;
pfn += PAGES_PER_ELEMENT)
{
physnode_map[pfn / PAGES_PER_ELEMENT] = (int)nmcp->nid;
} }
} }
} }
...@@ -272,7 +260,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) ...@@ -272,7 +260,7 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
for (i = 0; i < num_memory_chunks; i++) for (i = 0; i < num_memory_chunks; i++)
node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm]; node_memory_chunk[i].nid = pxm_to_nid_map[node_memory_chunk[i].pxm];
initialize_pfnnode_map(); initialize_physnode_map();
printk("pxm bitmap: "); printk("pxm bitmap: ");
for (i = 0; i < sizeof(pxm_bitmap); i++) { for (i = 0; i < sizeof(pxm_bitmap); i++) {
......
...@@ -36,11 +36,36 @@ ...@@ -36,11 +36,36 @@
struct pglist_data *node_data[MAX_NUMNODES]; struct pglist_data *node_data[MAX_NUMNODES];
bootmem_data_t node0_bdata; bootmem_data_t node0_bdata;
/*
* numa interface - we expect the numa architecture specfic code to have
* populated the following initialisation.
*
* 1) numnodes - the total number of nodes configured in the system
* 2) physnode_map - the mapping between a pfn and owning node
* 3) node_start_pfn - the starting page frame number for a node
* 3) node_end_pfn - the ending page fram number for a node
*/
/*
* physnode_map keeps track of the physical memory layout of a generic
* numa node on a 256Mb break (each element of the array will
* represent 256Mb of memory and will be marked by the node id. so,
* if the first gig is on node 0, and the second gig is on node 1
* physnode_map will contain:
*
* physnode_map[0-3] = 0;
* physnode_map[4-7] = 1;
* physnode_map[8- ] = -1;
*/
u8 physnode_map[MAX_ELEMENTS] = { [0 ... (MAX_ELEMENTS - 1)] = -1};
unsigned long node_start_pfn[MAX_NUMNODES];
unsigned long node_end_pfn[MAX_NUMNODES];
extern unsigned long find_max_low_pfn(void); extern unsigned long find_max_low_pfn(void);
extern void find_max_pfn(void); extern void find_max_pfn(void);
extern void one_highpage_init(struct page *, int, int); extern void one_highpage_init(struct page *, int, int);
extern unsigned long node_start_pfn[], node_end_pfn[];
extern struct e820map e820; extern struct e820map e820;
extern char _end; extern char _end;
extern unsigned long highend_pfn, highstart_pfn; extern unsigned long highend_pfn, highstart_pfn;
...@@ -56,6 +81,36 @@ unsigned long node_remap_offset[MAX_NUMNODES]; ...@@ -56,6 +81,36 @@ unsigned long node_remap_offset[MAX_NUMNODES];
void *node_remap_start_vaddr[MAX_NUMNODES]; void *node_remap_start_vaddr[MAX_NUMNODES];
void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags); void set_pmd_pfn(unsigned long vaddr, unsigned long pfn, pgprot_t flags);
/*
* FLAT - support for basic PC memory model with discontig enabled, essentially
* a single node with all available processors in it with a flat
* memory map.
*/
void __init get_memcfg_numa_flat(void)
{
int pfn;
printk("NUMA - single node, flat memory mode\n");
/* Run the memory configuration and find the top of memory. */
find_max_pfn();
node_start_pfn[0] = 0;
node_end_pfn[0] = max_pfn;
/* Fill in the physnode_map with our simplistic memory model,
* all memory is in node 0.
*/
for (pfn = node_start_pfn[0]; pfn <= node_end_pfn[0];
pfn += PAGES_PER_ELEMENT)
{
physnode_map[pfn / PAGES_PER_ELEMENT] = 0;
}
/* Indicate there is one node available. */
node_set_online(0);
numnodes = 1;
}
/* /*
* Find the highest page frame number we have available for the node * Find the highest page frame number we have available for the node
*/ */
......
...@@ -39,9 +39,11 @@ CONFIG_SMP=y ...@@ -39,9 +39,11 @@ CONFIG_SMP=y
# CONFIG_PREEMPT is not set # CONFIG_PREEMPT is not set
CONFIG_NR_CPUS=4 CONFIG_NR_CPUS=4
CONFIG_CPU_FREQ=y CONFIG_CPU_FREQ=y
CONFIG_CPU_FREQ_PROC_INTF=y
CONFIG_CPU_FREQ_TABLE=y CONFIG_CPU_FREQ_TABLE=y
CONFIG_US3_FREQ=m CONFIG_US3_FREQ=m
CONFIG_CPU_FREQ_PROC_INTF=y
CONFIG_CPU_FREQ_GOV_USERSPACE=m
# CONFIG_CPU_FREQ_24_API is not set
CONFIG_SPARC64=y CONFIG_SPARC64=y
CONFIG_HOTPLUG=y CONFIG_HOTPLUG=y
CONFIG_HAVE_DEC_LOCK=y CONFIG_HAVE_DEC_LOCK=y
...@@ -354,6 +356,8 @@ CONFIG_INET_ESP=y ...@@ -354,6 +356,8 @@ CONFIG_INET_ESP=y
CONFIG_XFRM_USER=m CONFIG_XFRM_USER=m
CONFIG_IPV6=m CONFIG_IPV6=m
CONFIG_IPV6_PRIVACY=y CONFIG_IPV6_PRIVACY=y
CONFIG_INET6_AH=m
CONFIG_INET6_ESP=m
# #
# SCTP Configuration (EXPERIMENTAL) # SCTP Configuration (EXPERIMENTAL)
...@@ -872,6 +876,7 @@ CONFIG_USB_HIDINPUT=y ...@@ -872,6 +876,7 @@ CONFIG_USB_HIDINPUT=y
CONFIG_USB_HIDDEV=y CONFIG_USB_HIDDEV=y
# CONFIG_USB_AIPTEK is not set # CONFIG_USB_AIPTEK is not set
CONFIG_USB_WACOM=m CONFIG_USB_WACOM=m
CONFIG_USB_KBTAB=m
# CONFIG_USB_POWERMATE is not set # CONFIG_USB_POWERMATE is not set
# CONFIG_USB_XPAD is not set # CONFIG_USB_XPAD is not set
...@@ -928,6 +933,7 @@ CONFIG_USB_SERIAL_EDGEPORT=m ...@@ -928,6 +933,7 @@ CONFIG_USB_SERIAL_EDGEPORT=m
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set # CONFIG_USB_SERIAL_EDGEPORT_TI is not set
CONFIG_USB_SERIAL_KEYSPAN_PDA=m CONFIG_USB_SERIAL_KEYSPAN_PDA=m
CONFIG_USB_SERIAL_KEYSPAN=m CONFIG_USB_SERIAL_KEYSPAN=m
# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set # CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set # CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set # CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
...@@ -938,6 +944,7 @@ CONFIG_USB_SERIAL_KEYSPAN=m ...@@ -938,6 +944,7 @@ CONFIG_USB_SERIAL_KEYSPAN=m
# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set # CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set # CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set # CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set
# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
CONFIG_USB_SERIAL_KLSI=m CONFIG_USB_SERIAL_KLSI=m
# CONFIG_USB_SERIAL_KOBIL_SCT is not set # CONFIG_USB_SERIAL_KOBIL_SCT is not set
CONFIG_USB_SERIAL_MCT_U232=m CONFIG_USB_SERIAL_MCT_U232=m
......
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/cdrom.h> #include <linux/cdrom.h>
#include <linux/loop.h> #include <linux/loop.h>
#include <linux/auto_fs.h> #include <linux/auto_fs.h>
#include <linux/auto_fs4.h>
#include <linux/devfs_fs.h> #include <linux/devfs_fs.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
...@@ -4850,6 +4851,7 @@ COMPATIBLE_IOCTL(AUTOFS_IOC_FAIL) ...@@ -4850,6 +4851,7 @@ COMPATIBLE_IOCTL(AUTOFS_IOC_FAIL)
COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC) COMPATIBLE_IOCTL(AUTOFS_IOC_CATATONIC)
COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER) COMPATIBLE_IOCTL(AUTOFS_IOC_PROTOVER)
COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE) COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE)
COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI)
/* DEVFS */ /* DEVFS */
COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV) COMPATIBLE_IOCTL(DEVFSDIOC_GET_PROTO_REV)
COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK) COMPATIBLE_IOCTL(DEVFSDIOC_SET_EVENT_MASK)
......
...@@ -78,20 +78,6 @@ static int __init find_device_prom_node(struct pci_pbm_info *pbm, ...@@ -78,20 +78,6 @@ static int __init find_device_prom_node(struct pci_pbm_info *pbm,
return 0; return 0;
} }
/* Remove a PCI device from the device trees, then
* free it up. Note that this must run before
* the device's resources are registered because we
* do not handle unregistering them here.
*/
static void pci_device_delete(struct pci_dev *pdev)
{
list_del(&pdev->global_list);
list_del(&pdev->bus_list);
/* Ok, all references are gone, free it up. */
kfree(pdev);
}
/* Older versions of OBP on PCI systems encode 64-bit MEM /* Older versions of OBP on PCI systems encode 64-bit MEM
* space assignments incorrectly, this fixes them up. We also * space assignments incorrectly, this fixes them up. We also
* take the opportunity here to hide other kinds of bogus * take the opportunity here to hide other kinds of bogus
...@@ -164,7 +150,7 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm, ...@@ -164,7 +150,7 @@ static void __init pdev_cookie_fillin(struct pci_pbm_info *pbm,
* second EBUS/HappyMeal pair if the external * second EBUS/HappyMeal pair if the external
* connector for it is not present. * connector for it is not present.
*/ */
pci_device_delete(pdev); pci_remove_bus_device(pdev);
return; return;
} }
......
...@@ -1137,17 +1137,17 @@ void smp_percpu_timer_interrupt(struct pt_regs *regs) ...@@ -1137,17 +1137,17 @@ void smp_percpu_timer_interrupt(struct pt_regs *regs)
do { do {
sparc64_do_profile(regs); sparc64_do_profile(regs);
if (!--prof_counter(cpu)) { if (!--prof_counter(cpu)) {
if (cpu == boot_cpu_id) { irq_enter();
irq_enter();
if (cpu == boot_cpu_id) {
kstat_cpu(cpu).irqs[0]++; kstat_cpu(cpu).irqs[0]++;
timer_tick_interrupt(regs); timer_tick_interrupt(regs);
irq_exit();
} }
update_process_times(user); update_process_times(user);
irq_exit();
prof_counter(cpu) = prof_multiplier(cpu); prof_counter(cpu) = prof_multiplier(cpu);
} }
......
/* /*
* AMD 766/768 TCO Timer Driver * AMD 766/768 TCO Timer Driver
* (c) Copyright 2002 Zwane Mwaikambo <zwane@commfireservices.com> * (c) Copyright 2002 Zwane Mwaikambo <zwane@holomorphy.com>
* All Rights Reserved. * All Rights Reserved.
* *
* Parts from; * Parts from;
...@@ -34,35 +34,48 @@ ...@@ -34,35 +34,48 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/pci.h> #include <linux/pci.h>
#define AMDTCO_MODULE_VER "build 20020601" #define AMDTCO_MODULE_VER "build 20021116"
#define AMDTCO_MODULE_NAME "amd7xx_tco" #define AMDTCO_MODULE_NAME "amd7xx_tco"
#define PFX AMDTCO_MODULE_NAME ": " #define PFX AMDTCO_MODULE_NAME ": "
#define MAX_TIMEOUT 38 /* max of 38 seconds */ #define MAX_TIMEOUT 38 /* max of 38 seconds, although the system will only
* reset itself after the second timeout */
/* pmbase registers */ /* pmbase registers */
#define GLOBAL_SMI_REG 0x2a
#define TCO_EN (1 << 1) /* bit 1 in global SMI register */
#define TCO_RELOAD_REG 0x40 /* bits 0-5 are current count, 6-7 are reserved */ #define TCO_RELOAD_REG 0x40 /* bits 0-5 are current count, 6-7 are reserved */
#define TCO_INITVAL_REG 0x41 /* bits 0-5 are value to load, 6-7 are reserved */ #define TCO_INITVAL_REG 0x41 /* bits 0-5 are value to load, 6-7 are reserved */
#define TCO_TIMEOUT_MASK 0x3f #define TCO_TIMEOUT_MASK 0x3f
#define TCO_STATUS1_REG 0x44
#define TCO_STATUS2_REG 0x46 #define TCO_STATUS2_REG 0x46
#define NDTO_STS2 (1 << 1) /* we're interested in the second timeout */ #define NDTO_STS2 (1 << 1) /* we're interested in the second timeout */
#define BOOT_STS (1 << 2) /* will be set if NDTO_STS2 was set before reboot */ #define BOOT_STS (1 << 2) /* will be set if NDTO_STS2 was set before reboot */
#define TCO_CTRL1_REG 0x48 #define TCO_CTRL1_REG 0x48
#define TCO_HALT (1 << 11) #define TCO_HALT (1 << 11)
#define NO_REBOOT (1 << 10) /* in DevB:3x48 */
static char banner[] __initdata = KERN_INFO PFX AMDTCO_MODULE_VER; static char banner[] __initdata = KERN_INFO PFX AMDTCO_MODULE_VER "\n";
static int timeout = 38; static int timeout = MAX_TIMEOUT;
static u32 pmbase; /* PMxx I/O base */ static u32 pmbase; /* PMxx I/O base */
static struct pci_dev *dev; static struct pci_dev *dev;
static struct semaphore open_sem; static struct semaphore open_sem;
spinlock_t amdtco_lock; /* only for device access */ static spinlock_t amdtco_lock; /* only for device access */
static int expect_close = 0; static int expect_close = 0;
MODULE_PARM(timeout, "i"); MODULE_PARM(timeout, "i");
MODULE_PARM_DESC(timeout, "range is 0-38 seconds, default is 38"); MODULE_PARM_DESC(timeout, "range is 0-38 seconds, default is 38");
static inline u8 seconds_to_ticks(int seconds)
{
/* the internal timer is stored as ticks which decrement
* every 0.6 seconds */
return (seconds * 10) / 6;
}
static inline int ticks_to_seconds(u8 ticks)
{
return (ticks * 6) / 10;
}
static inline int amdtco_status(void) static inline int amdtco_status(void)
{ {
u16 reg; u16 reg;
...@@ -81,28 +94,19 @@ static inline int amdtco_status(void) ...@@ -81,28 +94,19 @@ static inline int amdtco_status(void)
static inline void amdtco_ping(void) static inline void amdtco_ping(void)
{ {
u8 reg; outb(1, pmbase+TCO_RELOAD_REG);
spin_lock(&amdtco_lock);
reg = inb(pmbase+TCO_RELOAD_REG);
outb(1 | reg, pmbase+TCO_RELOAD_REG);
spin_unlock(&amdtco_lock);
} }
static inline int amdtco_gettimeout(void) static inline int amdtco_gettimeout(void)
{ {
return inb(TCO_RELOAD_REG) & TCO_TIMEOUT_MASK; u8 reg = inb(pmbase+TCO_RELOAD_REG) & TCO_TIMEOUT_MASK;
return ticks_to_seconds(reg);
} }
static inline void amdtco_settimeout(unsigned int timeout) static inline void amdtco_settimeout(unsigned int timeout)
{ {
u8 reg; u8 reg = seconds_to_ticks(timeout) & TCO_TIMEOUT_MASK;
spin_lock(&amdtco_lock);
reg = inb(pmbase+TCO_INITVAL_REG);
reg |= timeout & TCO_TIMEOUT_MASK;
outb(reg, pmbase+TCO_INITVAL_REG); outb(reg, pmbase+TCO_INITVAL_REG);
spin_unlock(&amdtco_lock);
} }
static inline void amdtco_global_enable(void) static inline void amdtco_global_enable(void)
...@@ -110,9 +114,12 @@ static inline void amdtco_global_enable(void) ...@@ -110,9 +114,12 @@ static inline void amdtco_global_enable(void)
u16 reg; u16 reg;
spin_lock(&amdtco_lock); spin_lock(&amdtco_lock);
reg = inw(pmbase+GLOBAL_SMI_REG);
reg |= TCO_EN; /* clear NO_REBOOT on DevB:3x48 p97 */
outw(reg, pmbase+GLOBAL_SMI_REG); pci_read_config_word(dev, 0x48, &reg);
reg &= ~NO_REBOOT;
pci_write_config_word(dev, 0x48, reg);
spin_unlock(&amdtco_lock); spin_unlock(&amdtco_lock);
} }
...@@ -146,10 +153,12 @@ static int amdtco_fop_open(struct inode *inode, struct file *file) ...@@ -146,10 +153,12 @@ static int amdtco_fop_open(struct inode *inode, struct file *file)
if (timeout > MAX_TIMEOUT) if (timeout > MAX_TIMEOUT)
timeout = MAX_TIMEOUT; timeout = MAX_TIMEOUT;
amdtco_disable();
amdtco_settimeout(timeout); amdtco_settimeout(timeout);
amdtco_global_enable(); amdtco_global_enable();
amdtco_enable();
amdtco_ping(); amdtco_ping();
printk(KERN_INFO PFX "Watchdog enabled, timeout = %d/%d seconds", printk(KERN_INFO PFX "Watchdog enabled, timeout = %ds of %ds\n",
amdtco_gettimeout(), timeout); amdtco_gettimeout(), timeout);
return 0; return 0;
...@@ -198,7 +207,7 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int ...@@ -198,7 +207,7 @@ static int amdtco_fop_ioctl(struct inode *inode, struct file *file, unsigned int
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(amdtco_gettimeout(), (int *)arg); return put_user(amdtco_gettimeout(), (int *)arg);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (copy_from_user(&tmp, (int *)arg, sizeof tmp)) if (copy_from_user(&tmp, (int *)arg, sizeof tmp))
return -EFAULT; return -EFAULT;
...@@ -221,7 +230,7 @@ static int amdtco_fop_release(struct inode *inode, struct file *file) ...@@ -221,7 +230,7 @@ static int amdtco_fop_release(struct inode *inode, struct file *file)
printk(KERN_INFO PFX "Watchdog disabled\n"); printk(KERN_INFO PFX "Watchdog disabled\n");
} else { } else {
amdtco_ping(); amdtco_ping();
printk(KERN_CRIT PFX "Unexpected close!, timeout in %d seconds)\n", timeout); printk(KERN_CRIT PFX "Unexpected close!, timeout in %d seconds\n", timeout);
} }
up(&open_sem); up(&open_sem);
...@@ -249,10 +258,9 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len, ...@@ -249,10 +258,9 @@ static ssize_t amdtco_fop_write(struct file *file, const char *data, size_t len,
} }
#endif #endif
amdtco_ping(); amdtco_ping();
return len;
} }
return 0; return len;
} }
...@@ -357,6 +365,9 @@ static int __init amdtco_setup(char *str) ...@@ -357,6 +365,9 @@ static int __init amdtco_setup(char *str)
if (ints[0] > 0) if (ints[0] > 0)
timeout = ints[1]; timeout = ints[1];
if (!timeout || timeout > MAX_TIMEOUT)
timeout = MAX_TIMEOUT;
return 1; return 1;
} }
...@@ -366,8 +377,7 @@ __setup("amd7xx_tco=", amdtco_setup); ...@@ -366,8 +377,7 @@ __setup("amd7xx_tco=", amdtco_setup);
module_init(amdtco_init); module_init(amdtco_init);
module_exit(amdtco_exit); module_exit(amdtco_exit);
MODULE_AUTHOR("Zwane Mwaikambo <zwane@commfireservices.com>"); MODULE_AUTHOR("Zwane Mwaikambo <zwane@holomorphy.com>");
MODULE_DESCRIPTION("AMD 766/768 TCO Timer Driver"); MODULE_DESCRIPTION("AMD 766/768 TCO Timer Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_NO_SYMBOLS;
...@@ -343,12 +343,16 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev, ...@@ -343,12 +343,16 @@ static int __devinit b1pci_pci_probe(struct pci_dev *pdev,
static void __devexit b1pci_pci_remove(struct pci_dev *pdev) static void __devexit b1pci_pci_remove(struct pci_dev *pdev)
{ {
#ifdef CONFIG_ISDN_DRV_AVMB1_B1PCIV4
avmcard *card = pci_get_drvdata(pdev); avmcard *card = pci_get_drvdata(pdev);
if (card->dma) if (card->dma)
b1pciv4_remove(pdev); b1pciv4_remove(pdev);
else else
b1pci_remove(pdev); b1pci_remove(pdev);
#else
b1pci_remove(pdev);
#endif
} }
static struct pci_driver b1pci_pci_driver = { static struct pci_driver b1pci_pci_driver = {
......
This diff is collapsed.
...@@ -231,6 +231,51 @@ static struct card_ops asuscom_ipac_ops = { ...@@ -231,6 +231,51 @@ static struct card_ops asuscom_ipac_ops = {
.irq_func = ipac_irq, .irq_func = ipac_irq,
}; };
static int __init
asuscom_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{
int rc;
u8 val;
printk(KERN_INFO "ISDNLink: defined at %#lx IRQ %lu\n",
card->para[1], card->para[0]);
cs->hw.asus.cfg_reg = card->para[1];
cs->irq = card->para[0];
rc = -EBUSY;
if (!request_io(&cs->rs, cs->hw.asus.cfg_reg, 8, "asuscom isdn"))
goto err;
rc = -ENODEV;
cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_IPAC_ALE;
val = readreg(cs, cs->hw.asus.cfg_reg + ASUS_IPAC_DATA, IPAC_ID);
if ((val == 1) || (val == 2)) {
cs->subtyp = ASUS_IPAC;
cs->card_ops = &asuscom_ipac_ops;
cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
} else {
cs->subtyp = ASUS_ISACHSCX;
cs->card_ops = &asuscom_ops;
cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_ADR;
cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_ISAC;
cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_HSCX;
cs->hw.asus.u7 = cs->hw.asus.cfg_reg + ASUS_CTRL_U7;
cs->hw.asus.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
printk(KERN_INFO "ISDNLink: resetting card\n");
cs->card_ops->reset(cs);
return 0;
err:
hisax_release_resources(cs);
return rc;
}
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id asus_ids[] __initdata = { static struct isapnp_device_id asus_ids[] __initdata = {
{ ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688), { ISAPNP_VENDOR('A', 'S', 'U'), ISAPNP_FUNCTION(0x1688),
...@@ -255,9 +300,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL; ...@@ -255,9 +300,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL;
int __init int __init
setup_asuscom(struct IsdnCard *card) setup_asuscom(struct IsdnCard *card)
{ {
int bytecnt;
struct IsdnCardState *cs = card->cs;
u8 val;
char tmp[64]; char tmp[64];
strcpy(tmp, Asuscom_revision); strcpy(tmp, Asuscom_revision);
...@@ -310,36 +352,7 @@ setup_asuscom(struct IsdnCard *card) ...@@ -310,36 +352,7 @@ setup_asuscom(struct IsdnCard *card)
} }
} }
#endif #endif
bytecnt = 8; if (asuscom_probe(card->cs, card) < 0)
cs->hw.asus.cfg_reg = card->para[1]; return 0;
cs->irq = card->para[0];
if (!request_io(&cs->rs, cs->hw.asus.cfg_reg, bytecnt, "asuscom isdn"))
goto err;
printk(KERN_INFO "ISDNLink: defined at 0x%x IRQ %d\n",
cs->hw.asus.cfg_reg, cs->irq);
cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_IPAC_ALE;
val = readreg(cs, cs->hw.asus.cfg_reg + ASUS_IPAC_DATA, IPAC_ID);
if ((val == 1) || (val == 2)) {
cs->subtyp = ASUS_IPAC;
cs->card_ops = &asuscom_ipac_ops;
cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_IPAC_DATA;
if (ipac_setup(cs, &ipac_dc_ops, &ipac_bc_ops))
goto err;
} else {
cs->subtyp = ASUS_ISACHSCX;
cs->card_ops = &asuscom_ops;
cs->hw.asus.adr = cs->hw.asus.cfg_reg + ASUS_ADR;
cs->hw.asus.isac = cs->hw.asus.cfg_reg + ASUS_ISAC;
cs->hw.asus.hscx = cs->hw.asus.cfg_reg + ASUS_HSCX;
cs->hw.asus.u7 = cs->hw.asus.cfg_reg + ASUS_CTRL_U7;
cs->hw.asus.pots = cs->hw.asus.cfg_reg + ASUS_CTRL_POTS;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err;
}
printk(KERN_INFO "ISDNLink: resetting card\n");
cs->card_ops->reset(cs);
return 1; return 1;
err:
hisax_release_resources(cs);
return 0;
} }
...@@ -160,16 +160,16 @@ static struct card_ops avm_a1_ops = { ...@@ -160,16 +160,16 @@ static struct card_ops avm_a1_ops = {
.irq_func = avm_a1_interrupt, .irq_func = avm_a1_interrupt,
}; };
int __init static int __init
setup_avm_a1(struct IsdnCard *card) avm_a1_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{ {
int rc;
u8 val; u8 val;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, avm_revision); printk(KERN_INFO "AVM A1: defined at %#lx IRQ %lu\n",
printk(KERN_INFO "HiSax: AVM driver Rev. %s\n", HiSax_getrev(tmp)); card->para[1], card->para[0]);
rc = -EBUSY;
cs->hw.avm.cfg_reg = request_io(&cs->rs, card->para[1] + 0x1800, 8, "avm cfg"); cs->hw.avm.cfg_reg = request_io(&cs->rs, card->para[1] + 0x1800, 8, "avm cfg");
if (!cs->hw.avm.cfg_reg) goto err; if (!cs->hw.avm.cfg_reg) goto err;
cs->hw.avm.isac = request_io(&cs->rs, card->para[1] + 0x1400, 32, "HiSax isac"); cs->hw.avm.isac = request_io(&cs->rs, card->para[1] + 0x1400, 32, "HiSax isac");
...@@ -216,23 +216,24 @@ setup_avm_a1(struct IsdnCard *card) ...@@ -216,23 +216,24 @@ setup_avm_a1(struct IsdnCard *card)
printk(KERN_INFO "AVM A1: Byte at %x is %x\n", printk(KERN_INFO "AVM A1: Byte at %x is %x\n",
cs->hw.avm.cfg_reg, val); cs->hw.avm.cfg_reg, val);
printk(KERN_INFO
"HiSax: %s config irq:%d cfg:0x%X\n",
CardType[cs->typ], cs->irq,
cs->hw.avm.cfg_reg);
printk(KERN_INFO
"HiSax: isac:0x%X/0x%X\n",
cs->hw.avm.isac + 32, cs->hw.avm.isacfifo);
printk(KERN_INFO
"HiSax: hscx A:0x%X/0x%X hscx B:0x%X/0x%X\n",
cs->hw.avm.hscx[0] + 32, cs->hw.avm.hscxfifo[0],
cs->hw.avm.hscx[1] + 32, cs->hw.avm.hscxfifo[1]);
cs->card_ops = &avm_a1_ops; cs->card_ops = &avm_a1_ops;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops)) if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err; goto err;
return 1; return 0;
err: err:
hisax_release_resources(cs); hisax_release_resources(cs);
return 0; return rc;
}
int __init
setup_avm_a1(struct IsdnCard *card)
{
char tmp[64];
strcpy(tmp, avm_revision);
printk(KERN_INFO "HiSax: AVM driver Rev. %s\n", HiSax_getrev(tmp));
if (avm_a1_probe(card->cs, card) < 0)
return 0;
return 1;
} }
...@@ -215,20 +215,13 @@ static struct card_ops avm_a1p_ops = { ...@@ -215,20 +215,13 @@ static struct card_ops avm_a1p_ops = {
.irq_func = avm_a1p_interrupt, .irq_func = avm_a1p_interrupt,
}; };
int __devinit static int __init
setup_avm_a1_pcmcia(struct IsdnCard *card) avm_a1p_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{ {
u8 model, vers; u8 model, vers;
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, avm_revision);
printk(KERN_INFO "HiSax: AVM A1 PCMCIA driver Rev. %s\n",
HiSax_getrev(tmp));
cs->hw.avm.cfg_reg = card->para[1];
cs->irq = card->para[0]; cs->irq = card->para[0];
cs->hw.avm.cfg_reg = card->para[1];
outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0); outb(cs->hw.avm.cfg_reg+ASL1_OFFSET, ASL1_W_ENABLE_S0);
...@@ -244,11 +237,26 @@ setup_avm_a1_pcmcia(struct IsdnCard *card) ...@@ -244,11 +237,26 @@ setup_avm_a1_pcmcia(struct IsdnCard *card)
vers = bytein(cs->hw.avm.cfg_reg+VERREG_OFFSET); vers = bytein(cs->hw.avm.cfg_reg+VERREG_OFFSET);
printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n", printk(KERN_INFO "AVM A1 PCMCIA: io 0x%x irq %d model %d version %d\n",
cs->hw.avm.cfg_reg, cs->irq, model, vers); cs->hw.avm.cfg_reg, cs->irq, model, vers);
cs->card_ops = &avm_a1p_ops; cs->card_ops = &avm_a1p_ops;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops)) if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
return 0; goto err;
return 0;
err:
hisax_release_resources(cs);
return -EBUSY;
}
int __devinit
setup_avm_a1_pcmcia(struct IsdnCard *card)
{
char tmp[64];
strcpy(tmp, avm_revision);
printk(KERN_INFO "HiSax: AVM A1 PCMCIA driver Rev. %s\n",
HiSax_getrev(tmp));
if (avm_a1p_probe(card->cs, card))
return 0;
return 1; return 1;
} }
...@@ -497,7 +497,7 @@ static struct bc_l1_ops hdlc_l1_ops = { ...@@ -497,7 +497,7 @@ static struct bc_l1_ops hdlc_l1_ops = {
.close = close_hdlcstate, .close = close_hdlcstate,
}; };
void __init static void __init
inithdlc(struct IsdnCardState *cs) inithdlc(struct IsdnCardState *cs)
{ {
u_int val; u_int val;
...@@ -596,6 +596,82 @@ static struct card_ops avm_pci_ops = { ...@@ -596,6 +596,82 @@ static struct card_ops avm_pci_ops = {
.irq_func = avm_pcipnp_interrupt, .irq_func = avm_pcipnp_interrupt,
}; };
static int __init
avm_pcipnp_hw_init(struct IsdnCardState *cs)
{
cs->bc_hw_ops = &hdlc_hw_ops;
cs->bc_l1_ops = &hdlc_l1_ops;
cs->card_ops = &avm_pci_ops;
avm_pcipnp_reset(cs);
return isac_setup(cs, &isac_ops);
}
static int __init
avm_pci_probe(struct IsdnCardState *cs, struct pci_dev *pdev)
{
int rc;
u32 val;
printk(KERN_INFO "AVM PCI: defined at %#lx IRQ %u\n",
pci_resource_start(pdev, 1), pdev->irq);
rc = -EBUSY;
if (pci_enable_device(pdev))
goto err;
cs->subtyp = AVM_FRITZ_PCI;
cs->irq = pdev->irq;
cs->irq_flags |= SA_SHIRQ;
cs->hw.avm.cfg_reg = pci_resource_start(pdev, 1);
cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
if (!request_io(&cs->rs, cs->hw.avm.cfg_reg, 32, "avm PCI"))
goto err;
val = inl(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM PCI: stat %#x\n", val);
printk(KERN_INFO "AVM PCI: Class %X Rev %d\n",
val & 0xff, (val>>8) & 0xff);
if (avm_pcipnp_hw_init(cs))
goto err;
return 0;
err:
hisax_release_resources(cs);
return rc;
}
static int __init
avm_pnp_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{
int rc;
u8 val, ver;
printk(KERN_INFO "AVM PnP: defined at %#lx IRQ %lu\n",
card->para[1], card->para[0]);
cs->subtyp = AVM_FRITZ_PNP;
cs->irq = card->para[0];
cs->hw.avm.cfg_reg = card->para[1];
cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
rc = -EBUSY;
if (!request_io(&cs->rs, cs->hw.avm.cfg_reg, 32, "avm PnP"))
goto err;
val = inb(cs->hw.avm.cfg_reg);
ver = inb(cs->hw.avm.cfg_reg + 1);
printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver);
if (avm_pcipnp_hw_init(cs))
goto err;
return 0;
err:
hisax_release_resources(cs);
return rc;
}
static struct pci_dev *dev_avm __initdata = NULL; static struct pci_dev *dev_avm __initdata = NULL;
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct pnp_card *card_avm __initdata = NULL; static struct pnp_card *card_avm __initdata = NULL;
...@@ -605,17 +681,15 @@ static struct pnp_dev *pnp_avm __initdata = NULL; ...@@ -605,17 +681,15 @@ static struct pnp_dev *pnp_avm __initdata = NULL;
int __init int __init
setup_avm_pcipnp(struct IsdnCard *card) setup_avm_pcipnp(struct IsdnCard *card)
{ {
u_int val, ver;
struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
strcpy(tmp, avm_pci_rev); strcpy(tmp, avm_pci_rev);
printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: AVM PCI driver Rev. %s\n", HiSax_getrev(tmp));
if (card->para[1]) { if (card->para[1]) {
/* old manual method */ /* old manual method */
cs->hw.avm.cfg_reg = card->para[1]; if (avm_pnp_probe(card->cs, card))
cs->irq = card->para[0]; return 0;
cs->subtyp = AVM_FRITZ_PNP; return 1;
} else { } else {
#ifdef __ISAPNP__ #ifdef __ISAPNP__
if (isapnp_present()) { if (isapnp_present()) {
...@@ -647,69 +721,24 @@ setup_avm_pcipnp(struct IsdnCard *card) ...@@ -647,69 +721,24 @@ setup_avm_pcipnp(struct IsdnCard *card)
pnp_device_detach(pnp_avm); pnp_device_detach(pnp_avm);
return(0); return(0);
} }
cs->hw.avm.cfg_reg = pnp_port_start(pnp_avm, 0); card->para[1] = pnp_port_start(pnp_avm, 0);
cs->irq = pnp_irq(pnp_avm, 0); card->para[0] = pnp_irq(pnp_avm, 0);
cs->subtyp = AVM_FRITZ_PNP; if (avm_pnp_probe(card->cs, card))
goto ready; return 0;
return 1;
} }
} }
} else {
printk(KERN_INFO "FritzPnP: no ISA PnP present\n");
} }
#endif #endif
#if CONFIG_PCI #if CONFIG_PCI
if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM, if ((dev_avm = pci_find_device(PCI_VENDOR_ID_AVM,
PCI_DEVICE_ID_AVM_A1, dev_avm))) { PCI_DEVICE_ID_AVM_A1, dev_avm))) {
cs->irq = dev_avm->irq; if (avm_pci_probe(card->cs, dev_avm))
if (!cs->irq) { return 0;
printk(KERN_ERR "FritzPCI: No IRQ for PCI card found\n"); return 1;
return(0);
}
if (pci_enable_device(dev_avm))
return(0);
cs->hw.avm.cfg_reg = pci_resource_start(dev_avm, 1);
if (!cs->hw.avm.cfg_reg) {
printk(KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n");
return(0);
}
cs->subtyp = AVM_FRITZ_PCI;
} else {
printk(KERN_WARNING "FritzPCI: No PCI card found\n");
return(0);
} }
cs->irq_flags |= SA_SHIRQ;
#endif /* CONFIG_PCI */ #endif /* CONFIG_PCI */
} }
ready: printk(KERN_WARNING "FritzPCI: No card found\n");
cs->hw.avm.isac = cs->hw.avm.cfg_reg + 0x10;
if (!request_io(&cs->rs, cs->hw.avm.cfg_reg, 32,
cs->subtyp == AVM_FRITZ_PCI ? "avm PCI" : "avm PnP"))
goto err;
switch (cs->subtyp) {
case AVM_FRITZ_PCI:
val = inl(cs->hw.avm.cfg_reg);
printk(KERN_INFO "AVM PCI: stat %#x\n", val);
printk(KERN_INFO "AVM PCI: Class %X Rev %d\n",
val & 0xff, (val>>8) & 0xff);
break;
case AVM_FRITZ_PNP:
val = inb(cs->hw.avm.cfg_reg);
ver = inb(cs->hw.avm.cfg_reg + 1);
printk(KERN_INFO "AVM PnP: Class %X Rev %d\n", val, ver);
avm_pcipnp_reset(cs);
break;
}
printk(KERN_INFO "HiSax: %s config irq:%d base:0x%X\n",
(cs->subtyp == AVM_FRITZ_PCI) ? "AVM Fritz!PCI" : "AVM Fritz!PnP",
cs->irq, cs->hw.avm.cfg_reg);
cs->bc_hw_ops = &hdlc_hw_ops;
cs->bc_l1_ops = &hdlc_l1_ops;
cs->card_ops = &avm_pci_ops;
isac_setup(cs, &isac_ops);
return 1;
err:
hisax_release_resources(cs);
return 0; return 0;
} }
...@@ -21,11 +21,11 @@ ...@@ -21,11 +21,11 @@
#include "bkm_ax.h" #include "bkm_ax.h"
extern const char *CardType[]; extern const char *CardType[];
// FIXME needs per card lock
static spinlock_t bkm_a4t_lock = SPIN_LOCK_UNLOCKED; static spinlock_t bkm_a4t_lock = SPIN_LOCK_UNLOCKED;
const char *bkm_a4t_revision = "$Revision: 1.13.6.6 $"; const char *bkm_a4t_revision = "$Revision: 1.13.6.6 $";
static inline u8 static inline u8
readreg(unsigned int ale, unsigned long adr, u8 off) readreg(unsigned int ale, unsigned long adr, u8 off)
{ {
...@@ -249,15 +249,57 @@ static struct card_ops bkm_a4t_ops = { ...@@ -249,15 +249,57 @@ static struct card_ops bkm_a4t_ops = {
.irq_func = bkm_interrupt, .irq_func = bkm_interrupt,
}; };
static int __init
bkm_a4t_probe(struct IsdnCardState *cs, struct pci_dev *pdev)
{
I20_REGISTER_FILE *pI20_Regs;
int rc;
printk(KERN_INFO "BKM A4T: defined at %#lx IRQ %u\n",
pci_resource_start(pdev, 0), pdev->irq);
rc = -EBUSY;
if (pci_enable_device(pdev))
goto err;
cs->irq = pdev->irq;
cs->irq_flags |= SA_SHIRQ;
cs->hw.avm.cfg_reg = pci_resource_start(pdev, 1);
cs->hw.ax.base = (unsigned long)request_mmio(&cs->rs, pci_resource_start(pdev, 0), 4096, "Telekom A4T");
if (!cs->hw.ax.base)
goto err;
/* Check suspicious address */
// FIXME needs to use read[bl]
pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
if ((pI20_Regs->i20IntStatus & 0x8EFFFFFF) != 0) {
printk(KERN_WARNING "HiSax: address %lx suspicious\n",
cs->hw.ax.base);
goto err;
}
cs->hw.ax.isac_adr = cs->hw.ax.base + PO_OFFSET;
cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET;
cs->hw.ax.isac_ale = GCS_1;
cs->hw.ax.jade_ale = GCS_3;
reset_bkm(cs);
cs->card_ops = &bkm_a4t_ops;
isac_setup(cs, &isac_ops);
jade_setup(cs, &jade_ops);
return 0;
err:
hisax_release_resources(cs);
return rc;
}
static struct pci_dev *dev_a4t __initdata = NULL; static struct pci_dev *dev_a4t __initdata = NULL;
int __init int __init
setup_bkm_a4t(struct IsdnCard *card) setup_bkm_a4t(struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
u_int pci_memaddr = 0, found = 0;
I20_REGISTER_FILE *pI20_Regs;
strcpy(tmp, bkm_a4t_revision); strcpy(tmp, bkm_a4t_revision);
printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
...@@ -268,49 +310,13 @@ setup_bkm_a4t(struct IsdnCard *card) ...@@ -268,49 +310,13 @@ setup_bkm_a4t(struct IsdnCard *card)
sub_vendor = dev_a4t->subsystem_vendor; sub_vendor = dev_a4t->subsystem_vendor;
sub_sys = dev_a4t->subsystem_device; sub_sys = dev_a4t->subsystem_device;
if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) { if (sub_sys == PCI_DEVICE_ID_BERKOM_A4T &&
if (pci_enable_device(dev_a4t)) sub_vendor == PCI_VENDOR_ID_BERKOM) {
return(0); if (bkm_a4t_probe(card->cs, dev_a4t))
found = 1; return 0;
pci_memaddr = pci_resource_start(dev_a4t, 0); return 1;
cs->irq = dev_a4t->irq;
break;
} }
} }
if (!found) { printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]); return 0;
return (0);
}
if (!cs->irq) { /* IRQ range check ?? */
printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]);
return (0);
}
cs->hw.ax.base = (unsigned long)request_mmio(&cs->rs,pci_memaddr, 4096, "Telekom A4T");
if (!cs->hw.ax.base) {
printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
return (0);
}
/* Check suspecious address */
pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
if ((pI20_Regs->i20IntStatus & 0x8EFFFFFF) != 0) {
printk(KERN_WARNING "HiSax: %s address %lx-%lx suspecious\n",
CardType[card->typ], cs->hw.ax.base, cs->hw.ax.base + 4096);
hisax_release_resources(cs);
return (0);
}
cs->hw.ax.isac_adr = cs->hw.ax.base + PO_OFFSET;
cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET;
cs->hw.ax.isac_ale = GCS_1;
cs->hw.ax.jade_ale = GCS_3;
printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n",
CardType[card->typ], cs->hw.ax.base, cs->irq);
reset_bkm(cs);
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &bkm_a4t_ops;
isac_setup(cs, &isac_ops);
jade_setup(cs, &jade_ops);
return 1;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -263,13 +263,65 @@ static struct card_ops enpci_ops = { ...@@ -263,13 +263,65 @@ static struct card_ops enpci_ops = {
.irq_func = enpci_interrupt, .irq_func = enpci_interrupt,
}; };
static int __init
enpci_probe(struct IsdnCardState *cs, struct pci_dev *pdev)
{
if (pci_enable_device(pdev))
goto err;
cs->irq = pdev->irq;
cs->irq_flags |= SA_SHIRQ;
cs->hw.njet.base = pci_resource_start(pdev, 0);
if (!request_io(&cs->rs, cs->hw.njet.base, 0x100, "Fn_ISDN"))
goto err;
cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
/* Reset an */
cs->hw.njet.ctrl_reg = 0x07; // gendert von 0xff
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
/* 50 ms Pause */
schedule_timeout((50*HZ)/1000);
cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
cs->hw.njet.auxd = 0x00; // war 0xc0
cs->hw.njet.dmactrl = 0;
OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ);
OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ);
OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd);
printk(KERN_INFO
"enter:now PCI: PCI card configured at 0x%lx IRQ %d\n",
cs->hw.njet.base, cs->irq);
reset_enpci(cs);
cs->hw.njet.last_is0 = 0;
cs->hw.njet.bc_activate = enpci_bc_activate;
cs->hw.njet.bc_deactivate = enpci_bc_deactivate;
amd7930_setup(cs, &amd7930_ops, &enpci_setIrqMask);
cs->card_ops = &enpci_ops;
return 0;
err:
hisax_release_resources(cs);
return -EBUSY;
}
static struct pci_dev *dev_netjet __initdata = NULL; static struct pci_dev *dev_netjet __initdata = NULL;
/* called by config.c */ /* called by config.c */
int __init int __init
setup_enternow_pci(struct IsdnCard *card) setup_enternow_pci(struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
...@@ -278,72 +330,22 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -278,72 +330,22 @@ setup_enternow_pci(struct IsdnCard *card)
strcpy(tmp, enternow_pci_rev); strcpy(tmp, enternow_pci_rev);
printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp)); printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
for ( ;; ) { dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET, PCI_DEVICE_ID_TIGERJET_300, dev_netjet);
PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) { if (dev_netjet) {
if (pci_enable_device(dev_netjet)) if (dev_netjet->subsystem_vendor != 0x55 ||
return(0); dev_netjet->subsystem_device != 0x02) {
cs->irq = dev_netjet->irq; printk(KERN_WARNING "enter:now: You tried to load "
if (!cs->irq) { "this driver with an incompatible "
printk(KERN_WARNING "enter:now PCI: No IRQ for PCI card found\n"); "TigerJet-card\n");
return(0); printk(KERN_WARNING "Use type=20 for Traverse "
} "NetJet PCI Card.\n");
cs->hw.njet.base = pci_resource_start(dev_netjet, 0); return 0;
if (!cs->hw.njet.base) {
printk(KERN_WARNING "enter:now PCI: No IO-Adr for PCI card found\n");
return(0);
}
/* checks Sub-Vendor ID because system crashes with Traverse-Card */
if ((dev_netjet->subsystem_vendor != 0x55) ||
(dev_netjet->subsystem_device != 0x02)) {
printk(KERN_WARNING "enter:now: You tried to load this driver with an incompatible TigerJet-card\n");
printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
return(0);
}
} else {
printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
return(0);
} }
if (enpci_probe(card->cs, dev_netjet))
cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; return 1;
cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
/* Reset an */
cs->hw.njet.ctrl_reg = 0x07; // gendert von 0xff
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
/* 50 ms Pause */
schedule_timeout((50*HZ)/1000);
cs->hw.njet.ctrl_reg = 0x30; /* Reset Off and status read clear */
OutByte(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg);
set_current_state(TASK_UNINTERRUPTIBLE);
schedule_timeout((10*HZ)/1000); /* Timeout 10ms */
cs->hw.njet.auxd = 0x00; // war 0xc0
cs->hw.njet.dmactrl = 0;
OutByte(cs->hw.njet.base + NETJET_AUXCTRL, ~TJ_AMD_IRQ);
OutByte(cs->hw.njet.base + NETJET_IRQMASK1, TJ_AMD_IRQ);
OutByte(cs->hw.njet.auxa, cs->hw.njet.auxd);
break;
}
printk(KERN_INFO
"enter:now PCI: PCI card configured at 0x%lx IRQ %d\n",
cs->hw.njet.base, cs->irq);
if (!request_io(&cs->rs, cs->hw.njet.base, 0x100, "Fn_ISDN"))
return 0; return 0;
reset_enpci(cs); }
cs->hw.njet.last_is0 = 0; printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
cs->hw.njet.bc_activate = enpci_bc_activate; return 0;
cs->hw.njet.bc_deactivate = enpci_bc_deactivate;
amd7930_setup(cs, &amd7930_ops, &enpci_setIrqMask);
cs->irq_flags |= SA_SHIRQ;
cs->card_ops = &enpci_ops;
return 1;
} }
This diff is collapsed.
...@@ -1382,72 +1382,41 @@ static struct card_ops hfcpci_ops = { ...@@ -1382,72 +1382,41 @@ static struct card_ops hfcpci_ops = {
}; };
/* this variable is used as card index when more than one cards are present */ static int __init
static struct pci_dev *dev_hfcpci __initdata = NULL; niccy_pci_probe(struct IsdnCardState *cs, struct pci_dev *pdev, int i)
int __init
setup_hfcpci(struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs; int rc;
char tmp[64];
int i;
struct pci_dev *tmp_hfcpci = NULL;
strcpy(tmp, hfcpci_revision); rc = -EBUSY;
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp)); if (pci_enable_device(pdev))
cs->hw.hfcpci.int_s1 = 0; goto err;
cs->dc.hfcpci.ph_state = 0;
cs->hw.hfcpci.fifo = 255;
i = 0; pci_set_master(pdev);
while (id_list[i].vendor_id) {
tmp_hfcpci = pci_find_device(id_list[i].vendor_id, cs->irq = pdev->irq;
id_list[i].device_id, cs->irq_flags |= SA_SHIRQ;
dev_hfcpci); cs->hw.hfcpci.pdev = pdev;
i++;
if (tmp_hfcpci) { cs->hw.hfcpci.pci_io = request_mmio(&cs->rs,
if (pci_enable_device(tmp_hfcpci)) pci_resource_start(pdev, 1), 128,
continue; "hfc_pci");
pci_set_master(tmp_hfcpci); if (!cs->hw.hfcpci.pci_io)
if ((card->para[0]) && (card->para[0] != (tmp_hfcpci->resource[ 0].start & PCI_BASE_ADDRESS_IO_MASK))) goto err;
continue;
else
break;
}
}
if (tmp_hfcpci) {
i--;
dev_hfcpci = tmp_hfcpci; /* old device */
cs->irq = dev_hfcpci->irq;
cs->hw.hfcpci.pdev = tmp_hfcpci;
if (!cs->irq) {
printk(KERN_WARNING "HFC-PCI: No IRQ for PCI card found\n");
return (0);
}
printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s card name: %s\n", id_list[i].vendor_name, id_list[i].card_name);
} else {
printk(KERN_WARNING "HFC-PCI: No PCI card found\n");
return (0);
}
/* Allocate memory for FIFOS */ /* Allocate memory for FIFOS */
cs->hw.hfcpci.fifos = pci_alloc_consistent(tmp_hfcpci, 32768, &cs->hw.hfcpci.fifos_dma); rc = -ENOMEM;
if (!cs->hw.hfcpci.fifos) { cs->hw.hfcpci.fifos = pci_alloc_consistent(pdev, 32768,
printk(KERN_WARNING "HFC-PCI: Error allocating memory for FIFO!\n"); &cs->hw.hfcpci.fifos_dma);
return 0; if (!cs->hw.hfcpci.fifos)
} goto err;
pci_write_config_dword(cs->hw.hfcpci.pdev, 0x80, pci_write_config_dword(cs->hw.hfcpci.pdev, 0x80,
(u_int)cs->hw.hfcpci.fifos_dma); (u_int)cs->hw.hfcpci.fifos_dma);
cs->hw.hfcpci.pci_io = request_mmio(&cs->rs, dev_hfcpci->resource[ 1].start, 256, "hfc_pci"); printk(KERN_INFO "HiSax: HFC-PCI card manufacturer: %s name: %s\n",
if (!cs->hw.hfcpci.pci_io) id_list[i].vendor_name, id_list[i].card_name);
goto err; printk(KERN_INFO "HFC-PCI: defined at mem %#x fifo %#x(%#x) IRQ %d\n",
(u_int) cs->hw.hfcpci.pci_io, (u_int) cs->hw.hfcpci.fifos,
printk(KERN_INFO (u_int) cs->hw.hfcpci.fifos_dma, cs->irq);
"HFC-PCI: defined at mem %#x fifo %#x(%#x) IRQ %d HZ %d\n",
(u_int) cs->hw.hfcpci.pci_io,
(u_int) cs->hw.hfcpci.fifos,
(u_int) cs->hw.hfcpci.fifos_dma,
cs->irq, HZ);
printk("ChipID: %x\n", Read_hfc(cs, HFCPCI_CHIP_ID)); printk("ChipID: %x\n", Read_hfc(cs, HFCPCI_CHIP_ID));
cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */ cs->hw.hfcpci.int_m2 = 0; /* disable alle interrupts */
cs->hw.hfcpci.int_m1 = 0; cs->hw.hfcpci.int_m1 = 0;
...@@ -1456,17 +1425,46 @@ setup_hfcpci(struct IsdnCard *card) ...@@ -1456,17 +1425,46 @@ setup_hfcpci(struct IsdnCard *card)
/* At this point the needed PCI config is done */ /* At this point the needed PCI config is done */
/* fifos are still not enabled */ /* fifos are still not enabled */
cs->irq_flags |= SA_SHIRQ; init_timer(&cs->hw.hfcpci.timer);
cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer; cs->hw.hfcpci.timer.function = (void *) hfcpci_Timer;
cs->hw.hfcpci.timer.data = (long) cs; cs->hw.hfcpci.timer.data = (long) cs;
init_timer(&cs->hw.hfcpci.timer);
hfcpci_reset(cs); hfcpci_reset(cs);
cs->auxcmd = &hfcpci_auxcmd; cs->auxcmd = &hfcpci_auxcmd;
cs->card_ops = &hfcpci_ops; cs->card_ops = &hfcpci_ops;
return 1; return 0;
err: err:
hisax_release_resources(cs); hisax_release_resources(cs);
return -EBUSY;
}
/* this variable is used as card index when more than one cards are present */
static struct pci_dev *dev_hfcpci __initdata = NULL;
int __init
setup_hfcpci(struct IsdnCard *card)
{
struct IsdnCardState *cs = card->cs;
char tmp[64];
int i;
struct pci_dev *tmp_hfcpci = NULL;
strcpy(tmp, hfcpci_revision);
printk(KERN_INFO "HiSax: HFC-PCI driver Rev. %s\n", HiSax_getrev(tmp));
cs->hw.hfcpci.int_s1 = 0;
cs->dc.hfcpci.ph_state = 0;
cs->hw.hfcpci.fifo = 255;
for (i = 0; id_list[i].vendor_id; i++) {
tmp_hfcpci = pci_find_device(id_list[i].vendor_id,
id_list[i].device_id,
dev_hfcpci);
if (!tmp_hfcpci)
continue;
if (niccy_pci_probe(card->cs, tmp_hfcpci, i) < 0)
return 0;
return 1;
}
return 0; return 0;
} }
...@@ -1159,6 +1159,74 @@ static struct card_ops hfcsx_ops = { ...@@ -1159,6 +1159,74 @@ static struct card_ops hfcsx_ops = {
.irq_func = hfcsx_interrupt, .irq_func = hfcsx_interrupt,
}; };
static int __init
hfcsx_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{
int rc;
char c;
cs->irq = card->para[0];
cs->hw.hfcsx.base = card->para[1] & 0xfffe;
cs->hw.hfcsx.fifo = 255;
cs->hw.hfcsx.int_s1 = 0;
cs->dc.hfcsx.ph_state = 0;
rc = -EBUSY;
if (!request_io(&cs->rs, cs->hw.hfcsx.base, 2, "HFCSX isdn"))
goto err;
rc = -ENODEV;
byteout(cs->hw.hfcsx.base, cs->hw.hfcsx.base & 0xFF);
byteout(cs->hw.hfcsx.base + 1, ((cs->hw.hfcsx.base >> 8) & 3) | 0x54);
udelay(10);
cs->hw.hfcsx.chip = Read_hfc(cs,HFCSX_CHIP_ID);
switch (cs->hw.hfcsx.chip >> 4) {
case 1:
c ='+';
break;
case 9:
c ='P';
break;
default:
printk(KERN_WARNING "HFC-SX: invalid chip id 0x%x\n",
cs->hw.hfcsx.chip >> 4);
goto err;
}
if (!ccd_sp_irqtab[cs->irq & 0xF]) {
printk(KERN_WARNING "HFC_SX: invalid irq %d specified\n",
cs->irq & 0xF);
goto err;
}
rc = -ENOMEM;
cs->hw.hfcsx.extra = kmalloc(sizeof(struct hfcsx_extra), GFP_ATOMIC);
if (!cs->hw.hfcsx.extra) {
printk(KERN_WARNING "HFC-SX: unable to allocate memory\n");
goto err;
}
printk(KERN_INFO "HFC-S%c chip detected at base 0x%x IRQ %d\n",
c, (u_int) cs->hw.hfcsx.base, cs->irq);
cs->hw.hfcsx.int_m2 = 0; /* disable alle interrupts */
cs->hw.hfcsx.int_m1 = 0;
Write_hfc(cs, HFCSX_INT_M1, cs->hw.hfcsx.int_m1);
Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
init_timer(&cs->hw.hfcsx.timer);
cs->hw.hfcsx.timer.function = (void *) hfcsx_Timer;
cs->hw.hfcsx.timer.data = (long) cs;
cs->hw.hfcsx.b_fifo_size = 0; /* fifo size still unknown */
cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not eval. */
hfcsx_reset(cs);
cs->auxcmd = &hfcsx_auxcmd;
cs->card_ops = &hfcsx_ops;
return 0;
err:
hisax_release_resources(cs);
return rc;
}
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id hfc_ids[] __initdata = { static struct isapnp_device_id hfc_ids[] __initdata = {
{ ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620), { ISAPNP_VENDOR('T', 'A', 'G'), ISAPNP_FUNCTION(0x2620),
...@@ -1174,7 +1242,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL; ...@@ -1174,7 +1242,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL;
int __devinit int __devinit
setup_hfcsx(struct IsdnCard *card) setup_hfcsx(struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
strcpy(tmp, hfcsx_revision); strcpy(tmp, hfcsx_revision);
...@@ -1227,62 +1294,7 @@ setup_hfcsx(struct IsdnCard *card) ...@@ -1227,62 +1294,7 @@ setup_hfcsx(struct IsdnCard *card)
} }
} }
#endif #endif
cs->hw.hfcsx.base = card->para[1] & 0xfffe; if (hfcsx_probe(card->cs, card) < 0)
cs->irq = card->para[0];
cs->hw.hfcsx.int_s1 = 0;
cs->dc.hfcsx.ph_state = 0;
cs->hw.hfcsx.fifo = 255;
if (!request_io(&cs->rs, cs->hw.hfcsx.base, 2, "HFCSX isdn"))
return 0; return 0;
byteout(cs->hw.hfcsx.base, cs->hw.hfcsx.base & 0xFF);
byteout(cs->hw.hfcsx.base + 1,
((cs->hw.hfcsx.base >> 8) & 3) | 0x54);
udelay(10);
cs->hw.hfcsx.chip = Read_hfc(cs,HFCSX_CHIP_ID);
switch (cs->hw.hfcsx.chip >> 4) {
case 1:
tmp[0] ='+';
break;
case 9:
tmp[0] ='P';
break;
default:
printk(KERN_WARNING "HFC-SX: invalid chip id 0x%x\n",
cs->hw.hfcsx.chip >> 4);
hisax_release_resources(cs);
return 0;
}
if (!ccd_sp_irqtab[cs->irq & 0xF]) {
printk(KERN_WARNING "HFC_SX: invalid irq %d specified\n",
cs->irq & 0xF);
hisax_release_resources(cs);
return 0;
}
cs->hw.hfcsx.extra = kmalloc(sizeof(struct hfcsx_extra),
GFP_ATOMIC);
if (!cs->hw.hfcsx.extra) {
hisax_release_resources(cs);
printk(KERN_WARNING "HFC-SX: unable to allocate memory\n");
return 0;
}
printk(KERN_INFO "HFC-S%c chip detected at base 0x%x IRQ %d HZ %d\n",
tmp[0], (u_int) cs->hw.hfcsx.base,
cs->irq, HZ);
cs->hw.hfcsx.int_m2 = 0; /* disable alle interrupts */
cs->hw.hfcsx.int_m1 = 0;
Write_hfc(cs, HFCSX_INT_M1, cs->hw.hfcsx.int_m1);
Write_hfc(cs, HFCSX_INT_M2, cs->hw.hfcsx.int_m2);
cs->hw.hfcsx.timer.function = (void *) hfcsx_Timer;
cs->hw.hfcsx.timer.data = (long) cs;
cs->hw.hfcsx.b_fifo_size = 0; /* fifo size still unknown */
cs->hw.hfcsx.cirm = ccd_sp_irqtab[cs->irq & 0xF]; /* RAM not evaluated */
init_timer(&cs->hw.hfcsx.timer);
hfcsx_reset(cs);
cs->auxcmd = &hfcsx_auxcmd;
cs->card_ops = &hfcsx_ops;
return 1; return 1;
} }
...@@ -133,6 +133,50 @@ static struct card_ops hfcs_ops = { ...@@ -133,6 +133,50 @@ static struct card_ops hfcs_ops = {
.irq_func = hfcs_interrupt, .irq_func = hfcs_interrupt,
}; };
static int __init
hfcs_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{
cs->irq = card->para[0];
cs->hw.hfcD.addr = card->para[1];
if (!request_io(&cs->rs, cs->hw.hfcD.addr, 2, "HFCS isdn"))
goto err;
printk(KERN_INFO "HFCS: defined at 0x%x IRQ %d\n",
cs->hw.hfcD.addr, cs->irq);
cs->hw.hfcD.cip = 0;
cs->hw.hfcD.int_s1 = 0;
cs->hw.hfcD.send = NULL;
cs->bcs[0].hw.hfc.send = NULL;
cs->bcs[1].hw.hfc.send = NULL;
cs->hw.hfcD.dfifosize = 512;
cs->dc.hfcd.ph_state = 0;
cs->hw.hfcD.fifo = 255;
if (cs->typ == ISDN_CTYPE_TELES3C) {
cs->hw.hfcD.bfifosize = 1024 + 512;
/* Teles 16.3c IO ADR is 0x200 | YY0U (YY Bit 15/14 address) */
outb(0x00, cs->hw.hfcD.addr);
outb(0x56, cs->hw.hfcD.addr | 1);
} else if (cs->typ == ISDN_CTYPE_ACERP10) {
cs->hw.hfcD.bfifosize = 7*1024 + 512;
/* Acer P10 IO ADR is 0x300 */
outb(0x00, cs->hw.hfcD.addr);
outb(0x57, cs->hw.hfcD.addr | 1);
}
set_cs_func(cs);
init_timer(&cs->hw.hfcD.timer);
cs->hw.hfcD.timer.function = (void *) hfcs_Timer;
cs->hw.hfcD.timer.data = (long) cs;
hfcs_reset(cs);
cs->card_ops = &hfcs_ops;
return 0;
err:
hisax_release_resources(cs);
return -EBUSY;
}
#ifdef __ISAPNP__ #ifdef __ISAPNP__
static struct isapnp_device_id hfc_ids[] __initdata = { static struct isapnp_device_id hfc_ids[] __initdata = {
{ ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114), { ISAPNP_VENDOR('A', 'N', 'X'), ISAPNP_FUNCTION(0x1114),
...@@ -166,7 +210,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL; ...@@ -166,7 +210,6 @@ static struct pnp_card *pnp_c __devinitdata = NULL;
int __init int __init
setup_hfcs(struct IsdnCard *card) setup_hfcs(struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
char tmp[64]; char tmp[64];
strcpy(tmp, hfcs_revision); strcpy(tmp, hfcs_revision);
...@@ -220,42 +263,8 @@ setup_hfcs(struct IsdnCard *card) ...@@ -220,42 +263,8 @@ setup_hfcs(struct IsdnCard *card)
} }
} }
#endif #endif
cs->hw.hfcD.addr = card->para[1] & 0xfffe; if (hfcs_probe(card->cs, card) < 0)
cs->irq = card->para[0];
cs->hw.hfcD.cip = 0;
cs->hw.hfcD.int_s1 = 0;
cs->hw.hfcD.send = NULL;
cs->bcs[0].hw.hfc.send = NULL;
cs->bcs[1].hw.hfc.send = NULL;
cs->hw.hfcD.dfifosize = 512;
cs->dc.hfcd.ph_state = 0;
cs->hw.hfcD.fifo = 255;
if (cs->typ == ISDN_CTYPE_TELES3C) {
cs->hw.hfcD.bfifosize = 1024 + 512;
} else if (cs->typ == ISDN_CTYPE_ACERP10) {
cs->hw.hfcD.bfifosize = 7*1024 + 512;
} else
return (0);
if (!request_io(&cs->rs, cs->hw.hfcD.addr, 2, "HFCS isdn"))
return 0; return 0;
printk(KERN_INFO return 1;
"HFCS: defined at 0x%x IRQ %d HZ %d\n",
cs->hw.hfcD.addr,
cs->irq, HZ);
if (cs->typ == ISDN_CTYPE_TELES3C) {
/* Teles 16.3c IO ADR is 0x200 | YY0U (YY Bit 15/14 address) */
outb(0x00, cs->hw.hfcD.addr);
outb(0x56, cs->hw.hfcD.addr | 1);
} else if (cs->typ == ISDN_CTYPE_ACERP10) {
/* Acer P10 IO ADR is 0x300 */
outb(0x00, cs->hw.hfcD.addr);
outb(0x57, cs->hw.hfcD.addr | 1);
}
set_cs_func(cs);
cs->hw.hfcD.timer.function = (void *) hfcs_Timer;
cs->hw.hfcD.timer.data = (long) cs;
init_timer(&cs->hw.hfcD.timer);
hfcs_reset(cs);
cs->card_ops = &hfcs_ops;
return (1);
} }
...@@ -782,7 +782,6 @@ struct bkm_hw { ...@@ -782,7 +782,6 @@ struct bkm_hw {
struct gazel_hw { struct gazel_hw {
unsigned int cfg_reg; unsigned int cfg_reg;
unsigned int pciaddr[2];
signed int ipac; signed int ipac;
signed int isac; signed int isac;
signed int hscx[2]; signed int hscx[2];
...@@ -1073,264 +1072,17 @@ hisax_release_resources(struct IsdnCardState *cs); ...@@ -1073,264 +1072,17 @@ hisax_release_resources(struct IsdnCardState *cs);
#define ISDN_CTYPE_COUNT 41 #define ISDN_CTYPE_COUNT 41
#ifdef ISDN_CHIP_ISAC
#undef ISDN_CHIP_ISAC
#endif
#ifdef CONFIG_HISAX_16_0
#define CARD_TELES0 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_TELES0 0
#endif
#ifdef CONFIG_HISAX_16_3
#define CARD_TELES3 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_TELES3 0
#endif
#ifdef CONFIG_HISAX_TELESPCI
#define CARD_TELESPCI 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_TELESPCI 0
#endif
#ifdef CONFIG_HISAX_AVM_A1
#define CARD_AVM_A1 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_AVM_A1 0
#endif
#ifdef CONFIG_HISAX_AVM_A1_PCMCIA
#define CARD_AVM_A1_PCMCIA 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_AVM_A1_PCMCIA 0
#endif
#ifdef CONFIG_HISAX_FRITZPCI
#define CARD_FRITZPCI 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_FRITZPCI 0
#endif
#ifdef CONFIG_HISAX_ELSA
#define CARD_ELSA 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_ELSA 0
#endif
#ifdef CONFIG_HISAX_IX1MICROR2
#define CARD_IX1MICROR2 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_IX1MICROR2 0
#endif
#ifdef CONFIG_HISAX_DIEHLDIVA
#define CARD_DIEHLDIVA 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_DIEHLDIVA 0
#endif
#ifdef CONFIG_HISAX_ASUSCOM
#define CARD_ASUSCOM 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_ASUSCOM 0
#endif
#ifdef CONFIG_HISAX_TELEINT
#define CARD_TELEINT 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_TELEINT 0
#endif
#ifdef CONFIG_HISAX_SEDLBAUER
#define CARD_SEDLBAUER 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_SEDLBAUER 0
#endif
#ifdef CONFIG_HISAX_SPORTSTER
#define CARD_SPORTSTER 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_SPORTSTER 0
#endif
#ifdef CONFIG_HISAX_MIC
#define CARD_MIC 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_MIC 0
#endif
#ifdef CONFIG_HISAX_NETJET
#define CARD_NETJET_S 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_NETJET_S 0
#endif
#ifdef CONFIG_HISAX_HFCS
#define CARD_HFCS 1
#else
#define CARD_HFCS 0
#endif
#ifdef CONFIG_HISAX_HFC_PCI
#define CARD_HFC_PCI 1
#else
#define CARD_HFC_PCI 0
#endif
#ifdef CONFIG_HISAX_HFC_SX
#define CARD_HFC_SX 1
#else
#define CARD_HFC_SX 0
#endif
#ifdef CONFIG_HISAX_AMD7930
#define CARD_AMD7930 1
#else
#define CARD_AMD7930 0
#endif
#ifdef CONFIG_HISAX_NICCY
#define CARD_NICCY 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_NICCY 0
#endif
#ifdef CONFIG_HISAX_ISURF
#define CARD_ISURF 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_ISURF 0
#endif
#ifdef CONFIG_HISAX_S0BOX
#define CARD_S0BOX 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_S0BOX 0
#endif
#ifdef CONFIG_HISAX_HSTSAPHIR
#define CARD_HSTSAPHIR 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_HSTSAPHIR 0
#endif
#ifdef CONFIG_HISAX_TESTEMU #ifdef CONFIG_HISAX_TESTEMU
#define CARD_TESTEMU 1
#define ISDN_CTYPE_TESTEMU 99 #define ISDN_CTYPE_TESTEMU 99
#undef ISDN_CTYPE_COUNT #undef ISDN_CTYPE_COUNT
#define ISDN_CTYPE_COUNT ISDN_CTYPE_TESTEMU #define ISDN_CTYPE_COUNT ISDN_CTYPE_TESTEMU
#else
#define CARD_TESTEMU 0
#endif
#ifdef CONFIG_HISAX_BKM_A4T
#define CARD_BKM_A4T 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_BKM_A4T 0
#endif
#ifdef CONFIG_HISAX_SCT_QUADRO
#define CARD_SCT_QUADRO 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_SCT_QUADRO 0
#endif
#ifdef CONFIG_HISAX_GAZEL
#define CARD_GAZEL 1
#ifndef ISDN_CHIP_ISAC
#define ISDN_CHIP_ISAC 1
#endif
#else
#define CARD_GAZEL 0
#endif
#ifdef CONFIG_HISAX_W6692
#define CARD_W6692 1
#ifndef ISDN_CHIP_W6692
#define ISDN_CHIP_W6692 1
#endif
#else
#define CARD_W6692 0
#endif #endif
#ifdef CONFIG_HISAX_NETJET_U #ifdef CONFIG_HISAX_NETJET_U
#define CARD_NETJET_U 1
#ifndef ISDN_CHIP_ICC
#define ISDN_CHIP_ICC 1
#endif
#ifndef HISAX_UINTERFACE #ifndef HISAX_UINTERFACE
#define HISAX_UINTERFACE 1 #define HISAX_UINTERFACE 1
#endif #endif
#else #else
#define CARD_NETJET_U 0
#endif
#ifdef CONFIG_HISAX_ENTERNOW_PCI
#define CARD_FN_ENTERNOW_PCI 1
#endif #endif
#define TEI_PER_CARD 1 #define TEI_PER_CARD 1
...@@ -1402,7 +1154,7 @@ int jiftime(char *s, long mark); ...@@ -1402,7 +1154,7 @@ int jiftime(char *s, long mark);
int HiSax_command(isdn_ctrl * ic); int HiSax_command(isdn_ctrl * ic);
int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb); int HiSax_writebuf_skb(int id, int chan, int ack, struct sk_buff *skb);
void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...); void HiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, ...);
void VHiSax_putstatus(struct IsdnCardState *cs, char *head, char *fmt, va_list args); void VHiSax_putstatus(struct IsdnCardState *cs, char *head, const char *fmt, va_list args);
void HiSax_reportcard(int cardnr, int sel); void HiSax_reportcard(int cardnr, int sel);
int QuickHex(char *txt, u8 * p, int cnt); int QuickHex(char *txt, u8 * p, int cnt);
void LogFrame(struct IsdnCardState *cs, u8 * p, int size); void LogFrame(struct IsdnCardState *cs, u8 * p, int size);
......
...@@ -231,7 +231,7 @@ fcclassic_setup(struct fritz_adapter *adapter) ...@@ -231,7 +231,7 @@ fcclassic_setup(struct fritz_adapter *adapter)
adapter->isac.write_isac = &fcclassic_write_isac; adapter->isac.write_isac = &fcclassic_write_isac;
adapter->isac.read_isac_fifo = &fcclassic_read_isac_fifo; adapter->isac.read_isac_fifo = &fcclassic_read_isac_fifo;
adapter->isac.write_isac_fifo = &fcclassic_write_isac_fifo; adapter->isac.write_isac_fifo = &fcclassic_write_isac_fifo;
isac_setup(&adapter->isac); hisax_isac_setup(&adapter->isac);
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
hscx_init(&adapter->hscx[i]); hscx_init(&adapter->hscx[i]);
adapter->hscx[i].priv = adapter; adapter->hscx[i].priv = adapter;
......
...@@ -46,24 +46,22 @@ MODULE_PARM(debug, "i"); ...@@ -46,24 +46,22 @@ MODULE_PARM(debug, "i");
MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>"); MODULE_AUTHOR("Kai Germaschewski <kai.germaschewski@gmx.de>/Karsten Keil <kkeil@suse.de>");
MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver"); MODULE_DESCRIPTION("AVM Fritz!PCI/PnP ISDN driver");
// FIXME temporary hack until I sort out the new PnP stuff
#define __ISAPNP__
static struct pci_device_id fcpci_ids[] __devinitdata = { static struct pci_device_id fcpci_ids[] __devinitdata = {
{ PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1 , PCI_ANY_ID, PCI_ANY_ID, { .vendor = PCI_VENDOR_ID_AVM,
0, 0, (unsigned long) "Fritz!Card PCI" }, .device = PCI_DEVICE_ID_AVM_A1,
{ PCI_VENDOR_ID_AVM, PCI_DEVICE_ID_AVM_A1_V2, PCI_ANY_ID, PCI_ANY_ID, .subvendor = PCI_ANY_ID,
0, 0, (unsigned long) "Fritz!Card PCI v2" }, .subdevice = PCI_ANY_ID,
{ } .driver_data = (unsigned long) "Fritz!Card PCI",
},
{ .vendor = PCI_VENDOR_ID_AVM,
.device = PCI_DEVICE_ID_AVM_A1_V2,
.subvendor = PCI_ANY_ID,
.subdevice = PCI_ANY_ID,
.driver_data = (unsigned long) "Fritz!Card PCI v2" },
{}
}; };
MODULE_DEVICE_TABLE(pci, fcpci_ids);
static struct pnp_card_device_id fcpnp_ids[] __devinitdata = { MODULE_DEVICE_TABLE(pci, fcpci_ids);
{ .id = "AVM0900",
.driver_data = (unsigned long) "Fritz!Card PnP",
.devs = { { "AVM0900" } } }
};
MODULE_DEVICE_TABLE(pnp_card, fcpnp_ids);
static int protocol = 2; /* EURO-ISDN Default */ static int protocol = 2; /* EURO-ISDN Default */
MODULE_PARM(protocol, "i"); MODULE_PARM(protocol, "i");
...@@ -782,7 +780,7 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter) ...@@ -782,7 +780,7 @@ static int __devinit fcpcipnp_setup(struct fritz_adapter *adapter)
case AVM_FRITZ_PCI: case AVM_FRITZ_PCI:
case AVM_FRITZ_PNP: case AVM_FRITZ_PNP:
fcpci_init(adapter); fcpci_init(adapter);
isac_setup(&adapter->isac); hisax_isac_setup(&adapter->isac);
break; break;
} }
val = adapter->read_hdlc_status(adapter, 0); val = adapter->read_hdlc_status(adapter, 0);
...@@ -908,10 +906,10 @@ static struct pci_driver fcpci_driver = { ...@@ -908,10 +906,10 @@ static struct pci_driver fcpci_driver = {
.id_table = fcpci_ids, .id_table = fcpci_ids,
}; };
#ifdef __ISAPNP__ #ifdef CONFIG_PNP_CARD
static int __devinit fcpnp_probe(struct pnp_card *card, static int __devinit fcpnp_probe(struct pnp_card *card,
const struct pnp_card_device_id *card_id) const struct pnp_card_id *card_id)
{ {
struct fritz_adapter *adapter; struct fritz_adapter *adapter;
struct pnp_dev *pnp_dev; struct pnp_dev *pnp_dev;
...@@ -957,6 +955,14 @@ static void __devexit fcpnp_remove(struct pnp_card *pcard) ...@@ -957,6 +955,14 @@ static void __devexit fcpnp_remove(struct pnp_card *pcard)
delete_adapter(adapter); delete_adapter(adapter);
} }
static struct pnp_card_id fcpnp_ids[] __devinitdata = {
{ .id = "AVM0900",
.driver_data = (unsigned long) "Fritz!Card PnP",
.devs = { { "AVM0900" } },
},
{}
};
static struct pnpc_driver fcpnp_driver = { static struct pnpc_driver fcpnp_driver = {
.name = "fcpnp", .name = "fcpnp",
.probe = fcpnp_probe, .probe = fcpnp_probe,
...@@ -968,7 +974,7 @@ static struct pnpc_driver fcpnp_driver = { ...@@ -968,7 +974,7 @@ static struct pnpc_driver fcpnp_driver = {
static int __init hisax_fcpcipnp_init(void) static int __init hisax_fcpcipnp_init(void)
{ {
int retval, pci_nr_found; int retval = 0, pci_nr_found;
printk(KERN_INFO "hisax_fcpcipnp: Fritz!Card PCI/PCIv2/PnP ISDN driver v0.0.1\n"); printk(KERN_INFO "hisax_fcpcipnp: Fritz!Card PCI/PCIv2/PnP ISDN driver v0.0.1\n");
...@@ -977,10 +983,8 @@ static int __init hisax_fcpcipnp_init(void) ...@@ -977,10 +983,8 @@ static int __init hisax_fcpcipnp_init(void)
goto out; goto out;
pci_nr_found = retval; pci_nr_found = retval;
#ifdef __ISAPNP__ #ifdef CONFIG_PNP_CARD
retval = pnpc_register_driver(&fcpnp_driver); retval = pnpc_register_driver(&fcpnp_driver);
#else
retval = 0;
#endif #endif
if (retval < 0) if (retval < 0)
goto out_unregister_pci; goto out_unregister_pci;
...@@ -988,14 +992,14 @@ static int __init hisax_fcpcipnp_init(void) ...@@ -988,14 +992,14 @@ static int __init hisax_fcpcipnp_init(void)
#if !defined(CONFIG_HOTPLUG) || defined(MODULE) #if !defined(CONFIG_HOTPLUG) || defined(MODULE)
if (pci_nr_found + retval == 0) { if (pci_nr_found + retval == 0) {
retval = -ENODEV; retval = -ENODEV;
goto out_unregister_isapnp; goto out_unregister_pnp;
} }
#endif #endif
return 0; return 0;
#if !defined(CONFIG_HOTPLUG) || defined(MODULE) #if !defined(CONFIG_HOTPLUG) || defined(MODULE)
out_unregister_isapnp: out_unregister_pnp:
#ifdef __ISAPNP__ #ifdef CONFIG_PNP_CARD
pnpc_unregister_driver(&fcpnp_driver); pnpc_unregister_driver(&fcpnp_driver);
#endif #endif
#endif #endif
...@@ -1007,7 +1011,7 @@ static int __init hisax_fcpcipnp_init(void) ...@@ -1007,7 +1011,7 @@ static int __init hisax_fcpcipnp_init(void)
static void __exit hisax_fcpcipnp_exit(void) static void __exit hisax_fcpcipnp_exit(void)
{ {
#ifdef __ISAPNP__ #ifdef CONFIG_PNP_CARD
pnpc_unregister_driver(&fcpnp_driver); pnpc_unregister_driver(&fcpnp_driver);
#endif #endif
pci_unregister_driver(&fcpci_driver); pci_unregister_driver(&fcpci_driver);
......
...@@ -770,7 +770,7 @@ void isac_init(struct isac *isac) ...@@ -770,7 +770,7 @@ void isac_init(struct isac *isac)
FsmInitTimer(&isac->l1m, &isac->timer); FsmInitTimer(&isac->l1m, &isac->timer);
} }
void isac_setup(struct isac *isac) void hisax_isac_setup(struct isac *isac)
{ {
int val, eval; int val, eval;
...@@ -890,7 +890,7 @@ EXPORT_SYMBOL(isac_d_l2l1); ...@@ -890,7 +890,7 @@ EXPORT_SYMBOL(isac_d_l2l1);
EXPORT_SYMBOL(isacsx_setup); EXPORT_SYMBOL(isacsx_setup);
EXPORT_SYMBOL(isacsx_irq); EXPORT_SYMBOL(isacsx_irq);
EXPORT_SYMBOL(isac_setup); EXPORT_SYMBOL(hisax_isac_setup);
EXPORT_SYMBOL(isac_irq); EXPORT_SYMBOL(isac_irq);
module_init(hisax_isac_init); module_init(hisax_isac_init);
......
...@@ -36,7 +36,7 @@ struct isac { ...@@ -36,7 +36,7 @@ struct isac {
void isac_init(struct isac *isac); void isac_init(struct isac *isac);
void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg); void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg);
void isac_setup(struct isac *isac); void hisax_isac_setup(struct isac *isac);
void isac_irq(struct isac *isac); void isac_irq(struct isac *isac);
void isacsx_setup(struct isac *isac); void isacsx_setup(struct isac *isac);
......
...@@ -126,7 +126,7 @@ static char *strL1Event[] = ...@@ -126,7 +126,7 @@ static char *strL1Event[] =
}; };
void void
debugl1(struct IsdnCardState *cs, char *fmt, ...) debugl1(struct IsdnCardState *cs, const char *fmt, ...)
{ {
va_list args; va_list args;
char tmp[8]; char tmp[8];
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#define B_LL_CONNECT 9 #define B_LL_CONNECT 9
#define B_LL_OK 10 #define B_LL_OK 10
extern void debugl1(struct IsdnCardState *cs, char *fmt, ...); extern void debugl1(struct IsdnCardState *cs, const char *fmt, ...);
extern void DChannel_proc_xmt(struct IsdnCardState *cs); extern void DChannel_proc_xmt(struct IsdnCardState *cs);
extern void DChannel_proc_rcv(struct IsdnCardState *cs); extern void DChannel_proc_rcv(struct IsdnCardState *cs);
extern void l1_msg(struct IsdnCardState *cs, int pr, void *arg); extern void l1_msg(struct IsdnCardState *cs, int pr, void *arg);
......
...@@ -187,95 +187,92 @@ static struct card_ops isurf_ops = { ...@@ -187,95 +187,92 @@ static struct card_ops isurf_ops = {
static struct pnp_card *pnp_surf __devinitdata = NULL; static struct pnp_card *pnp_surf __devinitdata = NULL;
#endif #endif
int __init static int __init
setup_isurf(struct IsdnCard *card) isurf_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
unsigned long phymem; unsigned long phymem;
char tmp[64];
strcpy(tmp, ISurf_revision); phymem = card->para[2];
printk(KERN_INFO "HiSax: ISurf driver Rev. %s\n", HiSax_getrev(tmp)); cs->hw.isurf.reset = card->para[1];
cs->irq = card->para[0];
if (card->para[1] && card->para[2]) {
cs->hw.isurf.reset = card->para[1];
phymem = card->para[2];
cs->irq = card->para[0];
} else {
#ifdef __ISAPNP__
struct pnp_card *pb;
struct pnp_dev *pd;
if (isapnp_present()) {
cs->subtyp = 0;
if ((pb = pnp_find_card(
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pnp_surf))) {
pnp_surf = pb;
pd = NULL;
if (!(pd = pnp_find_dev(pnp_surf,
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pd))) {
printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
return (0);
}
if (pnp_device_attach(pd) < 0) {
printk(KERN_ERR "ISurfPnP: attach failed\n");
return 0;
}
if (pnp_activate_dev(pd) < 0) {
printk(KERN_ERR "ISurfPnP: activate failed\n");
pnp_device_detach(pd);
return 0;
}
if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0) || !pnp_port_valid(pd, 1)) {
printk(KERN_ERR "ISurfPnP:some resources are missing %ld/%lx/%lx\n",
pnp_irq(pd, 0), pnp_port_start(pd, 0), pnp_port_start(pd, 1));
pnp_device_detach(pd);
return(0);
}
cs->hw.isurf.reset = pnp_port_start(pd, 0);
phymem = pnp_port_start(pd, 1);
cs->irq = pnp_irq(pd, 0);
} else {
printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
return(0);
}
} else {
printk(KERN_INFO "ISurfPnP: no ISAPnP bus found\n");
return(0);
}
#else
printk(KERN_WARNING "HiSax: %s port/mem not set\n",
CardType[card->typ]);
return (0);
#endif
}
if (!request_io(&cs->rs, cs->hw.isurf.reset, 1, "isurf isdn")) if (!request_io(&cs->rs, cs->hw.isurf.reset, 1, "isurf isdn"))
goto err; goto err;
cs->hw.isurf.isar = request_mmio(&cs->rs, phymem, ISURF_IOMEM_SIZE, "isurf iomem");
cs->hw.isurf.isar = request_mmio(&cs->rs, phymem, ISURF_IOMEM_SIZE,
"isurf iomem");
if (!cs->hw.isurf.isar) if (!cs->hw.isurf.isar)
goto err; goto err;
cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET; cs->hw.isurf.isac = cs->hw.isurf.isar + ISURF_ISAC_OFFSET;
printk(KERN_INFO printk(KERN_INFO "ISurf: defined at 0x%x 0x%lx IRQ %d\n",
"ISurf: defined at 0x%x 0x%lx IRQ %d\n", cs->hw.isurf.reset, phymem, cs->irq);
cs->hw.isurf.reset,
card->para[2],
cs->irq);
cs->auxcmd = &isurf_auxcmd; cs->auxcmd = &isurf_auxcmd;
cs->card_ops = &isurf_ops; cs->card_ops = &isurf_ops;
cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[0].hw.isar.reg = &cs->hw.isurf.isar_r;
cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r; cs->bcs[1].hw.isar.reg = &cs->hw.isurf.isar_r;
reset_isurf(cs, ISURF_RESET); reset_isurf(cs, ISURF_RESET);
test_and_set_bit(HW_ISAR, &cs->HW_Flags); __set_bit(HW_ISAR, &cs->HW_Flags);
isac_setup(cs, &isac_ops); isac_setup(cs, &isac_ops);
if (isar_setup(cs, &isar_ops)) if (isar_setup(cs, &isar_ops))
goto err; goto err;
return 1; return 0;
err: err:
hisax_release_resources(cs); hisax_release_resources(cs);
return 0; return -EBUSY;
}
int __init
setup_isurf(struct IsdnCard *card)
{
char tmp[64];
strcpy(tmp, ISurf_revision);
printk(KERN_INFO "HiSax: ISurf driver Rev. %s\n", HiSax_getrev(tmp));
#ifdef __ISAPNP__
if (!card->para[1] || !card->para[2]) {
struct pnp_card *pb;
struct pnp_dev *pd;
cs->subtyp = 0;
if ((pb = pnp_find_card(
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pnp_surf))) {
pnp_surf = pb;
pd = NULL;
if (!(pd = pnp_find_dev(pnp_surf,
ISAPNP_VENDOR('S', 'I', 'E'),
ISAPNP_FUNCTION(0x0010), pd))) {
printk(KERN_ERR "ISurfPnP: PnP error card found, no device\n");
return (0);
}
if (pnp_device_attach(pd) < 0) {
printk(KERN_ERR "ISurfPnP: attach failed\n");
return 0;
}
if (pnp_activate_dev(pd) < 0) {
printk(KERN_ERR "ISurfPnP: activate failed\n");
pnp_device_detach(pd);
return 0;
}
if (!pnp_irq_valid(pd, 0) || !pnp_port_valid(pd, 0) || !pnp_port_valid(pd, 1)) {
printk(KERN_ERR "ISurfPnP:some resources are missing %ld/%lx/%lx\n",
pnp_irq(pd, 0), pnp_port_start(pd, 0), pnp_port_start(pd, 1));
pnp_device_detach(pd);
return(0);
}
card->para[1] = pnp_port_start(pd, 0);
card->para[2] = pnp_port_start(pd, 1);
card->para[0] = pnp_irq(pd, 0);
} else {
printk(KERN_INFO "ISurfPnP: no ISAPnP card found\n");
return 0;
}
}
#endif
if (isurf_probe(card->cs, card) < 0)
return 0;
return 1;
} }
This diff is collapsed.
...@@ -138,17 +138,11 @@ static struct card_ops mic_ops = { ...@@ -138,17 +138,11 @@ static struct card_ops mic_ops = {
.irq_func = hscxisac_irq, .irq_func = hscxisac_irq,
}; };
int __init static int __init
setup_mic(struct IsdnCard *card) mic_probe(struct IsdnCardState *cs, struct IsdnCard *card)
{ {
struct IsdnCardState *cs = card->cs;
char tmp[64];
strcpy(tmp, mic_revision);
printk(KERN_INFO "HiSax: mic driver Rev. %s\n", HiSax_getrev(tmp));
cs->hw.mic.cfg_reg = card->para[1];
cs->irq = card->para[0]; cs->irq = card->para[0];
cs->hw.mic.cfg_reg = card->para[1];
cs->hw.mic.adr = cs->hw.mic.cfg_reg + MIC_ADR; cs->hw.mic.adr = cs->hw.mic.cfg_reg + MIC_ADR;
cs->hw.mic.isac = cs->hw.mic.cfg_reg + MIC_ISAC; cs->hw.mic.isac = cs->hw.mic.cfg_reg + MIC_ISAC;
cs->hw.mic.hscx = cs->hw.mic.cfg_reg + MIC_HSCX; cs->hw.mic.hscx = cs->hw.mic.cfg_reg + MIC_HSCX;
...@@ -158,11 +152,25 @@ setup_mic(struct IsdnCard *card) ...@@ -158,11 +152,25 @@ setup_mic(struct IsdnCard *card)
printk(KERN_INFO "mic: defined at 0x%x IRQ %d\n", printk(KERN_INFO "mic: defined at 0x%x IRQ %d\n",
cs->hw.mic.cfg_reg, cs->irq); cs->hw.mic.cfg_reg, cs->irq);
cs->card_ops = &mic_ops; cs->card_ops = &mic_ops;
if (hscxisac_setup(cs, &isac_ops, &hscx_ops)) if (hscxisac_setup(cs, &isac_ops, &hscx_ops))
goto err; goto err;
return 1; return 0;
err: err:
hisax_release_resources(cs); hisax_release_resources(cs);
return 0; return -EBUSY;
}
int __init
setup_mic(struct IsdnCard *card)
{
char tmp[64];
strcpy(tmp, mic_revision);
printk(KERN_INFO "HiSax: mic driver Rev. %s\n", HiSax_getrev(tmp));
if (mic_probe(card->cs, card) < 0)
return 0;
return 1;
} }
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -85,7 +85,7 @@ config ISDN_TTY_FAX ...@@ -85,7 +85,7 @@ config ISDN_TTY_FAX
config ISDN_X25 config ISDN_X25
bool "X.25 PLP on top of ISDN" bool "X.25 PLP on top of ISDN"
depends on X25 depends on X25 && BROKEN
help help
This feature provides the X.25 protocol over ISDN connections. This feature provides the X.25 protocol over ISDN connections.
See <file:Documentation/isdn/README.x25> for more information See <file:Documentation/isdn/README.x25> for more information
......
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
#include "isdn_net.h" #include "isdn_net.h"
#include "isdn_ppp.h" #include "isdn_ppp.h"
#include "isdn_ciscohdlck.h" #include "isdn_ciscohdlck.h"
#include "isdn_concap.h"
#define ISDN_NET_TX_TIMEOUT (20*HZ) #define ISDN_NET_TX_TIMEOUT (20*HZ)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -27,7 +27,7 @@ static LIST_HEAD(anon_list); ...@@ -27,7 +27,7 @@ static LIST_HEAD(anon_list);
/* And here the free ones sit */ /* And here the free ones sit */
static LIST_HEAD(free_list); static LIST_HEAD(free_list);
/* public *and* exported. Not pretty! */ /* public *and* exported. Not pretty! */
spinlock_t files_lock = SPIN_LOCK_UNLOCKED; spinlock_t files_lock __cacheline_aligned_in_smp = SPIN_LOCK_UNLOCKED;
/* Find an unused file structure and return a pointer to it. /* Find an unused file structure and return a pointer to it.
* Returns NULL, if there are no more free file structures or * Returns NULL, if there are no more free file structures or
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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