Creation of Cybook 2416 (actually Gen4) repository
This commit is contained in:
37
include/linux/8250_pci.h
Normal file
37
include/linux/8250_pci.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Definitions for PCI support.
|
||||
*/
|
||||
#define FL_BASE_MASK 0x0007
|
||||
#define FL_BASE0 0x0000
|
||||
#define FL_BASE1 0x0001
|
||||
#define FL_BASE2 0x0002
|
||||
#define FL_BASE3 0x0003
|
||||
#define FL_BASE4 0x0004
|
||||
#define FL_GET_BASE(x) (x & FL_BASE_MASK)
|
||||
|
||||
/* Use successive BARs (PCI base address registers),
|
||||
else use offset into some specified BAR */
|
||||
#define FL_BASE_BARS 0x0008
|
||||
|
||||
/* do not assign an irq */
|
||||
#define FL_NOIRQ 0x0080
|
||||
|
||||
/* Use the Base address register size to cap number of ports */
|
||||
#define FL_REGION_SZ_CAP 0x0100
|
||||
|
||||
struct pciserial_board {
|
||||
unsigned int flags;
|
||||
unsigned int num_ports;
|
||||
unsigned int base_baud;
|
||||
unsigned int uart_offset;
|
||||
unsigned int reg_shift;
|
||||
unsigned int first_offset;
|
||||
};
|
||||
|
||||
struct serial_private;
|
||||
|
||||
struct serial_private *
|
||||
pciserial_init_ports(struct pci_dev *dev, struct pciserial_board *board);
|
||||
void pciserial_remove_ports(struct serial_private *priv);
|
||||
void pciserial_suspend_ports(struct serial_private *priv);
|
||||
void pciserial_resume_ports(struct serial_private *priv);
|
||||
342
include/linux/Kbuild
Normal file
342
include/linux/Kbuild
Normal file
@@ -0,0 +1,342 @@
|
||||
header-y += byteorder/
|
||||
header-y += dvb/
|
||||
header-y += hdlc/
|
||||
header-y += isdn/
|
||||
header-y += nfsd/
|
||||
header-y += raid/
|
||||
header-y += sunrpc/
|
||||
header-y += tc_act/
|
||||
header-y += netfilter/
|
||||
header-y += netfilter_arp/
|
||||
header-y += netfilter_bridge/
|
||||
header-y += netfilter_ipv4/
|
||||
header-y += netfilter_ipv6/
|
||||
header-y += usb/
|
||||
|
||||
header-y += affs_hardblocks.h
|
||||
header-y += aio_abi.h
|
||||
header-y += a.out.h
|
||||
header-y += arcfb.h
|
||||
header-y += atmapi.h
|
||||
header-y += atmbr2684.h
|
||||
header-y += atmclip.h
|
||||
header-y += atm_eni.h
|
||||
header-y += atm_he.h
|
||||
header-y += atm_idt77105.h
|
||||
header-y += atmioc.h
|
||||
header-y += atmlec.h
|
||||
header-y += atmmpc.h
|
||||
header-y += atm_nicstar.h
|
||||
header-y += atmppp.h
|
||||
header-y += atmsap.h
|
||||
header-y += atmsvc.h
|
||||
header-y += atm_zatm.h
|
||||
header-y += auto_fs4.h
|
||||
header-y += auxvec.h
|
||||
header-y += awe_voice.h
|
||||
header-y += ax25.h
|
||||
header-y += b1lli.h
|
||||
header-y += baycom.h
|
||||
header-y += bfs_fs.h
|
||||
header-y += blkpg.h
|
||||
header-y += bpqether.h
|
||||
header-y += cdk.h
|
||||
header-y += chio.h
|
||||
header-y += coda_psdev.h
|
||||
header-y += coff.h
|
||||
header-y += comstats.h
|
||||
header-y += consolemap.h
|
||||
header-y += cycx_cfm.h
|
||||
header-y += dlm_device.h
|
||||
header-y += dm-ioctl.h
|
||||
header-y += dn.h
|
||||
header-y += dqblk_v1.h
|
||||
header-y += dqblk_v2.h
|
||||
header-y += dqblk_xfs.h
|
||||
header-y += efs_fs_sb.h
|
||||
header-y += elf-fdpic.h
|
||||
header-y += elf.h
|
||||
header-y += elf-em.h
|
||||
header-y += fadvise.h
|
||||
header-y += fd.h
|
||||
header-y += fdreg.h
|
||||
header-y += fib_rules.h
|
||||
header-y += fuse.h
|
||||
header-y += genetlink.h
|
||||
header-y += gen_stats.h
|
||||
header-y += gigaset_dev.h
|
||||
header-y += hdsmart.h
|
||||
header-y += hysdn_if.h
|
||||
header-y += i2c-dev.h
|
||||
header-y += i8k.h
|
||||
header-y += icmp.h
|
||||
header-y += if_arcnet.h
|
||||
header-y += if_arp.h
|
||||
header-y += if_bonding.h
|
||||
header-y += if_cablemodem.h
|
||||
header-y += if_fc.h
|
||||
header-y += if_fddi.h
|
||||
header-y += if.h
|
||||
header-y += if_hippi.h
|
||||
header-y += if_infiniband.h
|
||||
header-y += if_packet.h
|
||||
header-y += if_plip.h
|
||||
header-y += if_ppp.h
|
||||
header-y += if_slip.h
|
||||
header-y += if_strip.h
|
||||
header-y += if_tunnel.h
|
||||
header-y += in6.h
|
||||
header-y += in_route.h
|
||||
header-y += ioctl.h
|
||||
header-y += ip.h
|
||||
header-y += ipmi_msgdefs.h
|
||||
header-y += ip_mp_alg.h
|
||||
header-y += ipsec.h
|
||||
header-y += ipx.h
|
||||
header-y += irda.h
|
||||
header-y += isdn_divertif.h
|
||||
header-y += iso_fs.h
|
||||
header-y += ixjuser.h
|
||||
header-y += jffs2.h
|
||||
header-y += keyctl.h
|
||||
header-y += limits.h
|
||||
header-y += lock_dlm_plock.h
|
||||
header-y += magic.h
|
||||
header-y += major.h
|
||||
header-y += matroxfb.h
|
||||
header-y += meye.h
|
||||
header-y += minix_fs.h
|
||||
header-y += mmtimer.h
|
||||
header-y += mqueue.h
|
||||
header-y += mtio.h
|
||||
header-y += ncp_no.h
|
||||
header-y += neighbour.h
|
||||
header-y += netfilter_arp.h
|
||||
header-y += netrom.h
|
||||
header-y += nfs2.h
|
||||
header-y += nfs4_mount.h
|
||||
header-y += nfs_mount.h
|
||||
header-y += oom.h
|
||||
header-y += param.h
|
||||
header-y += pci_regs.h
|
||||
header-y += personality.h
|
||||
header-y += pfkeyv2.h
|
||||
header-y += pg.h
|
||||
header-y += pkt_cls.h
|
||||
header-y += pkt_sched.h
|
||||
header-y += posix_types.h
|
||||
header-y += ppdev.h
|
||||
header-y += prctl.h
|
||||
header-y += ps2esdi.h
|
||||
header-y += qnxtypes.h
|
||||
header-y += quotaio_v1.h
|
||||
header-y += quotaio_v2.h
|
||||
header-y += radeonfb.h
|
||||
header-y += raw.h
|
||||
header-y += resource.h
|
||||
header-y += rose.h
|
||||
header-y += smbno.h
|
||||
header-y += snmp.h
|
||||
header-y += sockios.h
|
||||
header-y += som.h
|
||||
header-y += sound.h
|
||||
header-y += synclink.h
|
||||
header-y += telephony.h
|
||||
header-y += termios.h
|
||||
header-y += ticable.h
|
||||
header-y += times.h
|
||||
header-y += tiocl.h
|
||||
header-y += tipc.h
|
||||
header-y += toshiba.h
|
||||
header-y += ultrasound.h
|
||||
header-y += un.h
|
||||
header-y += utime.h
|
||||
header-y += video_decoder.h
|
||||
header-y += video_encoder.h
|
||||
header-y += videotext.h
|
||||
header-y += vt.h
|
||||
header-y += wireless.h
|
||||
header-y += x25.h
|
||||
|
||||
unifdef-y += acct.h
|
||||
unifdef-y += adb.h
|
||||
unifdef-y += adfs_fs.h
|
||||
unifdef-y += agpgart.h
|
||||
unifdef-y += apm_bios.h
|
||||
unifdef-y += atalk.h
|
||||
unifdef-y += atmarp.h
|
||||
unifdef-y += atmdev.h
|
||||
unifdef-y += atm.h
|
||||
unifdef-y += atm_tcp.h
|
||||
unifdef-y += audit.h
|
||||
unifdef-y += auto_fs.h
|
||||
unifdef-y += binfmts.h
|
||||
unifdef-y += capability.h
|
||||
unifdef-y += capi.h
|
||||
unifdef-y += cciss_ioctl.h
|
||||
unifdef-y += cdrom.h
|
||||
unifdef-y += cm4000_cs.h
|
||||
unifdef-y += cn_proc.h
|
||||
unifdef-y += coda.h
|
||||
unifdef-y += connector.h
|
||||
unifdef-y += cramfs_fs.h
|
||||
unifdef-y += cuda.h
|
||||
unifdef-y += cyclades.h
|
||||
unifdef-y += dccp.h
|
||||
unifdef-y += dirent.h
|
||||
unifdef-y += dlm.h
|
||||
unifdef-y += elfcore.h
|
||||
unifdef-y += errno.h
|
||||
unifdef-y += errqueue.h
|
||||
unifdef-y += ethtool.h
|
||||
unifdef-y += eventpoll.h
|
||||
unifdef-y += ext2_fs.h
|
||||
unifdef-y += ext3_fs.h
|
||||
unifdef-y += fb.h
|
||||
unifdef-y += fcntl.h
|
||||
unifdef-y += filter.h
|
||||
unifdef-y += flat.h
|
||||
unifdef-y += futex.h
|
||||
unifdef-y += fs.h
|
||||
unifdef-y += gameport.h
|
||||
unifdef-y += generic_serial.h
|
||||
unifdef-y += genhd.h
|
||||
unifdef-y += gfs2_ondisk.h
|
||||
unifdef-y += hayesesp.h
|
||||
unifdef-y += hdlcdrv.h
|
||||
unifdef-y += hdlc.h
|
||||
unifdef-y += hdreg.h
|
||||
unifdef-y += hiddev.h
|
||||
unifdef-y += hpet.h
|
||||
unifdef-y += i2c.h
|
||||
unifdef-y += i2o-dev.h
|
||||
unifdef-y += icmpv6.h
|
||||
unifdef-y += if_addr.h
|
||||
unifdef-y += if_bridge.h
|
||||
unifdef-y += if_ec.h
|
||||
unifdef-y += if_eql.h
|
||||
unifdef-y += if_ether.h
|
||||
unifdef-y += if_fddi.h
|
||||
unifdef-y += if_frad.h
|
||||
unifdef-y += if_ltalk.h
|
||||
unifdef-y += if_link.h
|
||||
unifdef-y += if_pppox.h
|
||||
unifdef-y += if_shaper.h
|
||||
unifdef-y += if_tr.h
|
||||
unifdef-y += if_tun.h
|
||||
unifdef-y += if_vlan.h
|
||||
unifdef-y += if_wanpipe.h
|
||||
unifdef-y += igmp.h
|
||||
unifdef-y += inet_diag.h
|
||||
unifdef-y += in.h
|
||||
unifdef-y += inotify.h
|
||||
unifdef-y += input.h
|
||||
unifdef-y += ipc.h
|
||||
unifdef-y += ipmi.h
|
||||
unifdef-y += ipv6.h
|
||||
unifdef-y += ipv6_route.h
|
||||
unifdef-y += isdn.h
|
||||
unifdef-y += isdnif.h
|
||||
unifdef-y += isdn_ppp.h
|
||||
unifdef-y += isicom.h
|
||||
unifdef-y += jbd.h
|
||||
unifdef-y += joystick.h
|
||||
unifdef-y += kdev_t.h
|
||||
unifdef-y += kd.h
|
||||
unifdef-y += kernelcapi.h
|
||||
unifdef-y += kernel.h
|
||||
unifdef-y += keyboard.h
|
||||
unifdef-y += llc.h
|
||||
unifdef-y += loop.h
|
||||
unifdef-y += lp.h
|
||||
unifdef-y += mempolicy.h
|
||||
unifdef-y += mii.h
|
||||
unifdef-y += mman.h
|
||||
unifdef-y += mroute.h
|
||||
unifdef-y += msdos_fs.h
|
||||
unifdef-y += msg.h
|
||||
unifdef-y += nbd.h
|
||||
unifdef-y += ncp_fs.h
|
||||
unifdef-y += ncp.h
|
||||
unifdef-y += ncp_mount.h
|
||||
unifdef-y += netdevice.h
|
||||
unifdef-y += netfilter_bridge.h
|
||||
unifdef-y += netfilter_decnet.h
|
||||
unifdef-y += netfilter.h
|
||||
unifdef-y += netfilter_ipv4.h
|
||||
unifdef-y += netfilter_ipv6.h
|
||||
unifdef-y += net.h
|
||||
unifdef-y += netlink.h
|
||||
unifdef-y += nfs3.h
|
||||
unifdef-y += nfs4.h
|
||||
unifdef-y += nfsacl.h
|
||||
unifdef-y += nfs_fs.h
|
||||
unifdef-y += nfs.h
|
||||
unifdef-y += nfs_idmap.h
|
||||
unifdef-y += n_r3964.h
|
||||
unifdef-y += nubus.h
|
||||
unifdef-y += nvram.h
|
||||
unifdef-y += parport.h
|
||||
unifdef-y += patchkey.h
|
||||
unifdef-y += pci.h
|
||||
unifdef-y += personality.h
|
||||
unifdef-y += pktcdvd.h
|
||||
unifdef-y += pmu.h
|
||||
unifdef-y += poll.h
|
||||
unifdef-y += ppp_defs.h
|
||||
unifdef-y += ppp-comp.h
|
||||
unifdef-y += ptrace.h
|
||||
unifdef-y += qnx4_fs.h
|
||||
unifdef-y += quota.h
|
||||
unifdef-y += random.h
|
||||
unifdef-y += reboot.h
|
||||
unifdef-y += reiserfs_fs.h
|
||||
unifdef-y += reiserfs_xattr.h
|
||||
unifdef-y += romfs_fs.h
|
||||
unifdef-y += route.h
|
||||
unifdef-y += rtc.h
|
||||
unifdef-y += rtnetlink.h
|
||||
unifdef-y += scc.h
|
||||
unifdef-y += sched.h
|
||||
unifdef-y += sdla.h
|
||||
unifdef-y += selinux_netlink.h
|
||||
unifdef-y += sem.h
|
||||
unifdef-y += serial_core.h
|
||||
unifdef-y += serial.h
|
||||
unifdef-y += serio.h
|
||||
unifdef-y += shm.h
|
||||
unifdef-y += signal.h
|
||||
unifdef-y += smb_fs.h
|
||||
unifdef-y += smb.h
|
||||
unifdef-y += smb_mount.h
|
||||
unifdef-y += socket.h
|
||||
unifdef-y += sonet.h
|
||||
unifdef-y += sonypi.h
|
||||
unifdef-y += soundcard.h
|
||||
unifdef-y += stat.h
|
||||
unifdef-y += stddef.h
|
||||
unifdef-y += sysctl.h
|
||||
unifdef-y += tcp.h
|
||||
unifdef-y += time.h
|
||||
unifdef-y += timex.h
|
||||
unifdef-y += tty.h
|
||||
unifdef-y += types.h
|
||||
unifdef-y += udf_fs_i.h
|
||||
unifdef-y += udp.h
|
||||
unifdef-y += ufs_fs.h
|
||||
unifdef-y += uinput.h
|
||||
unifdef-y += uio.h
|
||||
unifdef-y += unistd.h
|
||||
unifdef-y += usbdevice_fs.h
|
||||
unifdef-y += user.h
|
||||
unifdef-y += utsname.h
|
||||
unifdef-y += videodev2.h
|
||||
unifdef-y += videodev.h
|
||||
unifdef-y += wait.h
|
||||
unifdef-y += wanrouter.h
|
||||
unifdef-y += watchdog.h
|
||||
unifdef-y += wireless.h
|
||||
unifdef-y += xattr.h
|
||||
unifdef-y += xfrm.h
|
||||
|
||||
objhdr-y += version.h
|
||||
268
include/linux/a.out.h
Normal file
268
include/linux/a.out.h
Normal file
@@ -0,0 +1,268 @@
|
||||
#ifndef __A_OUT_GNU_H__
|
||||
#define __A_OUT_GNU_H__
|
||||
|
||||
#define __GNU_EXEC_MACROS__
|
||||
|
||||
#ifndef __STRUCT_EXEC_OVERRIDE__
|
||||
|
||||
#include <asm/a.out.h>
|
||||
|
||||
#endif /* __STRUCT_EXEC_OVERRIDE__ */
|
||||
|
||||
/* these go in the N_MACHTYPE field */
|
||||
enum machine_type {
|
||||
#if defined (M_OLDSUN2)
|
||||
M__OLDSUN2 = M_OLDSUN2,
|
||||
#else
|
||||
M_OLDSUN2 = 0,
|
||||
#endif
|
||||
#if defined (M_68010)
|
||||
M__68010 = M_68010,
|
||||
#else
|
||||
M_68010 = 1,
|
||||
#endif
|
||||
#if defined (M_68020)
|
||||
M__68020 = M_68020,
|
||||
#else
|
||||
M_68020 = 2,
|
||||
#endif
|
||||
#if defined (M_SPARC)
|
||||
M__SPARC = M_SPARC,
|
||||
#else
|
||||
M_SPARC = 3,
|
||||
#endif
|
||||
/* skip a bunch so we don't run into any of sun's numbers */
|
||||
M_386 = 100,
|
||||
M_MIPS1 = 151, /* MIPS R3000/R3000 binary */
|
||||
M_MIPS2 = 152 /* MIPS R6000/R4000 binary */
|
||||
};
|
||||
|
||||
#if !defined (N_MAGIC)
|
||||
#define N_MAGIC(exec) ((exec).a_info & 0xffff)
|
||||
#endif
|
||||
#define N_MACHTYPE(exec) ((enum machine_type)(((exec).a_info >> 16) & 0xff))
|
||||
#define N_FLAGS(exec) (((exec).a_info >> 24) & 0xff)
|
||||
#define N_SET_INFO(exec, magic, type, flags) \
|
||||
((exec).a_info = ((magic) & 0xffff) \
|
||||
| (((int)(type) & 0xff) << 16) \
|
||||
| (((flags) & 0xff) << 24))
|
||||
#define N_SET_MAGIC(exec, magic) \
|
||||
((exec).a_info = (((exec).a_info & 0xffff0000) | ((magic) & 0xffff)))
|
||||
|
||||
#define N_SET_MACHTYPE(exec, machtype) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info&0xff00ffff) | ((((int)(machtype))&0xff) << 16))
|
||||
|
||||
#define N_SET_FLAGS(exec, flags) \
|
||||
((exec).a_info = \
|
||||
((exec).a_info&0x00ffffff) | (((flags) & 0xff) << 24))
|
||||
|
||||
/* Code indicating object file or impure executable. */
|
||||
#define OMAGIC 0407
|
||||
/* Code indicating pure executable. */
|
||||
#define NMAGIC 0410
|
||||
/* Code indicating demand-paged executable. */
|
||||
#define ZMAGIC 0413
|
||||
/* This indicates a demand-paged executable with the header in the text.
|
||||
The first page is unmapped to help trap NULL pointer references */
|
||||
#define QMAGIC 0314
|
||||
|
||||
/* Code indicating core file. */
|
||||
#define CMAGIC 0421
|
||||
|
||||
#if !defined (N_BADMAG)
|
||||
#define N_BADMAG(x) (N_MAGIC(x) != OMAGIC \
|
||||
&& N_MAGIC(x) != NMAGIC \
|
||||
&& N_MAGIC(x) != ZMAGIC \
|
||||
&& N_MAGIC(x) != QMAGIC)
|
||||
#endif
|
||||
|
||||
#define _N_HDROFF(x) (1024 - sizeof (struct exec))
|
||||
|
||||
#if !defined (N_TXTOFF)
|
||||
#define N_TXTOFF(x) \
|
||||
(N_MAGIC(x) == ZMAGIC ? _N_HDROFF((x)) + sizeof (struct exec) : \
|
||||
(N_MAGIC(x) == QMAGIC ? 0 : sizeof (struct exec)))
|
||||
#endif
|
||||
|
||||
#if !defined (N_DATOFF)
|
||||
#define N_DATOFF(x) (N_TXTOFF(x) + (x).a_text)
|
||||
#endif
|
||||
|
||||
#if !defined (N_TRELOFF)
|
||||
#define N_TRELOFF(x) (N_DATOFF(x) + (x).a_data)
|
||||
#endif
|
||||
|
||||
#if !defined (N_DRELOFF)
|
||||
#define N_DRELOFF(x) (N_TRELOFF(x) + N_TRSIZE(x))
|
||||
#endif
|
||||
|
||||
#if !defined (N_SYMOFF)
|
||||
#define N_SYMOFF(x) (N_DRELOFF(x) + N_DRSIZE(x))
|
||||
#endif
|
||||
|
||||
#if !defined (N_STROFF)
|
||||
#define N_STROFF(x) (N_SYMOFF(x) + N_SYMSIZE(x))
|
||||
#endif
|
||||
|
||||
/* Address of text segment in memory after it is loaded. */
|
||||
#if !defined (N_TXTADDR)
|
||||
#define N_TXTADDR(x) (N_MAGIC(x) == QMAGIC ? PAGE_SIZE : 0)
|
||||
#endif
|
||||
|
||||
/* Address of data segment in memory after it is loaded.
|
||||
Note that it is up to you to define SEGMENT_SIZE
|
||||
on machines not listed here. */
|
||||
#if defined(vax) || defined(hp300) || defined(pyr)
|
||||
#define SEGMENT_SIZE page_size
|
||||
#endif
|
||||
#ifdef sony
|
||||
#define SEGMENT_SIZE 0x2000
|
||||
#endif /* Sony. */
|
||||
#ifdef is68k
|
||||
#define SEGMENT_SIZE 0x20000
|
||||
#endif
|
||||
#if defined(m68k) && defined(PORTAR)
|
||||
#define PAGE_SIZE 0x400
|
||||
#define SEGMENT_SIZE PAGE_SIZE
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
#include <asm/page.h>
|
||||
#if defined(__i386__) || defined(__mc68000__)
|
||||
#define SEGMENT_SIZE 1024
|
||||
#else
|
||||
#ifndef SEGMENT_SIZE
|
||||
#define SEGMENT_SIZE PAGE_SIZE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define _N_SEGMENT_ROUND(x) ALIGN(x, SEGMENT_SIZE)
|
||||
|
||||
#define _N_TXTENDADDR(x) (N_TXTADDR(x)+(x).a_text)
|
||||
|
||||
#ifndef N_DATADDR
|
||||
#define N_DATADDR(x) \
|
||||
(N_MAGIC(x)==OMAGIC? (_N_TXTENDADDR(x)) \
|
||||
: (_N_SEGMENT_ROUND (_N_TXTENDADDR(x))))
|
||||
#endif
|
||||
|
||||
/* Address of bss segment in memory after it is loaded. */
|
||||
#if !defined (N_BSSADDR)
|
||||
#define N_BSSADDR(x) (N_DATADDR(x) + (x).a_data)
|
||||
#endif
|
||||
|
||||
#if !defined (N_NLIST_DECLARED)
|
||||
struct nlist {
|
||||
union {
|
||||
char *n_name;
|
||||
struct nlist *n_next;
|
||||
long n_strx;
|
||||
} n_un;
|
||||
unsigned char n_type;
|
||||
char n_other;
|
||||
short n_desc;
|
||||
unsigned long n_value;
|
||||
};
|
||||
#endif /* no N_NLIST_DECLARED. */
|
||||
|
||||
#if !defined (N_UNDF)
|
||||
#define N_UNDF 0
|
||||
#endif
|
||||
#if !defined (N_ABS)
|
||||
#define N_ABS 2
|
||||
#endif
|
||||
#if !defined (N_TEXT)
|
||||
#define N_TEXT 4
|
||||
#endif
|
||||
#if !defined (N_DATA)
|
||||
#define N_DATA 6
|
||||
#endif
|
||||
#if !defined (N_BSS)
|
||||
#define N_BSS 8
|
||||
#endif
|
||||
#if !defined (N_FN)
|
||||
#define N_FN 15
|
||||
#endif
|
||||
|
||||
#if !defined (N_EXT)
|
||||
#define N_EXT 1
|
||||
#endif
|
||||
#if !defined (N_TYPE)
|
||||
#define N_TYPE 036
|
||||
#endif
|
||||
#if !defined (N_STAB)
|
||||
#define N_STAB 0340
|
||||
#endif
|
||||
|
||||
/* The following type indicates the definition of a symbol as being
|
||||
an indirect reference to another symbol. The other symbol
|
||||
appears as an undefined reference, immediately following this symbol.
|
||||
|
||||
Indirection is asymmetrical. The other symbol's value will be used
|
||||
to satisfy requests for the indirect symbol, but not vice versa.
|
||||
If the other symbol does not have a definition, libraries will
|
||||
be searched to find a definition. */
|
||||
#define N_INDR 0xa
|
||||
|
||||
/* The following symbols refer to set elements.
|
||||
All the N_SET[ATDB] symbols with the same name form one set.
|
||||
Space is allocated for the set in the text section, and each set
|
||||
element's value is stored into one word of the space.
|
||||
The first word of the space is the length of the set (number of elements).
|
||||
|
||||
The address of the set is made into an N_SETV symbol
|
||||
whose name is the same as the name of the set.
|
||||
This symbol acts like a N_DATA global symbol
|
||||
in that it can satisfy undefined external references. */
|
||||
|
||||
/* These appear as input to LD, in a .o file. */
|
||||
#define N_SETA 0x14 /* Absolute set element symbol */
|
||||
#define N_SETT 0x16 /* Text set element symbol */
|
||||
#define N_SETD 0x18 /* Data set element symbol */
|
||||
#define N_SETB 0x1A /* Bss set element symbol */
|
||||
|
||||
/* This is output from LD. */
|
||||
#define N_SETV 0x1C /* Pointer to set vector in data area. */
|
||||
|
||||
#if !defined (N_RELOCATION_INFO_DECLARED)
|
||||
/* This structure describes a single relocation to be performed.
|
||||
The text-relocation section of the file is a vector of these structures,
|
||||
all of which apply to the text section.
|
||||
Likewise, the data-relocation section applies to the data section. */
|
||||
|
||||
struct relocation_info
|
||||
{
|
||||
/* Address (within segment) to be relocated. */
|
||||
int r_address;
|
||||
/* The meaning of r_symbolnum depends on r_extern. */
|
||||
unsigned int r_symbolnum:24;
|
||||
/* Nonzero means value is a pc-relative offset
|
||||
and it should be relocated for changes in its own address
|
||||
as well as for changes in the symbol or section specified. */
|
||||
unsigned int r_pcrel:1;
|
||||
/* Length (as exponent of 2) of the field to be relocated.
|
||||
Thus, a value of 2 indicates 1<<2 bytes. */
|
||||
unsigned int r_length:2;
|
||||
/* 1 => relocate with value of symbol.
|
||||
r_symbolnum is the index of the symbol
|
||||
in file's the symbol table.
|
||||
0 => relocate with the address of a segment.
|
||||
r_symbolnum is N_TEXT, N_DATA, N_BSS or N_ABS
|
||||
(the N_EXT bit may be set also, but signifies nothing). */
|
||||
unsigned int r_extern:1;
|
||||
/* Four bits that aren't used, but when writing an object file
|
||||
it is desirable to clear them. */
|
||||
#ifdef NS32K
|
||||
unsigned r_bsr:1;
|
||||
unsigned r_disp:1;
|
||||
unsigned r_pad:2;
|
||||
#else
|
||||
unsigned int r_pad:4;
|
||||
#endif
|
||||
};
|
||||
#endif /* no N_RELOCATION_INFO_DECLARED. */
|
||||
|
||||
|
||||
#endif /* __A_OUT_GNU_H__ */
|
||||
374
include/linux/ac97_codec.h
Normal file
374
include/linux/ac97_codec.h
Normal file
@@ -0,0 +1,374 @@
|
||||
#ifndef _AC97_CODEC_H_
|
||||
#define _AC97_CODEC_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/soundcard.h>
|
||||
|
||||
/* AC97 1.0 */
|
||||
#define AC97_RESET 0x0000 //
|
||||
#define AC97_MASTER_VOL_STEREO 0x0002 // Line Out
|
||||
#define AC97_HEADPHONE_VOL 0x0004 //
|
||||
#define AC97_MASTER_VOL_MONO 0x0006 // TAD Output
|
||||
#define AC97_MASTER_TONE 0x0008 //
|
||||
#define AC97_PCBEEP_VOL 0x000a // none
|
||||
#define AC97_PHONE_VOL 0x000c // TAD Input (mono)
|
||||
#define AC97_MIC_VOL 0x000e // MIC Input (mono)
|
||||
#define AC97_LINEIN_VOL 0x0010 // Line Input (stereo)
|
||||
#define AC97_CD_VOL 0x0012 // CD Input (stereo)
|
||||
#define AC97_VIDEO_VOL 0x0014 // none
|
||||
#define AC97_AUX_VOL 0x0016 // Aux Input (stereo)
|
||||
#define AC97_PCMOUT_VOL 0x0018 // Wave Output (stereo)
|
||||
#define AC97_RECORD_SELECT 0x001a //
|
||||
#define AC97_RECORD_GAIN 0x001c
|
||||
#define AC97_RECORD_GAIN_MIC 0x001e
|
||||
#define AC97_GENERAL_PURPOSE 0x0020
|
||||
#define AC97_3D_CONTROL 0x0022
|
||||
#define AC97_MODEM_RATE 0x0024
|
||||
#define AC97_POWER_CONTROL 0x0026
|
||||
|
||||
/* AC'97 2.0 */
|
||||
#define AC97_EXTENDED_ID 0x0028 /* Extended Audio ID */
|
||||
#define AC97_EXTENDED_STATUS 0x002A /* Extended Audio Status */
|
||||
#define AC97_PCM_FRONT_DAC_RATE 0x002C /* PCM Front DAC Rate */
|
||||
#define AC97_PCM_SURR_DAC_RATE 0x002E /* PCM Surround DAC Rate */
|
||||
#define AC97_PCM_LFE_DAC_RATE 0x0030 /* PCM LFE DAC Rate */
|
||||
#define AC97_PCM_LR_ADC_RATE 0x0032 /* PCM LR ADC Rate */
|
||||
#define AC97_PCM_MIC_ADC_RATE 0x0034 /* PCM MIC ADC Rate */
|
||||
#define AC97_CENTER_LFE_MASTER 0x0036 /* Center + LFE Master Volume */
|
||||
#define AC97_SURROUND_MASTER 0x0038 /* Surround (Rear) Master Volume */
|
||||
#define AC97_RESERVED_3A 0x003A /* Reserved in AC '97 < 2.2 */
|
||||
|
||||
/* AC'97 2.2 */
|
||||
#define AC97_SPDIF_CONTROL 0x003A /* S/PDIF Control */
|
||||
|
||||
/* range 0x3c-0x58 - MODEM */
|
||||
#define AC97_EXTENDED_MODEM_ID 0x003C
|
||||
#define AC97_EXTEND_MODEM_STAT 0x003E
|
||||
#define AC97_LINE1_RATE 0x0040
|
||||
#define AC97_LINE2_RATE 0x0042
|
||||
#define AC97_HANDSET_RATE 0x0044
|
||||
#define AC97_LINE1_LEVEL 0x0046
|
||||
#define AC97_LINE2_LEVEL 0x0048
|
||||
#define AC97_HANDSET_LEVEL 0x004A
|
||||
#define AC97_GPIO_CONFIG 0x004C
|
||||
#define AC97_GPIO_POLARITY 0x004E
|
||||
#define AC97_GPIO_STICKY 0x0050
|
||||
#define AC97_GPIO_WAKE_UP 0x0052
|
||||
#define AC97_GPIO_STATUS 0x0054
|
||||
#define AC97_MISC_MODEM_STAT 0x0056
|
||||
#define AC97_RESERVED_58 0x0058
|
||||
|
||||
/* registers 0x005a - 0x007a are vendor reserved */
|
||||
|
||||
#define AC97_VENDOR_ID1 0x007c
|
||||
#define AC97_VENDOR_ID2 0x007e
|
||||
|
||||
/* volume control bit defines */
|
||||
#if defined(CONFIG_MACH_SMDK6400) || defined(CONFIG_MACH_SMDK6410)
|
||||
#define AC97_MUTE 0x8000
|
||||
#else
|
||||
/* SMDK6400 use headphone out of WM9713 */
|
||||
#define AC97_MUTE 0x8080
|
||||
#endif
|
||||
#define AC97_MICBOOST 0x0040
|
||||
#define AC97_LEFTVOL 0x3f00
|
||||
#define AC97_RIGHTVOL 0x003f
|
||||
|
||||
/* record mux defines */
|
||||
#define AC97_RECMUX_MIC 0x0000
|
||||
#define AC97_RECMUX_CD 0x0101
|
||||
#define AC97_RECMUX_VIDEO 0x0202
|
||||
#define AC97_RECMUX_AUX 0x0303
|
||||
#define AC97_RECMUX_LINE 0x0404
|
||||
#define AC97_RECMUX_STEREO_MIX 0x0505
|
||||
#define AC97_RECMUX_MONO_MIX 0x0606
|
||||
#define AC97_RECMUX_PHONE 0x0707
|
||||
|
||||
/* general purpose register bit defines */
|
||||
#define AC97_GP_LPBK 0x0080 /* Loopback mode */
|
||||
#define AC97_GP_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 */
|
||||
#define AC97_GP_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic */
|
||||
#define AC97_GP_RLBK 0x0400 /* Remote Loopback - Modem line codec */
|
||||
#define AC97_GP_LLBK 0x0800 /* Local Loopback - Modem Line codec */
|
||||
#define AC97_GP_LD 0x1000 /* Loudness 1=on */
|
||||
#define AC97_GP_3D 0x2000 /* 3D Enhancement 1=on */
|
||||
#define AC97_GP_ST 0x4000 /* Stereo Enhancement 1=on */
|
||||
#define AC97_GP_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */
|
||||
|
||||
/* extended audio status and control bit defines */
|
||||
#define AC97_EA_VRA 0x0001 /* Variable bit rate enable bit */
|
||||
#define AC97_EA_DRA 0x0002 /* Double-rate audio enable bit */
|
||||
#define AC97_EA_SPDIF 0x0004 /* S/PDIF Enable bit */
|
||||
#define AC97_EA_VRM 0x0008 /* Variable bit rate for MIC enable bit */
|
||||
#define AC97_EA_CDAC 0x0040 /* PCM Center DAC is ready (Read only) */
|
||||
#define AC97_EA_SDAC 0x0040 /* PCM Surround DACs are ready (Read only) */
|
||||
#define AC97_EA_LDAC 0x0080 /* PCM LFE DAC is ready (Read only) */
|
||||
#define AC97_EA_MDAC 0x0100 /* MIC ADC is ready (Read only) */
|
||||
#define AC97_EA_SPCV 0x0400 /* S/PDIF configuration valid (Read only) */
|
||||
#define AC97_EA_PRI 0x0800 /* Turns the PCM Center DAC off */
|
||||
#define AC97_EA_PRJ 0x1000 /* Turns the PCM Surround DACs off */
|
||||
#define AC97_EA_PRK 0x2000 /* Turns the PCM LFE DAC off */
|
||||
#define AC97_EA_PRL 0x4000 /* Turns the MIC ADC off */
|
||||
#define AC97_EA_SLOT_MASK 0xffcf /* Mask for slot assignment bits */
|
||||
#define AC97_EA_SPSA_3_4 0x0000 /* Slot assigned to 3 & 4 */
|
||||
#define AC97_EA_SPSA_7_8 0x0010 /* Slot assigned to 7 & 8 */
|
||||
#define AC97_EA_SPSA_6_9 0x0020 /* Slot assigned to 6 & 9 */
|
||||
#define AC97_EA_SPSA_10_11 0x0030 /* Slot assigned to 10 & 11 */
|
||||
|
||||
/* S/PDIF control bit defines */
|
||||
#define AC97_SC_PRO 0x0001 /* Professional status */
|
||||
#define AC97_SC_NAUDIO 0x0002 /* Non audio stream */
|
||||
#define AC97_SC_COPY 0x0004 /* Copyright status */
|
||||
#define AC97_SC_PRE 0x0008 /* Preemphasis status */
|
||||
#define AC97_SC_CC_MASK 0x07f0 /* Category Code mask */
|
||||
#define AC97_SC_L 0x0800 /* Generation Level status */
|
||||
#define AC97_SC_SPSR_MASK 0xcfff /* S/PDIF Sample Rate bits */
|
||||
#define AC97_SC_SPSR_44K 0x0000 /* Use 44.1kHz Sample rate */
|
||||
#define AC97_SC_SPSR_48K 0x2000 /* Use 48kHz Sample rate */
|
||||
#define AC97_SC_SPSR_32K 0x3000 /* Use 32kHz Sample rate */
|
||||
#define AC97_SC_DRS 0x4000 /* Double Rate S/PDIF */
|
||||
#define AC97_SC_V 0x8000 /* Validity status */
|
||||
|
||||
/* powerdown control and status bit defines */
|
||||
|
||||
/* status */
|
||||
#define AC97_PWR_MDM 0x0010 /* Modem section ready */
|
||||
#define AC97_PWR_REF 0x0008 /* Vref nominal */
|
||||
#define AC97_PWR_ANL 0x0004 /* Analog section ready */
|
||||
#define AC97_PWR_DAC 0x0002 /* DAC section ready */
|
||||
#define AC97_PWR_ADC 0x0001 /* ADC section ready */
|
||||
|
||||
/* control */
|
||||
#define AC97_PWR_PR0 0x0100 /* ADC and Mux powerdown */
|
||||
#define AC97_PWR_PR1 0x0200 /* DAC powerdown */
|
||||
#define AC97_PWR_PR2 0x0400 /* Output mixer powerdown (Vref on) */
|
||||
#define AC97_PWR_PR3 0x0800 /* Output mixer powerdown (Vref off) */
|
||||
#define AC97_PWR_PR4 0x1000 /* AC-link powerdown */
|
||||
#define AC97_PWR_PR5 0x2000 /* Internal Clk disable */
|
||||
#define AC97_PWR_PR6 0x4000 /* HP amp powerdown */
|
||||
#define AC97_PWR_PR7 0x8000 /* Modem off - if supported */
|
||||
|
||||
/* extended audio ID register bit defines */
|
||||
#define AC97_EXTID_VRA 0x0001
|
||||
#define AC97_EXTID_DRA 0x0002
|
||||
#define AC97_EXTID_SPDIF 0x0004
|
||||
#define AC97_EXTID_VRM 0x0008
|
||||
#define AC97_EXTID_DSA0 0x0010
|
||||
#define AC97_EXTID_DSA1 0x0020
|
||||
#define AC97_EXTID_CDAC 0x0040
|
||||
#define AC97_EXTID_SDAC 0x0080
|
||||
#define AC97_EXTID_LDAC 0x0100
|
||||
#define AC97_EXTID_AMAP 0x0200
|
||||
#define AC97_EXTID_REV0 0x0400
|
||||
#define AC97_EXTID_REV1 0x0800
|
||||
#define AC97_EXTID_ID0 0x4000
|
||||
#define AC97_EXTID_ID1 0x8000
|
||||
|
||||
/* extended status register bit defines */
|
||||
#define AC97_EXTSTAT_VRA 0x0001
|
||||
#define AC97_EXTSTAT_DRA 0x0002
|
||||
#define AC97_EXTSTAT_SPDIF 0x0004
|
||||
#define AC97_EXTSTAT_VRM 0x0008
|
||||
#define AC97_EXTSTAT_SPSA0 0x0010
|
||||
#define AC97_EXTSTAT_SPSA1 0x0020
|
||||
#define AC97_EXTSTAT_CDAC 0x0040
|
||||
#define AC97_EXTSTAT_SDAC 0x0080
|
||||
#define AC97_EXTSTAT_LDAC 0x0100
|
||||
#define AC97_EXTSTAT_MADC 0x0200
|
||||
#define AC97_EXTSTAT_SPCV 0x0400
|
||||
#define AC97_EXTSTAT_PRI 0x0800
|
||||
#define AC97_EXTSTAT_PRJ 0x1000
|
||||
#define AC97_EXTSTAT_PRK 0x2000
|
||||
#define AC97_EXTSTAT_PRL 0x4000
|
||||
|
||||
/* extended audio ID register bit defines */
|
||||
#define AC97_EXTID_VRA 0x0001
|
||||
#define AC97_EXTID_DRA 0x0002
|
||||
#define AC97_EXTID_SPDIF 0x0004
|
||||
#define AC97_EXTID_VRM 0x0008
|
||||
#define AC97_EXTID_DSA0 0x0010
|
||||
#define AC97_EXTID_DSA1 0x0020
|
||||
#define AC97_EXTID_CDAC 0x0040
|
||||
#define AC97_EXTID_SDAC 0x0080
|
||||
#define AC97_EXTID_LDAC 0x0100
|
||||
#define AC97_EXTID_AMAP 0x0200
|
||||
#define AC97_EXTID_REV0 0x0400
|
||||
#define AC97_EXTID_REV1 0x0800
|
||||
#define AC97_EXTID_ID0 0x4000
|
||||
#define AC97_EXTID_ID1 0x8000
|
||||
|
||||
/* extended status register bit defines */
|
||||
#define AC97_EXTSTAT_VRA 0x0001
|
||||
#define AC97_EXTSTAT_DRA 0x0002
|
||||
#define AC97_EXTSTAT_SPDIF 0x0004
|
||||
#define AC97_EXTSTAT_VRM 0x0008
|
||||
#define AC97_EXTSTAT_SPSA0 0x0010
|
||||
#define AC97_EXTSTAT_SPSA1 0x0020
|
||||
#define AC97_EXTSTAT_CDAC 0x0040
|
||||
#define AC97_EXTSTAT_SDAC 0x0080
|
||||
#define AC97_EXTSTAT_LDAC 0x0100
|
||||
#define AC97_EXTSTAT_MADC 0x0200
|
||||
#define AC97_EXTSTAT_SPCV 0x0400
|
||||
#define AC97_EXTSTAT_PRI 0x0800
|
||||
#define AC97_EXTSTAT_PRJ 0x1000
|
||||
#define AC97_EXTSTAT_PRK 0x2000
|
||||
#define AC97_EXTSTAT_PRL 0x4000
|
||||
|
||||
/* useful power states */
|
||||
#define AC97_PWR_D0 0x0000 /* everything on */
|
||||
#define AC97_PWR_D1 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR4
|
||||
#define AC97_PWR_D2 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
|
||||
#define AC97_PWR_D3 AC97_PWR_PR0|AC97_PWR_PR1|AC97_PWR_PR2|AC97_PWR_PR3|AC97_PWR_PR4
|
||||
#define AC97_PWR_ANLOFF AC97_PWR_PR2|AC97_PWR_PR3 /* analog section off */
|
||||
|
||||
/* Total number of defined registers. */
|
||||
#define AC97_REG_CNT 64
|
||||
|
||||
|
||||
/* OSS interface to the ac97s.. */
|
||||
#define AC97_STEREO_MASK (SOUND_MASK_VOLUME|SOUND_MASK_PCM|\
|
||||
SOUND_MASK_LINE|SOUND_MASK_CD|\
|
||||
SOUND_MASK_ALTPCM|SOUND_MASK_IGAIN|\
|
||||
SOUND_MASK_LINE1|SOUND_MASK_VIDEO)
|
||||
|
||||
#define AC97_SUPPORTED_MASK (AC97_STEREO_MASK | \
|
||||
SOUND_MASK_BASS|SOUND_MASK_TREBLE|\
|
||||
SOUND_MASK_SPEAKER|SOUND_MASK_MIC|\
|
||||
SOUND_MASK_PHONEIN|SOUND_MASK_PHONEOUT)
|
||||
|
||||
#define AC97_RECORD_MASK (SOUND_MASK_MIC|\
|
||||
SOUND_MASK_CD|SOUND_MASK_IGAIN|SOUND_MASK_VIDEO|\
|
||||
SOUND_MASK_LINE1| SOUND_MASK_LINE|\
|
||||
SOUND_MASK_PHONEIN)
|
||||
|
||||
/* original check is not good enough in case FOO is greater than
|
||||
* SOUND_MIXER_NRDEVICES because the supported_mixers has exactly
|
||||
* SOUND_MIXER_NRDEVICES elements.
|
||||
* before matching the given mixer against the bitmask in supported_mixers we
|
||||
* check if mixer number exceeds maximum allowed size which is as mentioned
|
||||
* above SOUND_MIXER_NRDEVICES */
|
||||
#define supported_mixer(CODEC,FOO) ((FOO >= 0) && \
|
||||
(FOO < SOUND_MIXER_NRDEVICES) && \
|
||||
(CODEC)->supported_mixers & (1<<FOO) )
|
||||
|
||||
struct ac97_codec {
|
||||
/* Linked list of codecs */
|
||||
struct list_head list;
|
||||
|
||||
/* AC97 controller connected with */
|
||||
void *private_data;
|
||||
|
||||
char *name;
|
||||
int id;
|
||||
int dev_mixer;
|
||||
int type;
|
||||
u32 model;
|
||||
|
||||
unsigned int modem:1;
|
||||
|
||||
struct ac97_ops *codec_ops;
|
||||
|
||||
/* controller specific lower leverl ac97 accessing routines.
|
||||
must be re-entrant safe */
|
||||
u16 (*codec_read) (struct ac97_codec *codec, u8 reg);
|
||||
void (*codec_write) (struct ac97_codec *codec, u8 reg, u16 val);
|
||||
|
||||
/* Wait for codec-ready. Ok to sleep here. */
|
||||
void (*codec_wait) (struct ac97_codec *codec);
|
||||
|
||||
/* callback used by helper drivers for interesting ac97 setups */
|
||||
void (*codec_unregister) (struct ac97_codec *codec);
|
||||
|
||||
struct ac97_driver *driver;
|
||||
void *driver_private; /* Private data for the driver */
|
||||
|
||||
spinlock_t lock;
|
||||
|
||||
/* OSS mixer masks */
|
||||
int modcnt;
|
||||
int supported_mixers;
|
||||
int stereo_mixers;
|
||||
int record_sources;
|
||||
|
||||
/* Property flags */
|
||||
int flags;
|
||||
|
||||
int bit_resolution;
|
||||
|
||||
/* OSS mixer interface */
|
||||
int (*read_mixer) (struct ac97_codec *codec, int oss_channel);
|
||||
void (*write_mixer)(struct ac97_codec *codec, int oss_channel,
|
||||
unsigned int left, unsigned int right);
|
||||
int (*recmask_io) (struct ac97_codec *codec, int rw, int mask);
|
||||
int (*mixer_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);
|
||||
|
||||
/* saved OSS mixer states */
|
||||
unsigned int mixer_state[SOUND_MIXER_NRDEVICES];
|
||||
|
||||
/* Software Modem interface */
|
||||
int (*modem_ioctl)(struct ac97_codec *codec, unsigned int cmd, unsigned long arg);
|
||||
};
|
||||
|
||||
/*
|
||||
* Operation structures for each known AC97 chip
|
||||
*/
|
||||
|
||||
struct ac97_ops
|
||||
{
|
||||
/* Initialise */
|
||||
int (*init)(struct ac97_codec *c);
|
||||
/* Amplifier control */
|
||||
int (*amplifier)(struct ac97_codec *codec, int on);
|
||||
/* Digital mode control */
|
||||
int (*digital)(struct ac97_codec *codec, int slots, int rate, int mode);
|
||||
#define AUDIO_DIGITAL 0x8000
|
||||
#define AUDIO_PRO 0x4000
|
||||
#define AUDIO_DRS 0x2000
|
||||
#define AUDIO_CCMASK 0x003F
|
||||
|
||||
#define AC97_DELUDED_MODEM 1 /* Audio codec reports its a modem */
|
||||
#define AC97_NO_PCM_VOLUME 2 /* Volume control is missing */
|
||||
#define AC97_DEFAULT_POWER_OFF 4 /* Needs warm reset to power up */
|
||||
};
|
||||
|
||||
extern int ac97_read_proc (char *page_out, char **start, off_t off,
|
||||
int count, int *eof, void *data);
|
||||
extern int ac97_probe_codec(struct ac97_codec *);
|
||||
extern unsigned int ac97_set_adc_rate(struct ac97_codec *codec, unsigned int rate);
|
||||
extern unsigned int ac97_set_dac_rate(struct ac97_codec *codec, unsigned int rate);
|
||||
|
||||
extern struct ac97_codec *ac97_alloc_codec(void);
|
||||
extern void ac97_release_codec(struct ac97_codec *codec);
|
||||
|
||||
struct ac97_driver {
|
||||
struct list_head list;
|
||||
char *name;
|
||||
u32 codec_id;
|
||||
u32 codec_mask;
|
||||
int (*probe) (struct ac97_codec *codec, struct ac97_driver *driver);
|
||||
void (*remove) (struct ac97_codec *codec, struct ac97_driver *driver);
|
||||
};
|
||||
|
||||
/* quirk types */
|
||||
enum {
|
||||
AC97_TUNE_DEFAULT = -1, /* use default from quirk list (not valid in list) */
|
||||
AC97_TUNE_NONE = 0, /* nothing extra to do */
|
||||
AC97_TUNE_HP_ONLY, /* headphone (true line-out) control as master only */
|
||||
AC97_TUNE_SWAP_HP, /* swap headphone and master controls */
|
||||
AC97_TUNE_SWAP_SURROUND, /* swap master and surround controls */
|
||||
AC97_TUNE_AD_SHARING, /* for AD1985, turn on OMS bit and use headphone */
|
||||
AC97_TUNE_ALC_JACK, /* for Realtek, enable JACK detection */
|
||||
};
|
||||
|
||||
struct ac97_quirk {
|
||||
unsigned short vendor; /* PCI vendor id */
|
||||
unsigned short device; /* PCI device id */
|
||||
unsigned short mask; /* device id bit mask, 0 = accept all */
|
||||
const char *name; /* name shown as info */
|
||||
int type; /* quirk type above */
|
||||
};
|
||||
|
||||
struct pci_dev;
|
||||
extern int ac97_tune_hardware(struct pci_dev *pdev, struct ac97_quirk *quirk, int override);
|
||||
|
||||
#endif /* _AC97_CODEC_H_ */
|
||||
206
include/linux/acct.h
Normal file
206
include/linux/acct.h
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* BSD Process Accounting for Linux - Definitions
|
||||
*
|
||||
* Author: Marco van Wieringen (mvw@planets.elm.net)
|
||||
*
|
||||
* This header file contains the definitions needed to implement
|
||||
* BSD-style process accounting. The kernel accounting code and all
|
||||
* user-level programs that try to do something useful with the
|
||||
* process accounting log must include this file.
|
||||
*
|
||||
* Copyright (C) 1995 - 1997 Marco van Wieringen - ELM Consultancy B.V.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ACCT_H
|
||||
#define _LINUX_ACCT_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <asm/param.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/*
|
||||
* comp_t is a 16-bit "floating" point number with a 3-bit base 8
|
||||
* exponent and a 13-bit fraction.
|
||||
* comp2_t is 24-bit with 5-bit base 2 exponent and 20 bit fraction
|
||||
* (leading 1 not stored).
|
||||
* See linux/kernel/acct.c for the specific encoding systems used.
|
||||
*/
|
||||
|
||||
typedef __u16 comp_t;
|
||||
typedef __u32 comp2_t;
|
||||
|
||||
/*
|
||||
* accounting file record
|
||||
*
|
||||
* This structure contains all of the information written out to the
|
||||
* process accounting file whenever a process exits.
|
||||
*/
|
||||
|
||||
#define ACCT_COMM 16
|
||||
|
||||
struct acct
|
||||
{
|
||||
char ac_flag; /* Flags */
|
||||
char ac_version; /* Always set to ACCT_VERSION */
|
||||
/* for binary compatibility back until 2.0 */
|
||||
__u16 ac_uid16; /* LSB of Real User ID */
|
||||
__u16 ac_gid16; /* LSB of Real Group ID */
|
||||
__u16 ac_tty; /* Control Terminal */
|
||||
__u32 ac_btime; /* Process Creation Time */
|
||||
comp_t ac_utime; /* User Time */
|
||||
comp_t ac_stime; /* System Time */
|
||||
comp_t ac_etime; /* Elapsed Time */
|
||||
comp_t ac_mem; /* Average Memory Usage */
|
||||
comp_t ac_io; /* Chars Transferred */
|
||||
comp_t ac_rw; /* Blocks Read or Written */
|
||||
comp_t ac_minflt; /* Minor Pagefaults */
|
||||
comp_t ac_majflt; /* Major Pagefaults */
|
||||
comp_t ac_swaps; /* Number of Swaps */
|
||||
/* m68k had no padding here. */
|
||||
#if !defined(CONFIG_M68K) || !defined(__KERNEL__)
|
||||
__u16 ac_ahz; /* AHZ */
|
||||
#endif
|
||||
__u32 ac_exitcode; /* Exitcode */
|
||||
char ac_comm[ACCT_COMM + 1]; /* Command Name */
|
||||
__u8 ac_etime_hi; /* Elapsed Time MSB */
|
||||
__u16 ac_etime_lo; /* Elapsed Time LSB */
|
||||
__u32 ac_uid; /* Real User ID */
|
||||
__u32 ac_gid; /* Real Group ID */
|
||||
};
|
||||
|
||||
struct acct_v3
|
||||
{
|
||||
char ac_flag; /* Flags */
|
||||
char ac_version; /* Always set to ACCT_VERSION */
|
||||
__u16 ac_tty; /* Control Terminal */
|
||||
__u32 ac_exitcode; /* Exitcode */
|
||||
__u32 ac_uid; /* Real User ID */
|
||||
__u32 ac_gid; /* Real Group ID */
|
||||
__u32 ac_pid; /* Process ID */
|
||||
__u32 ac_ppid; /* Parent Process ID */
|
||||
__u32 ac_btime; /* Process Creation Time */
|
||||
#ifdef __KERNEL__
|
||||
__u32 ac_etime; /* Elapsed Time */
|
||||
#else
|
||||
float ac_etime; /* Elapsed Time */
|
||||
#endif
|
||||
comp_t ac_utime; /* User Time */
|
||||
comp_t ac_stime; /* System Time */
|
||||
comp_t ac_mem; /* Average Memory Usage */
|
||||
comp_t ac_io; /* Chars Transferred */
|
||||
comp_t ac_rw; /* Blocks Read or Written */
|
||||
comp_t ac_minflt; /* Minor Pagefaults */
|
||||
comp_t ac_majflt; /* Major Pagefaults */
|
||||
comp_t ac_swaps; /* Number of Swaps */
|
||||
char ac_comm[ACCT_COMM]; /* Command Name */
|
||||
};
|
||||
|
||||
/*
|
||||
* accounting flags
|
||||
*/
|
||||
/* bit set when the process ... */
|
||||
#define AFORK 0x01 /* ... executed fork, but did not exec */
|
||||
#define ASU 0x02 /* ... used super-user privileges */
|
||||
#define ACOMPAT 0x04 /* ... used compatibility mode (VAX only not used) */
|
||||
#define ACORE 0x08 /* ... dumped core */
|
||||
#define AXSIG 0x10 /* ... was killed by a signal */
|
||||
|
||||
#ifdef __BIG_ENDIAN
|
||||
#define ACCT_BYTEORDER 0x80 /* accounting file is big endian */
|
||||
#else
|
||||
#define ACCT_BYTEORDER 0x00 /* accounting file is little endian */
|
||||
#endif
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
|
||||
#ifdef CONFIG_BSD_PROCESS_ACCT
|
||||
struct vfsmount;
|
||||
struct super_block;
|
||||
struct pacct_struct;
|
||||
extern void acct_auto_close_mnt(struct vfsmount *m);
|
||||
extern void acct_auto_close(struct super_block *sb);
|
||||
extern void acct_init_pacct(struct pacct_struct *pacct);
|
||||
extern void acct_collect(long exitcode, int group_dead);
|
||||
extern void acct_process(void);
|
||||
#else
|
||||
#define acct_auto_close_mnt(x) do { } while (0)
|
||||
#define acct_auto_close(x) do { } while (0)
|
||||
#define acct_init_pacct(x) do { } while (0)
|
||||
#define acct_collect(x,y) do { } while (0)
|
||||
#define acct_process() do { } while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* ACCT_VERSION numbers as yet defined:
|
||||
* 0: old format (until 2.6.7) with 16 bit uid/gid
|
||||
* 1: extended variant (binary compatible on M68K)
|
||||
* 2: extended variant (binary compatible on everything except M68K)
|
||||
* 3: new binary incompatible format (64 bytes)
|
||||
* 4: new binary incompatible format (128 bytes)
|
||||
* 5: new binary incompatible format (128 bytes, second half)
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_BSD_PROCESS_ACCT_V3
|
||||
#define ACCT_VERSION 3
|
||||
#define AHZ 100
|
||||
typedef struct acct_v3 acct_t;
|
||||
#else
|
||||
#ifdef CONFIG_M68K
|
||||
#define ACCT_VERSION 1
|
||||
#else
|
||||
#define ACCT_VERSION 2
|
||||
#endif
|
||||
#define AHZ (USER_HZ)
|
||||
typedef struct acct acct_t;
|
||||
#endif
|
||||
|
||||
#else
|
||||
#define ACCT_VERSION 2
|
||||
#define AHZ (HZ)
|
||||
#endif /* __KERNEL */
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/jiffies.h>
|
||||
/*
|
||||
* Yet another set of HZ to *HZ helper functions.
|
||||
* See <linux/jiffies.h> for the original.
|
||||
*/
|
||||
|
||||
static inline u32 jiffies_to_AHZ(unsigned long x)
|
||||
{
|
||||
#if (TICK_NSEC % (NSEC_PER_SEC / AHZ)) == 0
|
||||
return x / (HZ / AHZ);
|
||||
#else
|
||||
u64 tmp = (u64)x * TICK_NSEC;
|
||||
do_div(tmp, (NSEC_PER_SEC / AHZ));
|
||||
return (long)tmp;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline u64 nsec_to_AHZ(u64 x)
|
||||
{
|
||||
#if (NSEC_PER_SEC % AHZ) == 0
|
||||
do_div(x, (NSEC_PER_SEC / AHZ));
|
||||
#elif (AHZ % 512) == 0
|
||||
x *= AHZ/512;
|
||||
do_div(x, (NSEC_PER_SEC / 512));
|
||||
#else
|
||||
/*
|
||||
* max relative error 5.7e-8 (1.8s per year) for AHZ <= 1024,
|
||||
* overflow after 64.99 years.
|
||||
* exact for AHZ=60, 72, 90, 120, 144, 180, 300, 600, 900, ...
|
||||
*/
|
||||
x *= 9;
|
||||
do_div(x, (unsigned long)((9ull * NSEC_PER_SEC + (AHZ/2))
|
||||
/ AHZ));
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
#endif /* __KERNEL */
|
||||
|
||||
#endif /* _LINUX_ACCT_H */
|
||||
248
include/linux/acpi.h
Normal file
248
include/linux/acpi.h
Normal file
@@ -0,0 +1,248 @@
|
||||
/*
|
||||
* acpi.h - ACPI Interface
|
||||
*
|
||||
* Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ACPI_H
|
||||
#define _LINUX_ACPI_H
|
||||
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
#ifndef _LINUX
|
||||
#define _LINUX
|
||||
#endif
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
#include <acpi/acpi.h>
|
||||
#include <acpi/acpi_bus.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
#include <acpi/acpi_numa.h>
|
||||
#include <asm/acpi.h>
|
||||
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
enum acpi_irq_model_id {
|
||||
ACPI_IRQ_MODEL_PIC = 0,
|
||||
ACPI_IRQ_MODEL_IOAPIC,
|
||||
ACPI_IRQ_MODEL_IOSAPIC,
|
||||
ACPI_IRQ_MODEL_PLATFORM,
|
||||
ACPI_IRQ_MODEL_COUNT
|
||||
};
|
||||
|
||||
extern enum acpi_irq_model_id acpi_irq_model;
|
||||
|
||||
enum acpi_interrupt_id {
|
||||
ACPI_INTERRUPT_PMI = 1,
|
||||
ACPI_INTERRUPT_INIT,
|
||||
ACPI_INTERRUPT_CPEI,
|
||||
ACPI_INTERRUPT_COUNT
|
||||
};
|
||||
|
||||
#define ACPI_SPACE_MEM 0
|
||||
|
||||
enum acpi_address_range_id {
|
||||
ACPI_ADDRESS_RANGE_MEMORY = 1,
|
||||
ACPI_ADDRESS_RANGE_RESERVED = 2,
|
||||
ACPI_ADDRESS_RANGE_ACPI = 3,
|
||||
ACPI_ADDRESS_RANGE_NVS = 4,
|
||||
ACPI_ADDRESS_RANGE_COUNT
|
||||
};
|
||||
|
||||
|
||||
/* Table Handlers */
|
||||
|
||||
typedef int (*acpi_table_handler) (struct acpi_table_header *table);
|
||||
|
||||
typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
|
||||
|
||||
char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
|
||||
unsigned long acpi_find_rsdp (void);
|
||||
int acpi_boot_init (void);
|
||||
int acpi_boot_table_init (void);
|
||||
int acpi_numa_init (void);
|
||||
|
||||
int acpi_table_init (void);
|
||||
int acpi_table_parse (char *id, acpi_table_handler handler);
|
||||
int __init acpi_table_parse_entries(char *id, unsigned long table_size,
|
||||
int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
|
||||
int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
|
||||
int acpi_table_parse_srat (enum acpi_srat_type id, acpi_table_entry_handler handler, unsigned int max_entries);
|
||||
int acpi_parse_mcfg (struct acpi_table_header *header);
|
||||
void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
|
||||
void acpi_table_print_srat_entry (struct acpi_subtable_header *srat);
|
||||
|
||||
/* the following four functions are architecture-dependent */
|
||||
#ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
|
||||
#define NR_NODE_MEMBLKS MAX_NUMNODES
|
||||
#define acpi_numa_slit_init(slit) do {} while (0)
|
||||
#define acpi_numa_processor_affinity_init(pa) do {} while (0)
|
||||
#define acpi_numa_memory_affinity_init(ma) do {} while (0)
|
||||
#define acpi_numa_arch_fixup() do {} while (0)
|
||||
#else
|
||||
void acpi_numa_slit_init (struct acpi_table_slit *slit);
|
||||
void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
|
||||
void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
|
||||
void acpi_numa_arch_fixup(void);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_HOTPLUG_CPU
|
||||
/* Arch dependent functions for cpu hotplug support */
|
||||
int acpi_map_lsapic(acpi_handle handle, int *pcpu);
|
||||
int acpi_unmap_lsapic(int cpu);
|
||||
#endif /* CONFIG_ACPI_HOTPLUG_CPU */
|
||||
|
||||
int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
|
||||
int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
|
||||
|
||||
extern int acpi_mp_config;
|
||||
|
||||
extern struct acpi_mcfg_allocation *pci_mmcfg_config;
|
||||
extern int pci_mmcfg_config_num;
|
||||
|
||||
extern int sbf_port;
|
||||
extern unsigned long acpi_video_flags;
|
||||
|
||||
#else /* !CONFIG_ACPI */
|
||||
|
||||
#define acpi_mp_config 0
|
||||
|
||||
#endif /* !CONFIG_ACPI */
|
||||
|
||||
int acpi_register_gsi (u32 gsi, int triggering, int polarity);
|
||||
int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
|
||||
|
||||
/*
|
||||
* This function undoes the effect of one call to acpi_register_gsi().
|
||||
* If this matches the last registration, any IRQ resources for gsi
|
||||
* are freed.
|
||||
*/
|
||||
void acpi_unregister_gsi (u32 gsi);
|
||||
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
struct acpi_prt_entry {
|
||||
struct list_head node;
|
||||
struct acpi_pci_id id;
|
||||
u8 pin;
|
||||
struct {
|
||||
acpi_handle handle;
|
||||
u32 index;
|
||||
} link;
|
||||
u32 irq;
|
||||
};
|
||||
|
||||
struct acpi_prt_list {
|
||||
int count;
|
||||
struct list_head entries;
|
||||
};
|
||||
|
||||
struct pci_dev;
|
||||
|
||||
int acpi_pci_irq_enable (struct pci_dev *dev);
|
||||
void acpi_penalize_isa_irq(int irq, int active);
|
||||
|
||||
void acpi_pci_irq_disable (struct pci_dev *dev);
|
||||
|
||||
struct acpi_pci_driver {
|
||||
struct acpi_pci_driver *next;
|
||||
int (*add)(acpi_handle handle);
|
||||
void (*remove)(acpi_handle handle);
|
||||
};
|
||||
|
||||
int acpi_pci_register_driver(struct acpi_pci_driver *driver);
|
||||
void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
|
||||
|
||||
#endif /* CONFIG_ACPI */
|
||||
|
||||
#ifdef CONFIG_ACPI_EC
|
||||
|
||||
extern int ec_read(u8 addr, u8 *val);
|
||||
extern int ec_write(u8 addr, u8 val);
|
||||
extern int ec_transaction(u8 command,
|
||||
const u8 *wdata, unsigned wdata_len,
|
||||
u8 *rdata, unsigned rdata_len);
|
||||
|
||||
#endif /*CONFIG_ACPI_EC*/
|
||||
|
||||
extern int acpi_blacklisted(void);
|
||||
extern void acpi_bios_year(char *s);
|
||||
|
||||
#define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
|
||||
#ifdef CONFIG_ACPI
|
||||
|
||||
/*
|
||||
* Set highest legal C-state
|
||||
* 0: C0 okay, but not C1
|
||||
* 1: C1 okay, but not C2
|
||||
* 2: C2 okay, but not C3 etc.
|
||||
*/
|
||||
|
||||
extern unsigned int max_cstate;
|
||||
|
||||
static inline unsigned int acpi_get_cstate_limit(void)
|
||||
{
|
||||
return max_cstate;
|
||||
}
|
||||
static inline void acpi_set_cstate_limit(unsigned int new_limit)
|
||||
{
|
||||
max_cstate = new_limit;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
|
||||
static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_ACPI_NUMA
|
||||
int acpi_get_pxm(acpi_handle handle);
|
||||
int acpi_get_node(acpi_handle *handle);
|
||||
#else
|
||||
static inline int acpi_get_pxm(acpi_handle handle)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline int acpi_get_node(acpi_handle *handle)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
extern int acpi_paddr_to_node(u64 start_addr, u64 size);
|
||||
|
||||
extern int pnpacpi_disabled;
|
||||
|
||||
#else /* CONFIG_ACPI */
|
||||
|
||||
static inline int acpi_boot_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int acpi_boot_table_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ACPI */
|
||||
#endif /*_LINUX_ACPI_H*/
|
||||
38
include/linux/acpi_pmtmr.h
Normal file
38
include/linux/acpi_pmtmr.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef _ACPI_PMTMR_H_
|
||||
#define _ACPI_PMTMR_H_
|
||||
|
||||
#include <linux/clocksource.h>
|
||||
|
||||
/* Number of PMTMR ticks expected during calibration run */
|
||||
#define PMTMR_TICKS_PER_SEC 3579545
|
||||
|
||||
/* limit it to 24 bits */
|
||||
#define ACPI_PM_MASK CLOCKSOURCE_MASK(24)
|
||||
|
||||
/* Overrun value */
|
||||
#define ACPI_PM_OVRRUN (1<<24)
|
||||
|
||||
#ifdef CONFIG_X86_PM_TIMER
|
||||
|
||||
extern u32 acpi_pm_read_verified(void);
|
||||
extern u32 pmtmr_ioport;
|
||||
|
||||
static inline u32 acpi_pm_read_early(void)
|
||||
{
|
||||
if (!pmtmr_ioport)
|
||||
return 0;
|
||||
/* mask the output to 24 bits */
|
||||
return acpi_pm_read_verified() & ACPI_PM_MASK;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline u32 acpi_pm_read_early(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
104
include/linux/adb.h
Normal file
104
include/linux/adb.h
Normal file
@@ -0,0 +1,104 @@
|
||||
/*
|
||||
* Definitions for ADB (Apple Desktop Bus) support.
|
||||
*/
|
||||
#ifndef __ADB_H
|
||||
#define __ADB_H
|
||||
|
||||
/* ADB commands */
|
||||
#define ADB_BUSRESET 0
|
||||
#define ADB_FLUSH(id) (0x01 | ((id) << 4))
|
||||
#define ADB_WRITEREG(id, reg) (0x08 | (reg) | ((id) << 4))
|
||||
#define ADB_READREG(id, reg) (0x0C | (reg) | ((id) << 4))
|
||||
|
||||
/* ADB default device IDs (upper 4 bits of ADB command byte) */
|
||||
#define ADB_DONGLE 1 /* "software execution control" devices */
|
||||
#define ADB_KEYBOARD 2
|
||||
#define ADB_MOUSE 3
|
||||
#define ADB_TABLET 4
|
||||
#define ADB_MODEM 5
|
||||
#define ADB_MISC 7 /* maybe a monitor */
|
||||
|
||||
#define ADB_RET_OK 0
|
||||
#define ADB_RET_TIMEOUT 3
|
||||
|
||||
/* The kind of ADB request. The controller may emulate some
|
||||
or all of those CUDA/PMU packet kinds */
|
||||
#define ADB_PACKET 0
|
||||
#define CUDA_PACKET 1
|
||||
#define ERROR_PACKET 2
|
||||
#define TIMER_PACKET 3
|
||||
#define POWER_PACKET 4
|
||||
#define MACIIC_PACKET 5
|
||||
#define PMU_PACKET 6
|
||||
#define ADB_QUERY 7
|
||||
|
||||
/* ADB queries */
|
||||
|
||||
/* ADB_QUERY_GETDEVINFO
|
||||
* Query ADB slot for device presence
|
||||
* data[2] = id, rep[0] = orig addr, rep[1] = handler_id
|
||||
*/
|
||||
#define ADB_QUERY_GETDEVINFO 1
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct adb_request {
|
||||
unsigned char data[32];
|
||||
int nbytes;
|
||||
unsigned char reply[32];
|
||||
int reply_len;
|
||||
unsigned char reply_expected;
|
||||
unsigned char sent;
|
||||
unsigned char complete;
|
||||
void (*done)(struct adb_request *);
|
||||
void *arg;
|
||||
struct adb_request *next;
|
||||
};
|
||||
|
||||
struct adb_ids {
|
||||
int nids;
|
||||
unsigned char id[16];
|
||||
};
|
||||
|
||||
/* Structure which encapsulates a low-level ADB driver */
|
||||
|
||||
struct adb_driver {
|
||||
char name[16];
|
||||
int (*probe)(void);
|
||||
int (*init)(void);
|
||||
int (*send_request)(struct adb_request *req, int sync);
|
||||
int (*autopoll)(int devs);
|
||||
void (*poll)(void);
|
||||
int (*reset_bus)(void);
|
||||
};
|
||||
|
||||
/* Values for adb_request flags */
|
||||
#define ADBREQ_REPLY 1 /* expect reply */
|
||||
#define ADBREQ_SYNC 2 /* poll until done */
|
||||
#define ADBREQ_NOSEND 4 /* build the request, but don't send it */
|
||||
|
||||
/* Messages sent thru the client_list notifier. You should NOT stop
|
||||
the operation, at least not with this version */
|
||||
enum adb_message {
|
||||
ADB_MSG_POWERDOWN, /* Currently called before sleep only */
|
||||
ADB_MSG_PRE_RESET, /* Called before resetting the bus */
|
||||
ADB_MSG_POST_RESET /* Called after resetting the bus (re-do init & register) */
|
||||
};
|
||||
extern struct adb_driver *adb_controller;
|
||||
extern struct blocking_notifier_head adb_client_list;
|
||||
|
||||
int adb_request(struct adb_request *req, void (*done)(struct adb_request *),
|
||||
int flags, int nbytes, ...);
|
||||
int adb_register(int default_id,int handler_id,struct adb_ids *ids,
|
||||
void (*handler)(unsigned char *, int, int));
|
||||
int adb_unregister(int index);
|
||||
void adb_poll(void);
|
||||
void adb_input(unsigned char *, int, int);
|
||||
int adb_reset_bus(void);
|
||||
|
||||
int adb_try_handler_change(int address, int new_id);
|
||||
int adb_get_infos(int address, int *original_address, int *handler_id);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ADB_H */
|
||||
76
include/linux/adfs_fs.h
Normal file
76
include/linux/adfs_fs.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef _ADFS_FS_H
|
||||
#define _ADFS_FS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/magic.h>
|
||||
|
||||
/*
|
||||
* Disc Record at disc address 0xc00
|
||||
*/
|
||||
struct adfs_discrecord {
|
||||
__u8 log2secsize;
|
||||
__u8 secspertrack;
|
||||
__u8 heads;
|
||||
__u8 density;
|
||||
__u8 idlen;
|
||||
__u8 log2bpmb;
|
||||
__u8 skew;
|
||||
__u8 bootoption;
|
||||
__u8 lowsector;
|
||||
__u8 nzones;
|
||||
__le16 zone_spare;
|
||||
__le32 root;
|
||||
__le32 disc_size;
|
||||
__le16 disc_id;
|
||||
__u8 disc_name[10];
|
||||
__le32 disc_type;
|
||||
__le32 disc_size_high;
|
||||
__u8 log2sharesize:4;
|
||||
__u8 unused40:4;
|
||||
__u8 big_flag:1;
|
||||
__u8 unused41:1;
|
||||
__u8 nzones_high;
|
||||
__le32 format_version;
|
||||
__le32 root_size;
|
||||
__u8 unused52[60 - 52];
|
||||
};
|
||||
|
||||
#define ADFS_DISCRECORD (0xc00)
|
||||
#define ADFS_DR_OFFSET (0x1c0)
|
||||
#define ADFS_DR_SIZE 60
|
||||
#define ADFS_DR_SIZE_BITS (ADFS_DR_SIZE << 3)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/adfs_fs_i.h>
|
||||
#include <linux/adfs_fs_sb.h>
|
||||
/*
|
||||
* Calculate the boot block checksum on an ADFS drive. Note that this will
|
||||
* appear to be correct if the sector contains all zeros, so also check that
|
||||
* the disk size is non-zero!!!
|
||||
*/
|
||||
static inline int adfs_checkbblk(unsigned char *ptr)
|
||||
{
|
||||
unsigned int result = 0;
|
||||
unsigned char *p = ptr + 511;
|
||||
|
||||
do {
|
||||
result = (result & 0xff) + (result >> 8);
|
||||
result = result + *--p;
|
||||
} while (p != ptr);
|
||||
|
||||
return (result & 0xff) != ptr[511];
|
||||
}
|
||||
|
||||
static inline struct adfs_sb_info *ADFS_SB(struct super_block *sb)
|
||||
{
|
||||
return sb->s_fs_info;
|
||||
}
|
||||
|
||||
static inline struct adfs_inode_info *ADFS_I(struct inode *inode)
|
||||
{
|
||||
return container_of(inode, struct adfs_inode_info, vfs_inode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
24
include/linux/adfs_fs_i.h
Normal file
24
include/linux/adfs_fs_i.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* linux/include/linux/adfs_fs_i.h
|
||||
*
|
||||
* Copyright (C) 1997 Russell King
|
||||
*/
|
||||
|
||||
#ifndef _ADFS_FS_I
|
||||
#define _ADFS_FS_I
|
||||
|
||||
/*
|
||||
* adfs file system inode data in memory
|
||||
*/
|
||||
struct adfs_inode_info {
|
||||
loff_t mmu_private;
|
||||
unsigned long parent_id; /* object id of parent */
|
||||
__u32 loadaddr; /* RISC OS load address */
|
||||
__u32 execaddr; /* RISC OS exec address */
|
||||
unsigned int filetype; /* RISC OS file type */
|
||||
unsigned int attr; /* RISC OS permissions */
|
||||
unsigned int stamped:1; /* RISC OS file has date/time */
|
||||
struct inode vfs_inode;
|
||||
};
|
||||
|
||||
#endif
|
||||
38
include/linux/adfs_fs_sb.h
Normal file
38
include/linux/adfs_fs_sb.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* linux/include/linux/adfs_fs_sb.h
|
||||
*
|
||||
* Copyright (C) 1997-1999 Russell King
|
||||
*/
|
||||
|
||||
#ifndef _ADFS_FS_SB
|
||||
#define _ADFS_FS_SB
|
||||
|
||||
/*
|
||||
* Forward-declare this
|
||||
*/
|
||||
struct adfs_discmap;
|
||||
struct adfs_dir_ops;
|
||||
|
||||
/*
|
||||
* ADFS file system superblock data in memory
|
||||
*/
|
||||
struct adfs_sb_info {
|
||||
struct adfs_discmap *s_map; /* bh list containing map */
|
||||
struct adfs_dir_ops *s_dir; /* directory operations */
|
||||
|
||||
uid_t s_uid; /* owner uid */
|
||||
gid_t s_gid; /* owner gid */
|
||||
umode_t s_owner_mask; /* ADFS owner perm -> unix perm */
|
||||
umode_t s_other_mask; /* ADFS other perm -> unix perm */
|
||||
|
||||
__u32 s_ids_per_zone; /* max. no ids in one zone */
|
||||
__u32 s_idlen; /* length of ID in map */
|
||||
__u32 s_map_size; /* sector size of a map */
|
||||
unsigned long s_size; /* total size (in blocks) of this fs */
|
||||
signed int s_map2blk; /* shift left by this for map->sector */
|
||||
unsigned int s_log2sharesize;/* log2 share size */
|
||||
__le32 s_version; /* disc format version */
|
||||
unsigned int s_namelen; /* maximum number of characters in name */
|
||||
};
|
||||
|
||||
#endif
|
||||
24
include/linux/aer.h
Normal file
24
include/linux/aer.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Intel Corp.
|
||||
* Tom Long Nguyen (tom.l.nguyen@intel.com)
|
||||
* Zhang Yanmin (yanmin.zhang@intel.com)
|
||||
*/
|
||||
|
||||
#ifndef _AER_H_
|
||||
#define _AER_H_
|
||||
|
||||
#if defined(CONFIG_PCIEAER)
|
||||
/* pci-e port driver needs this function to enable aer */
|
||||
extern int pci_enable_pcie_error_reporting(struct pci_dev *dev);
|
||||
extern int pci_find_aer_capability(struct pci_dev *dev);
|
||||
extern int pci_disable_pcie_error_reporting(struct pci_dev *dev);
|
||||
extern int pci_cleanup_aer_uncorrect_error_status(struct pci_dev *dev);
|
||||
#else
|
||||
#define pci_enable_pcie_error_reporting(dev) do { } while (0)
|
||||
#define pci_find_aer_capability(dev) do { } while (0)
|
||||
#define pci_disable_pcie_error_reporting(dev) do { } while (0)
|
||||
#define pci_cleanup_aer_uncorrect_error_status(dev) do { } while (0)
|
||||
#endif
|
||||
|
||||
#endif //_AER_H_
|
||||
|
||||
68
include/linux/affs_hardblocks.h
Normal file
68
include/linux/affs_hardblocks.h
Normal file
@@ -0,0 +1,68 @@
|
||||
#ifndef AFFS_HARDBLOCKS_H
|
||||
#define AFFS_HARDBLOCKS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* Just the needed definitions for the RDB of an Amiga HD. */
|
||||
|
||||
struct RigidDiskBlock {
|
||||
__u32 rdb_ID;
|
||||
__be32 rdb_SummedLongs;
|
||||
__s32 rdb_ChkSum;
|
||||
__u32 rdb_HostID;
|
||||
__be32 rdb_BlockBytes;
|
||||
__u32 rdb_Flags;
|
||||
__u32 rdb_BadBlockList;
|
||||
__be32 rdb_PartitionList;
|
||||
__u32 rdb_FileSysHeaderList;
|
||||
__u32 rdb_DriveInit;
|
||||
__u32 rdb_Reserved1[6];
|
||||
__u32 rdb_Cylinders;
|
||||
__u32 rdb_Sectors;
|
||||
__u32 rdb_Heads;
|
||||
__u32 rdb_Interleave;
|
||||
__u32 rdb_Park;
|
||||
__u32 rdb_Reserved2[3];
|
||||
__u32 rdb_WritePreComp;
|
||||
__u32 rdb_ReducedWrite;
|
||||
__u32 rdb_StepRate;
|
||||
__u32 rdb_Reserved3[5];
|
||||
__u32 rdb_RDBBlocksLo;
|
||||
__u32 rdb_RDBBlocksHi;
|
||||
__u32 rdb_LoCylinder;
|
||||
__u32 rdb_HiCylinder;
|
||||
__u32 rdb_CylBlocks;
|
||||
__u32 rdb_AutoParkSeconds;
|
||||
__u32 rdb_HighRDSKBlock;
|
||||
__u32 rdb_Reserved4;
|
||||
char rdb_DiskVendor[8];
|
||||
char rdb_DiskProduct[16];
|
||||
char rdb_DiskRevision[4];
|
||||
char rdb_ControllerVendor[8];
|
||||
char rdb_ControllerProduct[16];
|
||||
char rdb_ControllerRevision[4];
|
||||
__u32 rdb_Reserved5[10];
|
||||
};
|
||||
|
||||
#define IDNAME_RIGIDDISK 0x5244534B /* "RDSK" */
|
||||
|
||||
struct PartitionBlock {
|
||||
__be32 pb_ID;
|
||||
__be32 pb_SummedLongs;
|
||||
__s32 pb_ChkSum;
|
||||
__u32 pb_HostID;
|
||||
__be32 pb_Next;
|
||||
__u32 pb_Flags;
|
||||
__u32 pb_Reserved1[2];
|
||||
__u32 pb_DevFlags;
|
||||
__u8 pb_DriveName[32];
|
||||
__u32 pb_Reserved2[15];
|
||||
__be32 pb_Environment[17];
|
||||
__u32 pb_EReserved[15];
|
||||
};
|
||||
|
||||
#define IDNAME_PARTITION 0x50415254 /* "PART" */
|
||||
|
||||
#define RDB_ALLOCATION_LIMIT 16
|
||||
|
||||
#endif /* AFFS_HARDBLOCKS_H */
|
||||
114
include/linux/agp_backend.h
Normal file
114
include/linux/agp_backend.h
Normal file
@@ -0,0 +1,114 @@
|
||||
/*
|
||||
* AGPGART backend specific includes. Not for userspace consumption.
|
||||
*
|
||||
* Copyright (C) 2004 Silicon Graphics, Inc.
|
||||
* Copyright (C) 2002-2003 Dave Jones
|
||||
* Copyright (C) 1999 Jeff Hartmann
|
||||
* Copyright (C) 1999 Precision Insight, Inc.
|
||||
* Copyright (C) 1999 Xi Graphics, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AGP_BACKEND_H
|
||||
#define _AGP_BACKEND_H 1
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
enum chipset_type {
|
||||
NOT_SUPPORTED,
|
||||
SUPPORTED,
|
||||
};
|
||||
|
||||
struct agp_version {
|
||||
u16 major;
|
||||
u16 minor;
|
||||
};
|
||||
|
||||
struct agp_kern_info {
|
||||
struct agp_version version;
|
||||
struct pci_dev *device;
|
||||
enum chipset_type chipset;
|
||||
unsigned long mode;
|
||||
unsigned long aper_base;
|
||||
size_t aper_size;
|
||||
int max_memory; /* In pages */
|
||||
int current_memory;
|
||||
int cant_use_aperture;
|
||||
unsigned long page_mask;
|
||||
struct vm_operations_struct *vm_ops;
|
||||
};
|
||||
|
||||
/*
|
||||
* The agp_memory structure has information about the block of agp memory
|
||||
* allocated. A caller may manipulate the next and prev pointers to link
|
||||
* each allocated item into a list. These pointers are ignored by the backend.
|
||||
* Everything else should never be written to, but the caller may read any of
|
||||
* the items to determine the status of this block of agp memory.
|
||||
*/
|
||||
|
||||
struct agp_bridge_data;
|
||||
|
||||
struct agp_memory {
|
||||
struct agp_memory *next;
|
||||
struct agp_memory *prev;
|
||||
struct agp_bridge_data *bridge;
|
||||
unsigned long *memory;
|
||||
size_t page_count;
|
||||
int key;
|
||||
int num_scratch_pages;
|
||||
off_t pg_start;
|
||||
u32 type;
|
||||
u32 physical;
|
||||
u8 is_bound;
|
||||
u8 is_flushed;
|
||||
u8 vmalloc_flag;
|
||||
};
|
||||
|
||||
#define AGP_NORMAL_MEMORY 0
|
||||
|
||||
#define AGP_USER_TYPES (1 << 16)
|
||||
#define AGP_USER_MEMORY (AGP_USER_TYPES)
|
||||
#define AGP_USER_CACHED_MEMORY (AGP_USER_TYPES + 1)
|
||||
|
||||
extern struct agp_bridge_data *agp_bridge;
|
||||
extern struct list_head agp_bridges;
|
||||
|
||||
extern struct agp_bridge_data *(*agp_find_bridge)(struct pci_dev *);
|
||||
|
||||
extern void agp_free_memory(struct agp_memory *);
|
||||
extern struct agp_memory *agp_allocate_memory(struct agp_bridge_data *, size_t, u32);
|
||||
extern int agp_copy_info(struct agp_bridge_data *, struct agp_kern_info *);
|
||||
extern int agp_bind_memory(struct agp_memory *, off_t);
|
||||
extern int agp_unbind_memory(struct agp_memory *);
|
||||
extern void agp_enable(struct agp_bridge_data *, u32);
|
||||
extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
|
||||
extern void agp_backend_release(struct agp_bridge_data *);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _AGP_BACKEND_H */
|
||||
214
include/linux/agpgart.h
Normal file
214
include/linux/agpgart.h
Normal file
@@ -0,0 +1,214 @@
|
||||
/*
|
||||
* AGPGART module version 0.99
|
||||
* Copyright (C) 1999 Jeff Hartmann
|
||||
* Copyright (C) 1999 Precision Insight, Inc.
|
||||
* Copyright (C) 1999 Xi Graphics, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* JEFF HARTMANN, OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM,
|
||||
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _AGP_H
|
||||
#define _AGP_H 1
|
||||
|
||||
#define AGPIOC_BASE 'A'
|
||||
#define AGPIOC_INFO _IOR (AGPIOC_BASE, 0, struct agp_info*)
|
||||
#define AGPIOC_ACQUIRE _IO (AGPIOC_BASE, 1)
|
||||
#define AGPIOC_RELEASE _IO (AGPIOC_BASE, 2)
|
||||
#define AGPIOC_SETUP _IOW (AGPIOC_BASE, 3, struct agp_setup*)
|
||||
#define AGPIOC_RESERVE _IOW (AGPIOC_BASE, 4, struct agp_region*)
|
||||
#define AGPIOC_PROTECT _IOW (AGPIOC_BASE, 5, struct agp_region*)
|
||||
#define AGPIOC_ALLOCATE _IOWR(AGPIOC_BASE, 6, struct agp_allocate*)
|
||||
#define AGPIOC_DEALLOCATE _IOW (AGPIOC_BASE, 7, int)
|
||||
#define AGPIOC_BIND _IOW (AGPIOC_BASE, 8, struct agp_bind*)
|
||||
#define AGPIOC_UNBIND _IOW (AGPIOC_BASE, 9, struct agp_unbind*)
|
||||
|
||||
#define AGP_DEVICE "/dev/agpgart"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#ifndef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#include <asm/types.h>
|
||||
|
||||
struct agp_version {
|
||||
__u16 major;
|
||||
__u16 minor;
|
||||
};
|
||||
|
||||
typedef struct _agp_info {
|
||||
struct agp_version version; /* version of the driver */
|
||||
__u32 bridge_id; /* bridge vendor/device */
|
||||
__u32 agp_mode; /* mode info of bridge */
|
||||
unsigned long aper_base;/* base of aperture */
|
||||
size_t aper_size; /* size of aperture */
|
||||
size_t pg_total; /* max pages (swap + system) */
|
||||
size_t pg_system; /* max pages (system) */
|
||||
size_t pg_used; /* current pages used */
|
||||
} agp_info;
|
||||
|
||||
typedef struct _agp_setup {
|
||||
__u32 agp_mode; /* mode info of bridge */
|
||||
} agp_setup;
|
||||
|
||||
/*
|
||||
* The "prot" down below needs still a "sleep" flag somehow ...
|
||||
*/
|
||||
typedef struct _agp_segment {
|
||||
off_t pg_start; /* starting page to populate */
|
||||
size_t pg_count; /* number of pages */
|
||||
int prot; /* prot flags for mmap */
|
||||
} agp_segment;
|
||||
|
||||
typedef struct _agp_region {
|
||||
pid_t pid; /* pid of process */
|
||||
size_t seg_count; /* number of segments */
|
||||
struct _agp_segment *seg_list;
|
||||
} agp_region;
|
||||
|
||||
typedef struct _agp_allocate {
|
||||
int key; /* tag of allocation */
|
||||
size_t pg_count; /* number of pages */
|
||||
__u32 type; /* 0 == normal, other devspec */
|
||||
__u32 physical; /* device specific (some devices
|
||||
* need a phys address of the
|
||||
* actual page behind the gatt
|
||||
* table) */
|
||||
} agp_allocate;
|
||||
|
||||
typedef struct _agp_bind {
|
||||
int key; /* tag of allocation */
|
||||
off_t pg_start; /* starting page to populate */
|
||||
} agp_bind;
|
||||
|
||||
typedef struct _agp_unbind {
|
||||
int key; /* tag of allocation */
|
||||
__u32 priority; /* priority for paging out */
|
||||
} agp_unbind;
|
||||
|
||||
#else /* __KERNEL__ */
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/agp_backend.h>
|
||||
|
||||
#define AGPGART_MINOR 175
|
||||
|
||||
struct agp_info {
|
||||
struct agp_version version; /* version of the driver */
|
||||
u32 bridge_id; /* bridge vendor/device */
|
||||
u32 agp_mode; /* mode info of bridge */
|
||||
unsigned long aper_base;/* base of aperture */
|
||||
size_t aper_size; /* size of aperture */
|
||||
size_t pg_total; /* max pages (swap + system) */
|
||||
size_t pg_system; /* max pages (system) */
|
||||
size_t pg_used; /* current pages used */
|
||||
};
|
||||
|
||||
struct agp_setup {
|
||||
u32 agp_mode; /* mode info of bridge */
|
||||
};
|
||||
|
||||
/*
|
||||
* The "prot" down below needs still a "sleep" flag somehow ...
|
||||
*/
|
||||
struct agp_segment {
|
||||
off_t pg_start; /* starting page to populate */
|
||||
size_t pg_count; /* number of pages */
|
||||
int prot; /* prot flags for mmap */
|
||||
};
|
||||
|
||||
struct agp_segment_priv {
|
||||
off_t pg_start;
|
||||
size_t pg_count;
|
||||
pgprot_t prot;
|
||||
};
|
||||
|
||||
struct agp_region {
|
||||
pid_t pid; /* pid of process */
|
||||
size_t seg_count; /* number of segments */
|
||||
struct agp_segment *seg_list;
|
||||
};
|
||||
|
||||
struct agp_allocate {
|
||||
int key; /* tag of allocation */
|
||||
size_t pg_count; /* number of pages */
|
||||
u32 type; /* 0 == normal, other devspec */
|
||||
u32 physical; /* device specific (some devices
|
||||
* need a phys address of the
|
||||
* actual page behind the gatt
|
||||
* table) */
|
||||
};
|
||||
|
||||
struct agp_bind {
|
||||
int key; /* tag of allocation */
|
||||
off_t pg_start; /* starting page to populate */
|
||||
};
|
||||
|
||||
struct agp_unbind {
|
||||
int key; /* tag of allocation */
|
||||
u32 priority; /* priority for paging out */
|
||||
};
|
||||
|
||||
struct agp_client {
|
||||
struct agp_client *next;
|
||||
struct agp_client *prev;
|
||||
pid_t pid;
|
||||
int num_segments;
|
||||
struct agp_segment_priv **segments;
|
||||
};
|
||||
|
||||
struct agp_controller {
|
||||
struct agp_controller *next;
|
||||
struct agp_controller *prev;
|
||||
pid_t pid;
|
||||
int num_clients;
|
||||
struct agp_memory *pool;
|
||||
struct agp_client *clients;
|
||||
};
|
||||
|
||||
#define AGP_FF_ALLOW_CLIENT 0
|
||||
#define AGP_FF_ALLOW_CONTROLLER 1
|
||||
#define AGP_FF_IS_CLIENT 2
|
||||
#define AGP_FF_IS_CONTROLLER 3
|
||||
#define AGP_FF_IS_VALID 4
|
||||
|
||||
struct agp_file_private {
|
||||
struct agp_file_private *next;
|
||||
struct agp_file_private *prev;
|
||||
pid_t my_pid;
|
||||
long access_flags; /* long req'd for set_bit --RR */
|
||||
};
|
||||
|
||||
struct agp_front_data {
|
||||
struct mutex agp_mutex;
|
||||
struct agp_controller *current_controller;
|
||||
struct agp_controller *controllers;
|
||||
struct agp_file_private *file_priv_list;
|
||||
u8 used_by_controller;
|
||||
u8 backend_acquired;
|
||||
};
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* _AGP_H */
|
||||
253
include/linux/aio.h
Normal file
253
include/linux/aio.h
Normal file
@@ -0,0 +1,253 @@
|
||||
#ifndef __LINUX__AIO_H
|
||||
#define __LINUX__AIO_H
|
||||
|
||||
#include <linux/list.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/aio_abi.h>
|
||||
#include <linux/uio.h>
|
||||
|
||||
#include <asm/atomic.h>
|
||||
#include <linux/uio.h>
|
||||
|
||||
#define AIO_MAXSEGS 4
|
||||
#define AIO_KIOGRP_NR_ATOMIC 8
|
||||
|
||||
struct kioctx;
|
||||
|
||||
/* Notes on cancelling a kiocb:
|
||||
* If a kiocb is cancelled, aio_complete may return 0 to indicate
|
||||
* that cancel has not yet disposed of the kiocb. All cancel
|
||||
* operations *must* call aio_put_req to dispose of the kiocb
|
||||
* to guard against races with the completion code.
|
||||
*/
|
||||
#define KIOCB_C_CANCELLED 0x01
|
||||
#define KIOCB_C_COMPLETE 0x02
|
||||
|
||||
#define KIOCB_SYNC_KEY (~0U)
|
||||
|
||||
/* ki_flags bits */
|
||||
/*
|
||||
* This may be used for cancel/retry serialization in the future, but
|
||||
* for now it's unused and we probably don't want modules to even
|
||||
* think they can use it.
|
||||
*/
|
||||
/* #define KIF_LOCKED 0 */
|
||||
#define KIF_KICKED 1
|
||||
#define KIF_CANCELLED 2
|
||||
|
||||
#define kiocbTryLock(iocb) test_and_set_bit(KIF_LOCKED, &(iocb)->ki_flags)
|
||||
#define kiocbTryKick(iocb) test_and_set_bit(KIF_KICKED, &(iocb)->ki_flags)
|
||||
|
||||
#define kiocbSetLocked(iocb) set_bit(KIF_LOCKED, &(iocb)->ki_flags)
|
||||
#define kiocbSetKicked(iocb) set_bit(KIF_KICKED, &(iocb)->ki_flags)
|
||||
#define kiocbSetCancelled(iocb) set_bit(KIF_CANCELLED, &(iocb)->ki_flags)
|
||||
|
||||
#define kiocbClearLocked(iocb) clear_bit(KIF_LOCKED, &(iocb)->ki_flags)
|
||||
#define kiocbClearKicked(iocb) clear_bit(KIF_KICKED, &(iocb)->ki_flags)
|
||||
#define kiocbClearCancelled(iocb) clear_bit(KIF_CANCELLED, &(iocb)->ki_flags)
|
||||
|
||||
#define kiocbIsLocked(iocb) test_bit(KIF_LOCKED, &(iocb)->ki_flags)
|
||||
#define kiocbIsKicked(iocb) test_bit(KIF_KICKED, &(iocb)->ki_flags)
|
||||
#define kiocbIsCancelled(iocb) test_bit(KIF_CANCELLED, &(iocb)->ki_flags)
|
||||
|
||||
/* is there a better place to document function pointer methods? */
|
||||
/**
|
||||
* ki_retry - iocb forward progress callback
|
||||
* @kiocb: The kiocb struct to advance by performing an operation.
|
||||
*
|
||||
* This callback is called when the AIO core wants a given AIO operation
|
||||
* to make forward progress. The kiocb argument describes the operation
|
||||
* that is to be performed. As the operation proceeds, perhaps partially,
|
||||
* ki_retry is expected to update the kiocb with progress made. Typically
|
||||
* ki_retry is set in the AIO core and it itself calls file_operations
|
||||
* helpers.
|
||||
*
|
||||
* ki_retry's return value determines when the AIO operation is completed
|
||||
* and an event is generated in the AIO event ring. Except the special
|
||||
* return values described below, the value that is returned from ki_retry
|
||||
* is transferred directly into the completion ring as the operation's
|
||||
* resulting status. Once this has happened ki_retry *MUST NOT* reference
|
||||
* the kiocb pointer again.
|
||||
*
|
||||
* If ki_retry returns -EIOCBQUEUED it has made a promise that aio_complete()
|
||||
* will be called on the kiocb pointer in the future. The AIO core will
|
||||
* not ask the method again -- ki_retry must ensure forward progress.
|
||||
* aio_complete() must be called once and only once in the future, multiple
|
||||
* calls may result in undefined behaviour.
|
||||
*
|
||||
* If ki_retry returns -EIOCBRETRY it has made a promise that kick_iocb()
|
||||
* will be called on the kiocb pointer in the future. This may happen
|
||||
* through generic helpers that associate kiocb->ki_wait with a wait
|
||||
* queue head that ki_retry uses via current->io_wait. It can also happen
|
||||
* with custom tracking and manual calls to kick_iocb(), though that is
|
||||
* discouraged. In either case, kick_iocb() must be called once and only
|
||||
* once. ki_retry must ensure forward progress, the AIO core will wait
|
||||
* indefinitely for kick_iocb() to be called.
|
||||
*/
|
||||
struct kiocb {
|
||||
struct list_head ki_run_list;
|
||||
long ki_flags;
|
||||
int ki_users;
|
||||
unsigned ki_key; /* id of this request */
|
||||
|
||||
struct file *ki_filp;
|
||||
struct kioctx *ki_ctx; /* may be NULL for sync ops */
|
||||
int (*ki_cancel)(struct kiocb *, struct io_event *);
|
||||
ssize_t (*ki_retry)(struct kiocb *);
|
||||
void (*ki_dtor)(struct kiocb *);
|
||||
|
||||
union {
|
||||
void __user *user;
|
||||
struct task_struct *tsk;
|
||||
} ki_obj;
|
||||
|
||||
__u64 ki_user_data; /* user's data for completion */
|
||||
wait_queue_t ki_wait;
|
||||
loff_t ki_pos;
|
||||
|
||||
atomic_t ki_bio_count; /* num bio used for this iocb */
|
||||
void *private;
|
||||
/* State that we remember to be able to restart/retry */
|
||||
unsigned short ki_opcode;
|
||||
size_t ki_nbytes; /* copy of iocb->aio_nbytes */
|
||||
char __user *ki_buf; /* remaining iocb->aio_buf */
|
||||
size_t ki_left; /* remaining bytes */
|
||||
struct iovec ki_inline_vec; /* inline vector */
|
||||
struct iovec *ki_iovec;
|
||||
unsigned long ki_nr_segs;
|
||||
unsigned long ki_cur_seg;
|
||||
|
||||
struct list_head ki_list; /* the aio core uses this
|
||||
* for cancellation */
|
||||
};
|
||||
|
||||
#define is_sync_kiocb(iocb) ((iocb)->ki_key == KIOCB_SYNC_KEY)
|
||||
#define init_sync_kiocb(x, filp) \
|
||||
do { \
|
||||
struct task_struct *tsk = current; \
|
||||
(x)->ki_flags = 0; \
|
||||
(x)->ki_users = 1; \
|
||||
(x)->ki_key = KIOCB_SYNC_KEY; \
|
||||
(x)->ki_filp = (filp); \
|
||||
(x)->ki_ctx = NULL; \
|
||||
(x)->ki_cancel = NULL; \
|
||||
(x)->ki_retry = NULL; \
|
||||
(x)->ki_dtor = NULL; \
|
||||
(x)->ki_obj.tsk = tsk; \
|
||||
(x)->ki_user_data = 0; \
|
||||
init_wait((&(x)->ki_wait)); \
|
||||
} while (0)
|
||||
|
||||
#define AIO_RING_MAGIC 0xa10a10a1
|
||||
#define AIO_RING_COMPAT_FEATURES 1
|
||||
#define AIO_RING_INCOMPAT_FEATURES 0
|
||||
struct aio_ring {
|
||||
unsigned id; /* kernel internal index number */
|
||||
unsigned nr; /* number of io_events */
|
||||
unsigned head;
|
||||
unsigned tail;
|
||||
|
||||
unsigned magic;
|
||||
unsigned compat_features;
|
||||
unsigned incompat_features;
|
||||
unsigned header_length; /* size of aio_ring */
|
||||
|
||||
|
||||
struct io_event io_events[0];
|
||||
}; /* 128 bytes + ring size */
|
||||
|
||||
#define aio_ring_avail(info, ring) (((ring)->head + (info)->nr - 1 - (ring)->tail) % (info)->nr)
|
||||
|
||||
#define AIO_RING_PAGES 8
|
||||
struct aio_ring_info {
|
||||
unsigned long mmap_base;
|
||||
unsigned long mmap_size;
|
||||
|
||||
struct page **ring_pages;
|
||||
spinlock_t ring_lock;
|
||||
long nr_pages;
|
||||
|
||||
unsigned nr, tail;
|
||||
|
||||
struct page *internal_pages[AIO_RING_PAGES];
|
||||
};
|
||||
|
||||
struct kioctx {
|
||||
atomic_t users;
|
||||
int dead;
|
||||
struct mm_struct *mm;
|
||||
|
||||
/* This needs improving */
|
||||
unsigned long user_id;
|
||||
struct kioctx *next;
|
||||
|
||||
wait_queue_head_t wait;
|
||||
|
||||
spinlock_t ctx_lock;
|
||||
|
||||
int reqs_active;
|
||||
struct list_head active_reqs; /* used for cancellation */
|
||||
struct list_head run_list; /* used for kicked reqs */
|
||||
|
||||
/* sys_io_setup currently limits this to an unsigned int */
|
||||
unsigned max_reqs;
|
||||
|
||||
struct aio_ring_info ring_info;
|
||||
|
||||
struct delayed_work wq;
|
||||
};
|
||||
|
||||
/* prototypes */
|
||||
extern unsigned aio_max_size;
|
||||
|
||||
extern ssize_t FASTCALL(wait_on_sync_kiocb(struct kiocb *iocb));
|
||||
extern int FASTCALL(aio_put_req(struct kiocb *iocb));
|
||||
extern void FASTCALL(kick_iocb(struct kiocb *iocb));
|
||||
extern int FASTCALL(aio_complete(struct kiocb *iocb, long res, long res2));
|
||||
extern void FASTCALL(__put_ioctx(struct kioctx *ctx));
|
||||
struct mm_struct;
|
||||
extern void FASTCALL(exit_aio(struct mm_struct *mm));
|
||||
extern struct kioctx *lookup_ioctx(unsigned long ctx_id);
|
||||
extern int FASTCALL(io_submit_one(struct kioctx *ctx,
|
||||
struct iocb __user *user_iocb, struct iocb *iocb));
|
||||
|
||||
/* semi private, but used by the 32bit emulations: */
|
||||
struct kioctx *lookup_ioctx(unsigned long ctx_id);
|
||||
int FASTCALL(io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
|
||||
struct iocb *iocb));
|
||||
|
||||
#define get_ioctx(kioctx) do { \
|
||||
BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
|
||||
atomic_inc(&(kioctx)->users); \
|
||||
} while (0)
|
||||
#define put_ioctx(kioctx) do { \
|
||||
BUG_ON(atomic_read(&(kioctx)->users) <= 0); \
|
||||
if (unlikely(atomic_dec_and_test(&(kioctx)->users))) \
|
||||
__put_ioctx(kioctx); \
|
||||
} while (0)
|
||||
|
||||
#define in_aio() !is_sync_wait(current->io_wait)
|
||||
/* may be used for debugging */
|
||||
#define warn_if_async() \
|
||||
do { \
|
||||
if (in_aio()) { \
|
||||
printk(KERN_ERR "%s(%s:%d) called in async context!\n", \
|
||||
__FUNCTION__, __FILE__, __LINE__); \
|
||||
dump_stack(); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define io_wait_to_kiocb(wait) container_of(wait, struct kiocb, ki_wait)
|
||||
|
||||
#include <linux/aio_abi.h>
|
||||
|
||||
static inline struct kiocb *list_kiocb(struct list_head *h)
|
||||
{
|
||||
return list_entry(h, struct kiocb, ki_list);
|
||||
}
|
||||
|
||||
/* for sysctl: */
|
||||
extern unsigned long aio_nr;
|
||||
extern unsigned long aio_max_nr;
|
||||
|
||||
#endif /* __LINUX__AIO_H */
|
||||
94
include/linux/aio_abi.h
Normal file
94
include/linux/aio_abi.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* include/linux/aio_abi.h
|
||||
*
|
||||
* Copyright 2000,2001,2002 Red Hat.
|
||||
*
|
||||
* Written by Benjamin LaHaise <bcrl@kvack.org>
|
||||
*
|
||||
* Distribute under the terms of the GPLv2 (see ../../COPYING) or under
|
||||
* the following terms.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and its
|
||||
* documentation is hereby granted, provided that the above copyright
|
||||
* notice appears in all copies. This software is provided without any
|
||||
* warranty, express or implied. Red Hat makes no representations about
|
||||
* the suitability of this software for any purpose.
|
||||
*
|
||||
* IN NO EVENT SHALL RED HAT BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
|
||||
* SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF
|
||||
* THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RED HAT HAS BEEN ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* RED HAT DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
|
||||
* RED HAT HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
|
||||
* ENHANCEMENTS, OR MODIFICATIONS.
|
||||
*/
|
||||
#ifndef __LINUX__AIO_ABI_H
|
||||
#define __LINUX__AIO_ABI_H
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
typedef unsigned long aio_context_t;
|
||||
|
||||
enum {
|
||||
IOCB_CMD_PREAD = 0,
|
||||
IOCB_CMD_PWRITE = 1,
|
||||
IOCB_CMD_FSYNC = 2,
|
||||
IOCB_CMD_FDSYNC = 3,
|
||||
/* These two are experimental.
|
||||
* IOCB_CMD_PREADX = 4,
|
||||
* IOCB_CMD_POLL = 5,
|
||||
*/
|
||||
IOCB_CMD_NOOP = 6,
|
||||
IOCB_CMD_PREADV = 7,
|
||||
IOCB_CMD_PWRITEV = 8,
|
||||
};
|
||||
|
||||
/* read() from /dev/aio returns these structures. */
|
||||
struct io_event {
|
||||
__u64 data; /* the data field from the iocb */
|
||||
__u64 obj; /* what iocb this event came from */
|
||||
__s64 res; /* result code for this event */
|
||||
__s64 res2; /* secondary result */
|
||||
};
|
||||
|
||||
#if defined(__LITTLE_ENDIAN)
|
||||
#define PADDED(x,y) x, y
|
||||
#elif defined(__BIG_ENDIAN)
|
||||
#define PADDED(x,y) y, x
|
||||
#else
|
||||
#error edit for your odd byteorder.
|
||||
#endif
|
||||
|
||||
/*
|
||||
* we always use a 64bit off_t when communicating
|
||||
* with userland. its up to libraries to do the
|
||||
* proper padding and aio_error abstraction
|
||||
*/
|
||||
|
||||
struct iocb {
|
||||
/* these are internal to the kernel/libc. */
|
||||
__u64 aio_data; /* data to be returned in event's data */
|
||||
__u32 PADDED(aio_key, aio_reserved1);
|
||||
/* the kernel sets aio_key to the req # */
|
||||
|
||||
/* common fields */
|
||||
__u16 aio_lio_opcode; /* see IOCB_CMD_ above */
|
||||
__s16 aio_reqprio;
|
||||
__u32 aio_fildes;
|
||||
|
||||
__u64 aio_buf;
|
||||
__u64 aio_nbytes;
|
||||
__s64 aio_offset;
|
||||
|
||||
/* extra parameters */
|
||||
__u64 aio_reserved2; /* TODO: use this for a (struct sigevent *) */
|
||||
__u64 aio_reserved3;
|
||||
}; /* 64 bytes */
|
||||
|
||||
#undef IFBIG
|
||||
#undef IFLITTLE
|
||||
|
||||
#endif /* __LINUX__AIO_ABI_H */
|
||||
|
||||
55
include/linux/amba/bus.h
Normal file
55
include/linux/amba/bus.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* linux/include/asm-arm/hardware/amba.h
|
||||
*
|
||||
* Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef ASMARM_AMBA_H
|
||||
#define ASMARM_AMBA_H
|
||||
|
||||
#define AMBA_NR_IRQS 2
|
||||
|
||||
struct amba_device {
|
||||
struct device dev;
|
||||
struct resource res;
|
||||
u64 dma_mask;
|
||||
unsigned int periphid;
|
||||
unsigned int irq[AMBA_NR_IRQS];
|
||||
};
|
||||
|
||||
struct amba_id {
|
||||
unsigned int id;
|
||||
unsigned int mask;
|
||||
void *data;
|
||||
};
|
||||
|
||||
struct amba_driver {
|
||||
struct device_driver drv;
|
||||
int (*probe)(struct amba_device *, void *);
|
||||
int (*remove)(struct amba_device *);
|
||||
void (*shutdown)(struct amba_device *);
|
||||
int (*suspend)(struct amba_device *, pm_message_t);
|
||||
int (*resume)(struct amba_device *);
|
||||
struct amba_id *id_table;
|
||||
};
|
||||
|
||||
#define amba_get_drvdata(d) dev_get_drvdata(&d->dev)
|
||||
#define amba_set_drvdata(d,p) dev_set_drvdata(&d->dev, p)
|
||||
|
||||
int amba_driver_register(struct amba_driver *);
|
||||
void amba_driver_unregister(struct amba_driver *);
|
||||
int amba_device_register(struct amba_device *, struct resource *);
|
||||
void amba_device_unregister(struct amba_device *);
|
||||
struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
|
||||
int amba_request_regions(struct amba_device *, const char *);
|
||||
void amba_release_regions(struct amba_device *);
|
||||
|
||||
#define amba_config(d) (((d)->periphid >> 24) & 0xff)
|
||||
#define amba_rev(d) (((d)->periphid >> 20) & 0x0f)
|
||||
#define amba_manf(d) (((d)->periphid >> 12) & 0xff)
|
||||
#define amba_part(d) ((d)->periphid & 0xfff)
|
||||
|
||||
#endif
|
||||
280
include/linux/amba/clcd.h
Normal file
280
include/linux/amba/clcd.h
Normal file
@@ -0,0 +1,280 @@
|
||||
/*
|
||||
* linux/include/asm-arm/hardware/amba_clcd.h -- Integrator LCD panel.
|
||||
*
|
||||
* David A Rusling
|
||||
*
|
||||
* Copyright (C) 2001 ARM Limited
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU General Public
|
||||
* License. See the file COPYING in the main directory of this archive
|
||||
* for more details.
|
||||
*/
|
||||
#include <linux/fb.h>
|
||||
|
||||
/*
|
||||
* CLCD Controller Internal Register addresses
|
||||
*/
|
||||
#define CLCD_TIM0 0x00000000
|
||||
#define CLCD_TIM1 0x00000004
|
||||
#define CLCD_TIM2 0x00000008
|
||||
#define CLCD_TIM3 0x0000000c
|
||||
#define CLCD_UBAS 0x00000010
|
||||
#define CLCD_LBAS 0x00000014
|
||||
|
||||
#if !defined(CONFIG_ARCH_VERSATILE) && !defined(CONFIG_ARCH_REALVIEW)
|
||||
#define CLCD_IENB 0x00000018
|
||||
#define CLCD_CNTL 0x0000001c
|
||||
#else
|
||||
/*
|
||||
* Someone rearranged these two registers on the Versatile
|
||||
* platform...
|
||||
*/
|
||||
#define CLCD_IENB 0x0000001c
|
||||
#define CLCD_CNTL 0x00000018
|
||||
#endif
|
||||
|
||||
#define CLCD_STAT 0x00000020
|
||||
#define CLCD_INTR 0x00000024
|
||||
#define CLCD_UCUR 0x00000028
|
||||
#define CLCD_LCUR 0x0000002C
|
||||
#define CLCD_PALL 0x00000200
|
||||
#define CLCD_PALETTE 0x00000200
|
||||
|
||||
#define TIM2_CLKSEL (1 << 5)
|
||||
#define TIM2_IVS (1 << 11)
|
||||
#define TIM2_IHS (1 << 12)
|
||||
#define TIM2_IPC (1 << 13)
|
||||
#define TIM2_IOE (1 << 14)
|
||||
#define TIM2_BCD (1 << 26)
|
||||
|
||||
#define CNTL_LCDEN (1 << 0)
|
||||
#define CNTL_LCDBPP1 (0 << 1)
|
||||
#define CNTL_LCDBPP2 (1 << 1)
|
||||
#define CNTL_LCDBPP4 (2 << 1)
|
||||
#define CNTL_LCDBPP8 (3 << 1)
|
||||
#define CNTL_LCDBPP16 (4 << 1)
|
||||
#define CNTL_LCDBPP16_565 (6 << 1)
|
||||
#define CNTL_LCDBPP24 (5 << 1)
|
||||
#define CNTL_LCDBW (1 << 4)
|
||||
#define CNTL_LCDTFT (1 << 5)
|
||||
#define CNTL_LCDMONO8 (1 << 6)
|
||||
#define CNTL_LCDDUAL (1 << 7)
|
||||
#define CNTL_BGR (1 << 8)
|
||||
#define CNTL_BEBO (1 << 9)
|
||||
#define CNTL_BEPO (1 << 10)
|
||||
#define CNTL_LCDPWR (1 << 11)
|
||||
#define CNTL_LCDVCOMP(x) ((x) << 12)
|
||||
#define CNTL_LDMAFIFOTIME (1 << 15)
|
||||
#define CNTL_WATERMARK (1 << 16)
|
||||
|
||||
struct clcd_panel {
|
||||
struct fb_videomode mode;
|
||||
signed short width; /* width in mm */
|
||||
signed short height; /* height in mm */
|
||||
u32 tim2;
|
||||
u32 tim3;
|
||||
u32 cntl;
|
||||
unsigned int bpp:8,
|
||||
fixedtimings:1,
|
||||
grayscale:1;
|
||||
unsigned int connector;
|
||||
};
|
||||
|
||||
struct clcd_regs {
|
||||
u32 tim0;
|
||||
u32 tim1;
|
||||
u32 tim2;
|
||||
u32 tim3;
|
||||
u32 cntl;
|
||||
unsigned long pixclock;
|
||||
};
|
||||
|
||||
struct clcd_fb;
|
||||
|
||||
/*
|
||||
* the board-type specific routines
|
||||
*/
|
||||
struct clcd_board {
|
||||
const char *name;
|
||||
|
||||
/*
|
||||
* Optional. Check whether the var structure is acceptable
|
||||
* for this display.
|
||||
*/
|
||||
int (*check)(struct clcd_fb *fb, struct fb_var_screeninfo *var);
|
||||
|
||||
/*
|
||||
* Compulsary. Decode fb->fb.var into regs->*. In the case of
|
||||
* fixed timing, set regs->* to the register values required.
|
||||
*/
|
||||
void (*decode)(struct clcd_fb *fb, struct clcd_regs *regs);
|
||||
|
||||
/*
|
||||
* Optional. Disable any extra display hardware.
|
||||
*/
|
||||
void (*disable)(struct clcd_fb *);
|
||||
|
||||
/*
|
||||
* Optional. Enable any extra display hardware.
|
||||
*/
|
||||
void (*enable)(struct clcd_fb *);
|
||||
|
||||
/*
|
||||
* Setup platform specific parts of CLCD driver
|
||||
*/
|
||||
int (*setup)(struct clcd_fb *);
|
||||
|
||||
/*
|
||||
* mmap the framebuffer memory
|
||||
*/
|
||||
int (*mmap)(struct clcd_fb *, struct vm_area_struct *);
|
||||
|
||||
/*
|
||||
* Remove platform specific parts of CLCD driver
|
||||
*/
|
||||
void (*remove)(struct clcd_fb *);
|
||||
};
|
||||
|
||||
struct amba_device;
|
||||
struct clk;
|
||||
|
||||
/* this data structure describes each frame buffer device we find */
|
||||
struct clcd_fb {
|
||||
struct fb_info fb;
|
||||
struct amba_device *dev;
|
||||
struct clk *clk;
|
||||
struct clcd_panel *panel;
|
||||
struct clcd_board *board;
|
||||
void *board_data;
|
||||
void __iomem *regs;
|
||||
u32 clcd_cntl;
|
||||
u32 cmap[16];
|
||||
};
|
||||
|
||||
static inline void clcdfb_decode(struct clcd_fb *fb, struct clcd_regs *regs)
|
||||
{
|
||||
u32 val, cpl;
|
||||
|
||||
/*
|
||||
* Program the CLCD controller registers and start the CLCD
|
||||
*/
|
||||
val = ((fb->fb.var.xres / 16) - 1) << 2;
|
||||
val |= (fb->fb.var.hsync_len - 1) << 8;
|
||||
val |= (fb->fb.var.right_margin - 1) << 16;
|
||||
val |= (fb->fb.var.left_margin - 1) << 24;
|
||||
regs->tim0 = val;
|
||||
|
||||
val = fb->fb.var.yres;
|
||||
if (fb->panel->cntl & CNTL_LCDDUAL)
|
||||
val /= 2;
|
||||
val -= 1;
|
||||
val |= (fb->fb.var.vsync_len - 1) << 10;
|
||||
val |= fb->fb.var.lower_margin << 16;
|
||||
val |= fb->fb.var.upper_margin << 24;
|
||||
regs->tim1 = val;
|
||||
|
||||
val = fb->panel->tim2;
|
||||
val |= fb->fb.var.sync & FB_SYNC_HOR_HIGH_ACT ? 0 : TIM2_IHS;
|
||||
val |= fb->fb.var.sync & FB_SYNC_VERT_HIGH_ACT ? 0 : TIM2_IVS;
|
||||
|
||||
cpl = fb->fb.var.xres_virtual;
|
||||
if (fb->panel->cntl & CNTL_LCDTFT) /* TFT */
|
||||
/* / 1 */;
|
||||
else if (!fb->fb.var.grayscale) /* STN color */
|
||||
cpl = cpl * 8 / 3;
|
||||
else if (fb->panel->cntl & CNTL_LCDMONO8) /* STN monochrome, 8bit */
|
||||
cpl /= 8;
|
||||
else /* STN monochrome, 4bit */
|
||||
cpl /= 4;
|
||||
|
||||
regs->tim2 = val | ((cpl - 1) << 16);
|
||||
|
||||
regs->tim3 = fb->panel->tim3;
|
||||
|
||||
val = fb->panel->cntl;
|
||||
if (fb->fb.var.grayscale)
|
||||
val |= CNTL_LCDBW;
|
||||
|
||||
switch (fb->fb.var.bits_per_pixel) {
|
||||
case 1:
|
||||
val |= CNTL_LCDBPP1;
|
||||
break;
|
||||
case 2:
|
||||
val |= CNTL_LCDBPP2;
|
||||
break;
|
||||
case 4:
|
||||
val |= CNTL_LCDBPP4;
|
||||
break;
|
||||
case 8:
|
||||
val |= CNTL_LCDBPP8;
|
||||
break;
|
||||
case 16:
|
||||
/*
|
||||
* PL110 cannot choose between 5551 and 565 modes in
|
||||
* its control register
|
||||
*/
|
||||
if ((fb->dev->periphid & 0x000fffff) == 0x00041110)
|
||||
val |= CNTL_LCDBPP16;
|
||||
else if (fb->fb.var.green.length == 5)
|
||||
val |= CNTL_LCDBPP16;
|
||||
else
|
||||
val |= CNTL_LCDBPP16_565;
|
||||
break;
|
||||
case 32:
|
||||
val |= CNTL_LCDBPP24;
|
||||
break;
|
||||
}
|
||||
|
||||
regs->cntl = val;
|
||||
regs->pixclock = fb->fb.var.pixclock;
|
||||
}
|
||||
|
||||
static inline int clcdfb_check(struct clcd_fb *fb, struct fb_var_screeninfo *var)
|
||||
{
|
||||
var->xres_virtual = var->xres = (var->xres + 15) & ~15;
|
||||
var->yres_virtual = var->yres = (var->yres + 1) & ~1;
|
||||
|
||||
#define CHECK(e,l,h) (var->e < l || var->e > h)
|
||||
if (CHECK(right_margin, (5+1), 256) || /* back porch */
|
||||
CHECK(left_margin, (5+1), 256) || /* front porch */
|
||||
CHECK(hsync_len, (5+1), 256) ||
|
||||
var->xres > 4096 ||
|
||||
var->lower_margin > 255 || /* back porch */
|
||||
var->upper_margin > 255 || /* front porch */
|
||||
var->vsync_len > 32 ||
|
||||
var->yres > 1024)
|
||||
return -EINVAL;
|
||||
#undef CHECK
|
||||
|
||||
/* single panel mode: PCD = max(PCD, 1) */
|
||||
/* dual panel mode: PCD = max(PCD, 5) */
|
||||
|
||||
/*
|
||||
* You can't change the grayscale setting, and
|
||||
* we can only do non-interlaced video.
|
||||
*/
|
||||
if (var->grayscale != fb->fb.var.grayscale ||
|
||||
(var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED)
|
||||
return -EINVAL;
|
||||
|
||||
#define CHECK(e) (var->e != fb->fb.var.e)
|
||||
if (fb->panel->fixedtimings &&
|
||||
(CHECK(xres) ||
|
||||
CHECK(yres) ||
|
||||
CHECK(bits_per_pixel) ||
|
||||
CHECK(pixclock) ||
|
||||
CHECK(left_margin) ||
|
||||
CHECK(right_margin) ||
|
||||
CHECK(upper_margin) ||
|
||||
CHECK(lower_margin) ||
|
||||
CHECK(hsync_len) ||
|
||||
CHECK(vsync_len) ||
|
||||
CHECK(sync)))
|
||||
return -EINVAL;
|
||||
#undef CHECK
|
||||
|
||||
var->nonstd = 0;
|
||||
var->accel_flags = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
92
include/linux/amba/kmi.h
Normal file
92
include/linux/amba/kmi.h
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* linux/include/asm-arm/hardware/amba_kmi.h
|
||||
*
|
||||
* Internal header file for AMBA KMI ports
|
||||
*
|
||||
* Copyright (C) 2000 Deep Blue Solutions Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*
|
||||
* ---------------------------------------------------------------------------
|
||||
* From ARM PrimeCell(tm) PS2 Keyboard/Mouse Interface (PL050) Technical
|
||||
* Reference Manual - ARM DDI 0143B - see http://www.arm.com/
|
||||
* ---------------------------------------------------------------------------
|
||||
*/
|
||||
#ifndef ASM_ARM_HARDWARE_AMBA_KMI_H
|
||||
#define ASM_ARM_HARDWARE_AMBA_KMI_H
|
||||
|
||||
/*
|
||||
* KMI control register:
|
||||
* KMICR_TYPE 0 = PS2/AT mode, 1 = No line control bit mode
|
||||
* KMICR_RXINTREN 1 = enable RX interrupts
|
||||
* KMICR_TXINTREN 1 = enable TX interrupts
|
||||
* KMICR_EN 1 = enable KMI
|
||||
* KMICR_FD 1 = force KMI data low
|
||||
* KMICR_FC 1 = force KMI clock low
|
||||
*/
|
||||
#define KMICR (KMI_BASE + 0x00)
|
||||
#define KMICR_TYPE (1 << 5)
|
||||
#define KMICR_RXINTREN (1 << 4)
|
||||
#define KMICR_TXINTREN (1 << 3)
|
||||
#define KMICR_EN (1 << 2)
|
||||
#define KMICR_FD (1 << 1)
|
||||
#define KMICR_FC (1 << 0)
|
||||
|
||||
/*
|
||||
* KMI status register:
|
||||
* KMISTAT_TXEMPTY 1 = transmitter register empty
|
||||
* KMISTAT_TXBUSY 1 = currently sending data
|
||||
* KMISTAT_RXFULL 1 = receiver register ready to be read
|
||||
* KMISTAT_RXBUSY 1 = currently receiving data
|
||||
* KMISTAT_RXPARITY parity of last databyte received
|
||||
* KMISTAT_IC current level of KMI clock input
|
||||
* KMISTAT_ID current level of KMI data input
|
||||
*/
|
||||
#define KMISTAT (KMI_BASE + 0x04)
|
||||
#define KMISTAT_TXEMPTY (1 << 6)
|
||||
#define KMISTAT_TXBUSY (1 << 5)
|
||||
#define KMISTAT_RXFULL (1 << 4)
|
||||
#define KMISTAT_RXBUSY (1 << 3)
|
||||
#define KMISTAT_RXPARITY (1 << 2)
|
||||
#define KMISTAT_IC (1 << 1)
|
||||
#define KMISTAT_ID (1 << 0)
|
||||
|
||||
/*
|
||||
* KMI data register
|
||||
*/
|
||||
#define KMIDATA (KMI_BASE + 0x08)
|
||||
|
||||
/*
|
||||
* KMI clock divisor: to generate 8MHz internal clock
|
||||
* div = (ref / 8MHz) - 1; 0 <= div <= 15
|
||||
*/
|
||||
#define KMICLKDIV (KMI_BASE + 0x0c)
|
||||
|
||||
/*
|
||||
* KMI interrupt register:
|
||||
* KMIIR_TXINTR 1 = transmit interrupt asserted
|
||||
* KMIIR_RXINTR 1 = receive interrupt asserted
|
||||
*/
|
||||
#define KMIIR (KMI_BASE + 0x10)
|
||||
#define KMIIR_TXINTR (1 << 1)
|
||||
#define KMIIR_RXINTR (1 << 0)
|
||||
|
||||
/*
|
||||
* The size of the KMI primecell
|
||||
*/
|
||||
#define KMI_SIZE (0x100)
|
||||
|
||||
#endif
|
||||
167
include/linux/amba/serial.h
Normal file
167
include/linux/amba/serial.h
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* linux/include/asm-arm/hardware/serial_amba.h
|
||||
*
|
||||
* Internal header file for AMBA serial ports
|
||||
*
|
||||
* Copyright (C) ARM Limited
|
||||
* Copyright (C) 2000 Deep Blue Solutions Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef ASM_ARM_HARDWARE_SERIAL_AMBA_H
|
||||
#define ASM_ARM_HARDWARE_SERIAL_AMBA_H
|
||||
|
||||
/* -------------------------------------------------------------------------------
|
||||
* From AMBA UART (PL010) Block Specification
|
||||
* -------------------------------------------------------------------------------
|
||||
* UART Register Offsets.
|
||||
*/
|
||||
#define UART01x_DR 0x00 /* Data read or written from the interface. */
|
||||
#define UART01x_RSR 0x04 /* Receive status register (Read). */
|
||||
#define UART01x_ECR 0x04 /* Error clear register (Write). */
|
||||
#define UART010_LCRH 0x08 /* Line control register, high byte. */
|
||||
#define UART010_LCRM 0x0C /* Line control register, middle byte. */
|
||||
#define UART010_LCRL 0x10 /* Line control register, low byte. */
|
||||
#define UART010_CR 0x14 /* Control register. */
|
||||
#define UART01x_FR 0x18 /* Flag register (Read only). */
|
||||
#define UART010_IIR 0x1C /* Interrupt indentification register (Read). */
|
||||
#define UART010_ICR 0x1C /* Interrupt clear register (Write). */
|
||||
#define UART01x_ILPR 0x20 /* IrDA low power counter register. */
|
||||
#define UART011_IBRD 0x24 /* Integer baud rate divisor register. */
|
||||
#define UART011_FBRD 0x28 /* Fractional baud rate divisor register. */
|
||||
#define UART011_LCRH 0x2c /* Line control register. */
|
||||
#define UART011_CR 0x30 /* Control register. */
|
||||
#define UART011_IFLS 0x34 /* Interrupt fifo level select. */
|
||||
#define UART011_IMSC 0x38 /* Interrupt mask. */
|
||||
#define UART011_RIS 0x3c /* Raw interrupt status. */
|
||||
#define UART011_MIS 0x40 /* Masked interrupt status. */
|
||||
#define UART011_ICR 0x44 /* Interrupt clear register. */
|
||||
#define UART011_DMACR 0x48 /* DMA control register. */
|
||||
|
||||
#define UART011_DR_OE (1 << 11)
|
||||
#define UART011_DR_BE (1 << 10)
|
||||
#define UART011_DR_PE (1 << 9)
|
||||
#define UART011_DR_FE (1 << 8)
|
||||
|
||||
#define UART01x_RSR_OE 0x08
|
||||
#define UART01x_RSR_BE 0x04
|
||||
#define UART01x_RSR_PE 0x02
|
||||
#define UART01x_RSR_FE 0x01
|
||||
|
||||
#define UART011_FR_RI 0x100
|
||||
#define UART011_FR_TXFE 0x080
|
||||
#define UART011_FR_RXFF 0x040
|
||||
#define UART01x_FR_TXFF 0x020
|
||||
#define UART01x_FR_RXFE 0x010
|
||||
#define UART01x_FR_BUSY 0x008
|
||||
#define UART01x_FR_DCD 0x004
|
||||
#define UART01x_FR_DSR 0x002
|
||||
#define UART01x_FR_CTS 0x001
|
||||
#define UART01x_FR_TMSK (UART01x_FR_TXFF + UART01x_FR_BUSY)
|
||||
|
||||
#define UART011_CR_CTSEN 0x8000 /* CTS hardware flow control */
|
||||
#define UART011_CR_RTSEN 0x4000 /* RTS hardware flow control */
|
||||
#define UART011_CR_OUT2 0x2000 /* OUT2 */
|
||||
#define UART011_CR_OUT1 0x1000 /* OUT1 */
|
||||
#define UART011_CR_RTS 0x0800 /* RTS */
|
||||
#define UART011_CR_DTR 0x0400 /* DTR */
|
||||
#define UART011_CR_RXE 0x0200 /* receive enable */
|
||||
#define UART011_CR_TXE 0x0100 /* transmit enable */
|
||||
#define UART011_CR_LBE 0x0080 /* loopback enable */
|
||||
#define UART010_CR_RTIE 0x0040
|
||||
#define UART010_CR_TIE 0x0020
|
||||
#define UART010_CR_RIE 0x0010
|
||||
#define UART010_CR_MSIE 0x0008
|
||||
#define UART01x_CR_IIRLP 0x0004 /* SIR low power mode */
|
||||
#define UART01x_CR_SIREN 0x0002 /* SIR enable */
|
||||
#define UART01x_CR_UARTEN 0x0001 /* UART enable */
|
||||
|
||||
#define UART011_LCRH_SPS 0x80
|
||||
#define UART01x_LCRH_WLEN_8 0x60
|
||||
#define UART01x_LCRH_WLEN_7 0x40
|
||||
#define UART01x_LCRH_WLEN_6 0x20
|
||||
#define UART01x_LCRH_WLEN_5 0x00
|
||||
#define UART01x_LCRH_FEN 0x10
|
||||
#define UART01x_LCRH_STP2 0x08
|
||||
#define UART01x_LCRH_EPS 0x04
|
||||
#define UART01x_LCRH_PEN 0x02
|
||||
#define UART01x_LCRH_BRK 0x01
|
||||
|
||||
#define UART010_IIR_RTIS 0x08
|
||||
#define UART010_IIR_TIS 0x04
|
||||
#define UART010_IIR_RIS 0x02
|
||||
#define UART010_IIR_MIS 0x01
|
||||
|
||||
#define UART011_IFLS_RX1_8 (0 << 3)
|
||||
#define UART011_IFLS_RX2_8 (1 << 3)
|
||||
#define UART011_IFLS_RX4_8 (2 << 3)
|
||||
#define UART011_IFLS_RX6_8 (3 << 3)
|
||||
#define UART011_IFLS_RX7_8 (4 << 3)
|
||||
#define UART011_IFLS_TX1_8 (0 << 0)
|
||||
#define UART011_IFLS_TX2_8 (1 << 0)
|
||||
#define UART011_IFLS_TX4_8 (2 << 0)
|
||||
#define UART011_IFLS_TX6_8 (3 << 0)
|
||||
#define UART011_IFLS_TX7_8 (4 << 0)
|
||||
|
||||
#define UART011_OEIM (1 << 10) /* overrun error interrupt mask */
|
||||
#define UART011_BEIM (1 << 9) /* break error interrupt mask */
|
||||
#define UART011_PEIM (1 << 8) /* parity error interrupt mask */
|
||||
#define UART011_FEIM (1 << 7) /* framing error interrupt mask */
|
||||
#define UART011_RTIM (1 << 6) /* receive timeout interrupt mask */
|
||||
#define UART011_TXIM (1 << 5) /* transmit interrupt mask */
|
||||
#define UART011_RXIM (1 << 4) /* receive interrupt mask */
|
||||
#define UART011_DSRMIM (1 << 3) /* DSR interrupt mask */
|
||||
#define UART011_DCDMIM (1 << 2) /* DCD interrupt mask */
|
||||
#define UART011_CTSMIM (1 << 1) /* CTS interrupt mask */
|
||||
#define UART011_RIMIM (1 << 0) /* RI interrupt mask */
|
||||
|
||||
#define UART011_OEIS (1 << 10) /* overrun error interrupt status */
|
||||
#define UART011_BEIS (1 << 9) /* break error interrupt status */
|
||||
#define UART011_PEIS (1 << 8) /* parity error interrupt status */
|
||||
#define UART011_FEIS (1 << 7) /* framing error interrupt status */
|
||||
#define UART011_RTIS (1 << 6) /* receive timeout interrupt status */
|
||||
#define UART011_TXIS (1 << 5) /* transmit interrupt status */
|
||||
#define UART011_RXIS (1 << 4) /* receive interrupt status */
|
||||
#define UART011_DSRMIS (1 << 3) /* DSR interrupt status */
|
||||
#define UART011_DCDMIS (1 << 2) /* DCD interrupt status */
|
||||
#define UART011_CTSMIS (1 << 1) /* CTS interrupt status */
|
||||
#define UART011_RIMIS (1 << 0) /* RI interrupt status */
|
||||
|
||||
#define UART011_OEIC (1 << 10) /* overrun error interrupt clear */
|
||||
#define UART011_BEIC (1 << 9) /* break error interrupt clear */
|
||||
#define UART011_PEIC (1 << 8) /* parity error interrupt clear */
|
||||
#define UART011_FEIC (1 << 7) /* framing error interrupt clear */
|
||||
#define UART011_RTIC (1 << 6) /* receive timeout interrupt clear */
|
||||
#define UART011_TXIC (1 << 5) /* transmit interrupt clear */
|
||||
#define UART011_RXIC (1 << 4) /* receive interrupt clear */
|
||||
#define UART011_DSRMIC (1 << 3) /* DSR interrupt clear */
|
||||
#define UART011_DCDMIC (1 << 2) /* DCD interrupt clear */
|
||||
#define UART011_CTSMIC (1 << 1) /* CTS interrupt clear */
|
||||
#define UART011_RIMIC (1 << 0) /* RI interrupt clear */
|
||||
|
||||
#define UART011_DMAONERR (1 << 2) /* disable dma on error */
|
||||
#define UART011_TXDMAE (1 << 1) /* enable transmit dma */
|
||||
#define UART011_RXDMAE (1 << 0) /* enable receive dma */
|
||||
|
||||
#define UART01x_RSR_ANY (UART01x_RSR_OE|UART01x_RSR_BE|UART01x_RSR_PE|UART01x_RSR_FE)
|
||||
#define UART01x_FR_MODEM_ANY (UART01x_FR_DCD|UART01x_FR_DSR|UART01x_FR_CTS)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
struct amba_pl010_data {
|
||||
void (*set_mctrl)(struct amba_device *dev, void __iomem *base, unsigned int mctrl);
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
62
include/linux/amifd.h
Normal file
62
include/linux/amifd.h
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef _AMIFD_H
|
||||
#define _AMIFD_H
|
||||
|
||||
/* Definitions for the Amiga floppy driver */
|
||||
|
||||
#include <linux/fd.h>
|
||||
|
||||
#define FD_MAX_UNITS 4 /* Max. Number of drives */
|
||||
#define FLOPPY_MAX_SECTORS 22 /* Max. Number of sectors per track */
|
||||
|
||||
#ifndef ASSEMBLER
|
||||
|
||||
struct fd_data_type {
|
||||
char *name; /* description of data type */
|
||||
int sects; /* sectors per track */
|
||||
#ifdef __STDC__
|
||||
int (*read_fkt)(int);
|
||||
void (*write_fkt)(int);
|
||||
#else
|
||||
int (*read_fkt)(); /* read whole track */
|
||||
void (*write_fkt)(); /* write whole track */
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
** Floppy type descriptions
|
||||
*/
|
||||
|
||||
struct fd_drive_type {
|
||||
unsigned long code; /* code returned from drive */
|
||||
char *name; /* description of drive */
|
||||
unsigned int tracks; /* number of tracks */
|
||||
unsigned int heads; /* number of heads */
|
||||
unsigned int read_size; /* raw read size for one track */
|
||||
unsigned int write_size; /* raw write size for one track */
|
||||
unsigned int sect_mult; /* sectors and gap multiplier (HD = 2) */
|
||||
unsigned int precomp1; /* start track for precomp 1 */
|
||||
unsigned int precomp2; /* start track for precomp 2 */
|
||||
unsigned int step_delay; /* time (in ms) for delay after step */
|
||||
unsigned int settle_time; /* time to settle after dir change */
|
||||
unsigned int side_time; /* time needed to change sides */
|
||||
};
|
||||
|
||||
struct amiga_floppy_struct {
|
||||
struct fd_drive_type *type; /* type of floppy for this unit */
|
||||
struct fd_data_type *dtype; /* type of floppy for this unit */
|
||||
int track; /* current track (-1 == unknown) */
|
||||
unsigned char *trackbuf; /* current track (kmaloc()'d */
|
||||
|
||||
int blocks; /* total # blocks on disk */
|
||||
|
||||
int changed; /* true when not known */
|
||||
int disk; /* disk in drive (-1 == unknown) */
|
||||
int motor; /* true when motor is at speed */
|
||||
int busy; /* true when drive is active */
|
||||
int dirty; /* true when trackbuf is not on disk */
|
||||
int status; /* current error code for unit */
|
||||
struct gendisk *gendisk;
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
81
include/linux/amifdreg.h
Normal file
81
include/linux/amifdreg.h
Normal file
@@ -0,0 +1,81 @@
|
||||
#ifndef _LINUX_AMIFDREG_H
|
||||
#define _LINUX_AMIFDREG_H
|
||||
|
||||
/*
|
||||
** CIAAPRA bits (read only)
|
||||
*/
|
||||
|
||||
#define DSKRDY (0x1<<5) /* disk ready when low */
|
||||
#define DSKTRACK0 (0x1<<4) /* head at track zero when low */
|
||||
#define DSKPROT (0x1<<3) /* disk protected when low */
|
||||
#define DSKCHANGE (0x1<<2) /* low when disk removed */
|
||||
|
||||
/*
|
||||
** CIAAPRB bits (read/write)
|
||||
*/
|
||||
|
||||
#define DSKMOTOR (0x1<<7) /* motor on when low */
|
||||
#define DSKSEL3 (0x1<<6) /* select drive 3 when low */
|
||||
#define DSKSEL2 (0x1<<5) /* select drive 2 when low */
|
||||
#define DSKSEL1 (0x1<<4) /* select drive 1 when low */
|
||||
#define DSKSEL0 (0x1<<3) /* select drive 0 when low */
|
||||
#define DSKSIDE (0x1<<2) /* side selection: 0 = upper, 1 = lower */
|
||||
#define DSKDIREC (0x1<<1) /* step direction: 0=in, 1=out (to trk 0) */
|
||||
#define DSKSTEP (0x1) /* pulse low to step head 1 track */
|
||||
|
||||
/*
|
||||
** DSKBYTR bits (read only)
|
||||
*/
|
||||
|
||||
#define DSKBYT (1<<15) /* register contains valid byte when set */
|
||||
#define DMAON (1<<14) /* disk DMA enabled */
|
||||
#define DISKWRITE (1<<13) /* disk write bit in DSKLEN enabled */
|
||||
#define WORDEQUAL (1<<12) /* DSKSYNC register match when true */
|
||||
/* bits 7-0 are data */
|
||||
|
||||
/*
|
||||
** ADKCON/ADKCONR bits
|
||||
*/
|
||||
|
||||
#ifndef SETCLR
|
||||
#define ADK_SETCLR (1<<15) /* control bit */
|
||||
#endif
|
||||
#define ADK_PRECOMP1 (1<<14) /* precompensation selection */
|
||||
#define ADK_PRECOMP0 (1<<13) /* 00=none, 01=140ns, 10=280ns, 11=500ns */
|
||||
#define ADK_MFMPREC (1<<12) /* 0=GCR precomp., 1=MFM precomp. */
|
||||
#define ADK_WORDSYNC (1<<10) /* enable DSKSYNC auto DMA */
|
||||
#define ADK_MSBSYNC (1<<9) /* when 1, enable sync on MSbit (for GCR) */
|
||||
#define ADK_FAST (1<<8) /* bit cell: 0=2us (GCR), 1=1us (MFM) */
|
||||
|
||||
/*
|
||||
** DSKLEN bits
|
||||
*/
|
||||
|
||||
#define DSKLEN_DMAEN (1<<15)
|
||||
#define DSKLEN_WRITE (1<<14)
|
||||
|
||||
/*
|
||||
** INTENA/INTREQ bits
|
||||
*/
|
||||
|
||||
#define DSKINDEX (0x1<<4) /* DSKINDEX bit */
|
||||
|
||||
/*
|
||||
** Misc
|
||||
*/
|
||||
|
||||
#define MFM_SYNC 0x4489 /* standard MFM sync value */
|
||||
|
||||
/* Values for FD_COMMAND */
|
||||
#define FD_RECALIBRATE 0x07 /* move to track 0 */
|
||||
#define FD_SEEK 0x0F /* seek track */
|
||||
#define FD_READ 0xE6 /* read with MT, MFM, SKip deleted */
|
||||
#define FD_WRITE 0xC5 /* write with MT, MFM */
|
||||
#define FD_SENSEI 0x08 /* Sense Interrupt Status */
|
||||
#define FD_SPECIFY 0x03 /* specify HUT etc */
|
||||
#define FD_FORMAT 0x4D /* format one track */
|
||||
#define FD_VERSION 0x10 /* get version code */
|
||||
#define FD_CONFIGURE 0x13 /* configure FIFO operation */
|
||||
#define FD_PERPENDICULAR 0x12 /* perpendicular r/w mode */
|
||||
|
||||
#endif /* _LINUX_AMIFDREG_H */
|
||||
144
include/linux/amigaffs.h
Normal file
144
include/linux/amigaffs.h
Normal file
@@ -0,0 +1,144 @@
|
||||
#ifndef AMIGAFFS_H
|
||||
#define AMIGAFFS_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
#define FS_OFS 0x444F5300
|
||||
#define FS_FFS 0x444F5301
|
||||
#define FS_INTLOFS 0x444F5302
|
||||
#define FS_INTLFFS 0x444F5303
|
||||
#define FS_DCOFS 0x444F5304
|
||||
#define FS_DCFFS 0x444F5305
|
||||
#define MUFS_FS 0x6d754653 /* 'muFS' */
|
||||
#define MUFS_OFS 0x6d754600 /* 'muF\0' */
|
||||
#define MUFS_FFS 0x6d754601 /* 'muF\1' */
|
||||
#define MUFS_INTLOFS 0x6d754602 /* 'muF\2' */
|
||||
#define MUFS_INTLFFS 0x6d754603 /* 'muF\3' */
|
||||
#define MUFS_DCOFS 0x6d754604 /* 'muF\4' */
|
||||
#define MUFS_DCFFS 0x6d754605 /* 'muF\5' */
|
||||
|
||||
#define T_SHORT 2
|
||||
#define T_LIST 16
|
||||
#define T_DATA 8
|
||||
|
||||
#define ST_LINKFILE -4
|
||||
#define ST_FILE -3
|
||||
#define ST_ROOT 1
|
||||
#define ST_USERDIR 2
|
||||
#define ST_SOFTLINK 3
|
||||
#define ST_LINKDIR 4
|
||||
|
||||
#define AFFS_ROOT_BMAPS 25
|
||||
|
||||
struct affs_date {
|
||||
__be32 days;
|
||||
__be32 mins;
|
||||
__be32 ticks;
|
||||
};
|
||||
|
||||
struct affs_short_date {
|
||||
__be16 days;
|
||||
__be16 mins;
|
||||
__be16 ticks;
|
||||
};
|
||||
|
||||
struct affs_root_head {
|
||||
__be32 ptype;
|
||||
__be32 spare1;
|
||||
__be32 spare2;
|
||||
__be32 hash_size;
|
||||
__be32 spare3;
|
||||
__be32 checksum;
|
||||
__be32 hashtable[1];
|
||||
};
|
||||
|
||||
struct affs_root_tail {
|
||||
__be32 bm_flag;
|
||||
__be32 bm_blk[AFFS_ROOT_BMAPS];
|
||||
__be32 bm_ext;
|
||||
struct affs_date root_change;
|
||||
u8 disk_name[32];
|
||||
__be32 spare1;
|
||||
__be32 spare2;
|
||||
struct affs_date disk_change;
|
||||
struct affs_date disk_create;
|
||||
__be32 spare3;
|
||||
__be32 spare4;
|
||||
__be32 dcache;
|
||||
__be32 stype;
|
||||
};
|
||||
|
||||
struct affs_head {
|
||||
__be32 ptype;
|
||||
__be32 key;
|
||||
__be32 block_count;
|
||||
__be32 spare1;
|
||||
__be32 first_data;
|
||||
__be32 checksum;
|
||||
__be32 table[1];
|
||||
};
|
||||
|
||||
struct affs_tail {
|
||||
__be32 spare1;
|
||||
__be16 uid;
|
||||
__be16 gid;
|
||||
__be32 protect;
|
||||
__be32 size;
|
||||
u8 comment[92];
|
||||
struct affs_date change;
|
||||
u8 name[32];
|
||||
__be32 spare2;
|
||||
__be32 original;
|
||||
__be32 link_chain;
|
||||
__be32 spare[5];
|
||||
__be32 hash_chain;
|
||||
__be32 parent;
|
||||
__be32 extension;
|
||||
__be32 stype;
|
||||
};
|
||||
|
||||
struct slink_front
|
||||
{
|
||||
__be32 ptype;
|
||||
__be32 key;
|
||||
__be32 spare1[3];
|
||||
__be32 checksum;
|
||||
u8 symname[1]; /* depends on block size */
|
||||
};
|
||||
|
||||
struct affs_data_head
|
||||
{
|
||||
__be32 ptype;
|
||||
__be32 key;
|
||||
__be32 sequence;
|
||||
__be32 size;
|
||||
__be32 next;
|
||||
__be32 checksum;
|
||||
u8 data[1]; /* depends on block size */
|
||||
};
|
||||
|
||||
/* Permission bits */
|
||||
|
||||
#define FIBF_OTR_READ 0x8000
|
||||
#define FIBF_OTR_WRITE 0x4000
|
||||
#define FIBF_OTR_EXECUTE 0x2000
|
||||
#define FIBF_OTR_DELETE 0x1000
|
||||
#define FIBF_GRP_READ 0x0800
|
||||
#define FIBF_GRP_WRITE 0x0400
|
||||
#define FIBF_GRP_EXECUTE 0x0200
|
||||
#define FIBF_GRP_DELETE 0x0100
|
||||
|
||||
#define FIBF_HIDDEN 0x0080
|
||||
#define FIBF_SCRIPT 0x0040
|
||||
#define FIBF_PURE 0x0020 /* no use under linux */
|
||||
#define FIBF_ARCHIVED 0x0010 /* never set, always cleared on write */
|
||||
#define FIBF_NOREAD 0x0008 /* 0 means allowed */
|
||||
#define FIBF_NOWRITE 0x0004 /* 0 means allowed */
|
||||
#define FIBF_NOEXECUTE 0x0002 /* 0 means allowed, ignored under linux */
|
||||
#define FIBF_NODELETE 0x0001 /* 0 means allowed */
|
||||
|
||||
#define FIBF_OWNER 0x000F /* Bits pertaining to owner */
|
||||
#define FIBF_MASK 0xEE0E /* Bits modified by Linux */
|
||||
|
||||
#endif
|
||||
62
include/linux/apm-emulation.h
Normal file
62
include/linux/apm-emulation.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- linux-c -*-
|
||||
*
|
||||
* (C) 2003 zecke@handhelds.org
|
||||
*
|
||||
* GPL version 2
|
||||
*
|
||||
* based on arch/arm/kernel/apm.c
|
||||
* factor out the information needed by architectures to provide
|
||||
* apm status
|
||||
*/
|
||||
#ifndef __LINUX_APM_EMULATION_H
|
||||
#define __LINUX_APM_EMULATION_H
|
||||
|
||||
#include <linux/apm_bios.h>
|
||||
|
||||
/*
|
||||
* This structure gets filled in by the machine specific 'get_power_status'
|
||||
* implementation. Any fields which are not set default to a safe value.
|
||||
*/
|
||||
struct apm_power_info {
|
||||
unsigned char ac_line_status;
|
||||
#define APM_AC_OFFLINE 0
|
||||
#define APM_AC_ONLINE 1
|
||||
#define APM_AC_BACKUP 2
|
||||
#define APM_AC_UNKNOWN 0xff
|
||||
|
||||
unsigned char battery_status;
|
||||
#define APM_BATTERY_STATUS_HIGH 0
|
||||
#define APM_BATTERY_STATUS_LOW 1
|
||||
#define APM_BATTERY_STATUS_CRITICAL 2
|
||||
#define APM_BATTERY_STATUS_CHARGING 3
|
||||
#define APM_BATTERY_STATUS_NOT_PRESENT 4
|
||||
#define APM_BATTERY_STATUS_UNKNOWN 0xff
|
||||
|
||||
unsigned char battery_flag;
|
||||
#define APM_BATTERY_FLAG_HIGH (1 << 0)
|
||||
#define APM_BATTERY_FLAG_LOW (1 << 1)
|
||||
#define APM_BATTERY_FLAG_CRITICAL (1 << 2)
|
||||
#define APM_BATTERY_FLAG_CHARGING (1 << 3)
|
||||
#define APM_BATTERY_FLAG_NOT_PRESENT (1 << 7)
|
||||
#define APM_BATTERY_FLAG_UNKNOWN 0xff
|
||||
|
||||
int battery_life;
|
||||
int time;
|
||||
int units;
|
||||
#define APM_UNITS_MINS 0
|
||||
#define APM_UNITS_SECS 1
|
||||
#define APM_UNITS_UNKNOWN -1
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* This allows machines to provide their own "apm get power status" function.
|
||||
*/
|
||||
extern void (*apm_get_power_status)(struct apm_power_info *);
|
||||
|
||||
/*
|
||||
* Queue an event (APM_SYS_SUSPEND or APM_CRITICAL_SUSPEND)
|
||||
*/
|
||||
void apm_queue_event(apm_event_t event);
|
||||
|
||||
#endif /* __LINUX_APM_EMULATION_H */
|
||||
218
include/linux/apm_bios.h
Normal file
218
include/linux/apm_bios.h
Normal file
@@ -0,0 +1,218 @@
|
||||
#ifndef _LINUX_APM_H
|
||||
#define _LINUX_APM_H
|
||||
|
||||
/*
|
||||
* Include file for the interface to an APM BIOS
|
||||
* Copyright 1994-2001 Stephen Rothwell (sfr@canb.auug.org.au)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2, or (at your option) any
|
||||
* later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*/
|
||||
|
||||
typedef unsigned short apm_event_t;
|
||||
typedef unsigned short apm_eventinfo_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#define APM_CS (GDT_ENTRY_APMBIOS_BASE * 8)
|
||||
#define APM_CS_16 (APM_CS + 8)
|
||||
#define APM_DS (APM_CS_16 + 8)
|
||||
|
||||
struct apm_bios_info {
|
||||
unsigned short version;
|
||||
unsigned short cseg;
|
||||
unsigned long offset;
|
||||
unsigned short cseg_16;
|
||||
unsigned short dseg;
|
||||
unsigned short flags;
|
||||
unsigned short cseg_len;
|
||||
unsigned short cseg_16_len;
|
||||
unsigned short dseg_len;
|
||||
};
|
||||
|
||||
/* Results of APM Installation Check */
|
||||
#define APM_16_BIT_SUPPORT 0x0001
|
||||
#define APM_32_BIT_SUPPORT 0x0002
|
||||
#define APM_IDLE_SLOWS_CLOCK 0x0004
|
||||
#define APM_BIOS_DISABLED 0x0008
|
||||
#define APM_BIOS_DISENGAGED 0x0010
|
||||
|
||||
/*
|
||||
* Data for APM that is persistent across module unload/load
|
||||
*/
|
||||
struct apm_info {
|
||||
struct apm_bios_info bios;
|
||||
unsigned short connection_version;
|
||||
int get_power_status_broken;
|
||||
int get_power_status_swabinminutes;
|
||||
int allow_ints;
|
||||
int forbid_idle;
|
||||
int realmode_power_off;
|
||||
int disabled;
|
||||
};
|
||||
|
||||
/*
|
||||
* The APM function codes
|
||||
*/
|
||||
#define APM_FUNC_INST_CHECK 0x5300
|
||||
#define APM_FUNC_REAL_CONN 0x5301
|
||||
#define APM_FUNC_16BIT_CONN 0x5302
|
||||
#define APM_FUNC_32BIT_CONN 0x5303
|
||||
#define APM_FUNC_DISCONN 0x5304
|
||||
#define APM_FUNC_IDLE 0x5305
|
||||
#define APM_FUNC_BUSY 0x5306
|
||||
#define APM_FUNC_SET_STATE 0x5307
|
||||
#define APM_FUNC_ENABLE_PM 0x5308
|
||||
#define APM_FUNC_RESTORE_BIOS 0x5309
|
||||
#define APM_FUNC_GET_STATUS 0x530a
|
||||
#define APM_FUNC_GET_EVENT 0x530b
|
||||
#define APM_FUNC_GET_STATE 0x530c
|
||||
#define APM_FUNC_ENABLE_DEV_PM 0x530d
|
||||
#define APM_FUNC_VERSION 0x530e
|
||||
#define APM_FUNC_ENGAGE_PM 0x530f
|
||||
#define APM_FUNC_GET_CAP 0x5310
|
||||
#define APM_FUNC_RESUME_TIMER 0x5311
|
||||
#define APM_FUNC_RESUME_ON_RING 0x5312
|
||||
#define APM_FUNC_TIMER 0x5313
|
||||
|
||||
/*
|
||||
* Function code for APM_FUNC_RESUME_TIMER
|
||||
*/
|
||||
#define APM_FUNC_DISABLE_TIMER 0
|
||||
#define APM_FUNC_GET_TIMER 1
|
||||
#define APM_FUNC_SET_TIMER 2
|
||||
|
||||
/*
|
||||
* Function code for APM_FUNC_RESUME_ON_RING
|
||||
*/
|
||||
#define APM_FUNC_DISABLE_RING 0
|
||||
#define APM_FUNC_ENABLE_RING 1
|
||||
#define APM_FUNC_GET_RING 2
|
||||
|
||||
/*
|
||||
* Function code for APM_FUNC_TIMER_STATUS
|
||||
*/
|
||||
#define APM_FUNC_TIMER_DISABLE 0
|
||||
#define APM_FUNC_TIMER_ENABLE 1
|
||||
#define APM_FUNC_TIMER_GET 2
|
||||
|
||||
/*
|
||||
* in arch/i386/kernel/setup.c
|
||||
*/
|
||||
extern struct apm_info apm_info;
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
/*
|
||||
* Power states
|
||||
*/
|
||||
#define APM_STATE_READY 0x0000
|
||||
#define APM_STATE_STANDBY 0x0001
|
||||
#define APM_STATE_SUSPEND 0x0002
|
||||
#define APM_STATE_OFF 0x0003
|
||||
#define APM_STATE_BUSY 0x0004
|
||||
#define APM_STATE_REJECT 0x0005
|
||||
#define APM_STATE_OEM_SYS 0x0020
|
||||
#define APM_STATE_OEM_DEV 0x0040
|
||||
|
||||
#define APM_STATE_DISABLE 0x0000
|
||||
#define APM_STATE_ENABLE 0x0001
|
||||
|
||||
#define APM_STATE_DISENGAGE 0x0000
|
||||
#define APM_STATE_ENGAGE 0x0001
|
||||
|
||||
/*
|
||||
* Events (results of Get PM Event)
|
||||
*/
|
||||
#define APM_SYS_STANDBY 0x0001
|
||||
#define APM_SYS_SUSPEND 0x0002
|
||||
#define APM_NORMAL_RESUME 0x0003
|
||||
#define APM_CRITICAL_RESUME 0x0004
|
||||
#define APM_LOW_BATTERY 0x0005
|
||||
#define APM_POWER_STATUS_CHANGE 0x0006
|
||||
#define APM_UPDATE_TIME 0x0007
|
||||
#define APM_CRITICAL_SUSPEND 0x0008
|
||||
#define APM_USER_STANDBY 0x0009
|
||||
#define APM_USER_SUSPEND 0x000a
|
||||
#define APM_STANDBY_RESUME 0x000b
|
||||
#define APM_CAPABILITY_CHANGE 0x000c
|
||||
|
||||
/*
|
||||
* Error codes
|
||||
*/
|
||||
#define APM_SUCCESS 0x00
|
||||
#define APM_DISABLED 0x01
|
||||
#define APM_CONNECTED 0x02
|
||||
#define APM_NOT_CONNECTED 0x03
|
||||
#define APM_16_CONNECTED 0x05
|
||||
#define APM_16_UNSUPPORTED 0x06
|
||||
#define APM_32_CONNECTED 0x07
|
||||
#define APM_32_UNSUPPORTED 0x08
|
||||
#define APM_BAD_DEVICE 0x09
|
||||
#define APM_BAD_PARAM 0x0a
|
||||
#define APM_NOT_ENGAGED 0x0b
|
||||
#define APM_BAD_FUNCTION 0x0c
|
||||
#define APM_RESUME_DISABLED 0x0d
|
||||
#define APM_NO_ERROR 0x53
|
||||
#define APM_BAD_STATE 0x60
|
||||
#define APM_NO_EVENTS 0x80
|
||||
#define APM_NOT_PRESENT 0x86
|
||||
|
||||
/*
|
||||
* APM Device IDs
|
||||
*/
|
||||
#define APM_DEVICE_BIOS 0x0000
|
||||
#define APM_DEVICE_ALL 0x0001
|
||||
#define APM_DEVICE_DISPLAY 0x0100
|
||||
#define APM_DEVICE_STORAGE 0x0200
|
||||
#define APM_DEVICE_PARALLEL 0x0300
|
||||
#define APM_DEVICE_SERIAL 0x0400
|
||||
#define APM_DEVICE_NETWORK 0x0500
|
||||
#define APM_DEVICE_PCMCIA 0x0600
|
||||
#define APM_DEVICE_BATTERY 0x8000
|
||||
#define APM_DEVICE_OEM 0xe000
|
||||
#define APM_DEVICE_OLD_ALL 0xffff
|
||||
#define APM_DEVICE_CLASS 0x00ff
|
||||
#define APM_DEVICE_MASK 0xff00
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* This is the "All Devices" ID communicated to the BIOS
|
||||
*/
|
||||
#define APM_DEVICE_BALL ((apm_info.connection_version > 0x0100) ? \
|
||||
APM_DEVICE_ALL : APM_DEVICE_OLD_ALL)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Battery status
|
||||
*/
|
||||
#define APM_MAX_BATTERIES 2
|
||||
|
||||
/*
|
||||
* APM defined capability bit flags
|
||||
*/
|
||||
#define APM_CAP_GLOBAL_STANDBY 0x0001
|
||||
#define APM_CAP_GLOBAL_SUSPEND 0x0002
|
||||
#define APM_CAP_RESUME_STANDBY_TIMER 0x0004 /* Timer resume from standby */
|
||||
#define APM_CAP_RESUME_SUSPEND_TIMER 0x0008 /* Timer resume from suspend */
|
||||
#define APM_CAP_RESUME_STANDBY_RING 0x0010 /* Resume on Ring fr standby */
|
||||
#define APM_CAP_RESUME_SUSPEND_RING 0x0020 /* Resume on Ring fr suspend */
|
||||
#define APM_CAP_RESUME_STANDBY_PCMCIA 0x0040 /* Resume on PCMCIA Ring */
|
||||
#define APM_CAP_RESUME_SUSPEND_PCMCIA 0x0080 /* Resume on PCMCIA Ring */
|
||||
|
||||
/*
|
||||
* ioctl operations
|
||||
*/
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define APM_IOC_STANDBY _IO('A', 1)
|
||||
#define APM_IOC_SUSPEND _IO('A', 2)
|
||||
|
||||
#endif /* LINUX_APM_H */
|
||||
341
include/linux/arcdevice.h
Normal file
341
include/linux/arcdevice.h
Normal file
@@ -0,0 +1,341 @@
|
||||
/*
|
||||
* INET An implementation of the TCP/IP protocol suite for the LINUX
|
||||
* operating system. NET is implemented using the BSD Socket
|
||||
* interface as the means of communication with the user level.
|
||||
*
|
||||
* Definitions used by the ARCnet driver.
|
||||
*
|
||||
* Authors: Avery Pennarun and David Woodhouse
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
*/
|
||||
#ifndef _LINUX_ARCDEVICE_H
|
||||
#define _LINUX_ARCDEVICE_H
|
||||
|
||||
#include <asm/timex.h>
|
||||
#include <linux/if_arcnet.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#ifndef bool
|
||||
#define bool int
|
||||
#endif
|
||||
|
||||
/*
|
||||
* RECON_THRESHOLD is the maximum number of RECON messages to receive
|
||||
* within one minute before printing a "cabling problem" warning. The
|
||||
* default value should be fine.
|
||||
*
|
||||
* After that, a "cabling restored" message will be printed on the next IRQ
|
||||
* if no RECON messages have been received for 10 seconds.
|
||||
*
|
||||
* Do not define RECON_THRESHOLD at all if you want to disable this feature.
|
||||
*/
|
||||
#define RECON_THRESHOLD 30
|
||||
|
||||
|
||||
/*
|
||||
* Define this to the minimum "timeout" value. If a transmit takes longer
|
||||
* than TX_TIMEOUT jiffies, Linux will abort the TX and retry. On a large
|
||||
* network, or one with heavy network traffic, this timeout may need to be
|
||||
* increased. The larger it is, though, the longer it will be between
|
||||
* necessary transmits - don't set this too high.
|
||||
*/
|
||||
#define TX_TIMEOUT (HZ * 200 / 1000)
|
||||
|
||||
|
||||
/* Display warnings about the driver being an ALPHA version. */
|
||||
#undef ALPHA_WARNING
|
||||
|
||||
|
||||
/*
|
||||
* Debugging bitflags: each option can be enabled individually.
|
||||
*
|
||||
* Note: only debug flags included in the ARCNET_DEBUG_MAX define will
|
||||
* actually be available. GCC will (at least, GCC 2.7.0 will) notice
|
||||
* lines using a BUGLVL not in ARCNET_DEBUG_MAX and automatically optimize
|
||||
* them out.
|
||||
*/
|
||||
#define D_NORMAL 1 /* important operational info */
|
||||
#define D_EXTRA 2 /* useful, but non-vital information */
|
||||
#define D_INIT 4 /* show init/probe messages */
|
||||
#define D_INIT_REASONS 8 /* show reasons for discarding probes */
|
||||
#define D_RECON 32 /* print a message whenever token is lost */
|
||||
#define D_PROTO 64 /* debug auto-protocol support */
|
||||
/* debug levels below give LOTS of output during normal operation! */
|
||||
#define D_DURING 128 /* trace operations (including irq's) */
|
||||
#define D_TX 256 /* show tx packets */
|
||||
#define D_RX 512 /* show rx packets */
|
||||
#define D_SKB 1024 /* show skb's */
|
||||
#define D_SKB_SIZE 2048 /* show skb sizes */
|
||||
#define D_TIMING 4096 /* show time needed to copy buffers to card */
|
||||
#define D_DEBUG 8192 /* Very detailed debug line for line */
|
||||
|
||||
#ifndef ARCNET_DEBUG_MAX
|
||||
#define ARCNET_DEBUG_MAX (127) /* change to ~0 if you want detailed debugging */
|
||||
#endif
|
||||
|
||||
#ifndef ARCNET_DEBUG
|
||||
#define ARCNET_DEBUG (D_NORMAL|D_EXTRA)
|
||||
#endif
|
||||
extern int arcnet_debug;
|
||||
|
||||
/* macros to simplify debug checking */
|
||||
#define BUGLVL(x) if ((ARCNET_DEBUG_MAX)&arcnet_debug&(x))
|
||||
#define BUGMSG2(x,msg,args...) do { BUGLVL(x) printk(msg, ## args); } while (0)
|
||||
#define BUGMSG(x,msg,args...) \
|
||||
BUGMSG2(x, "%s%6s: " msg, \
|
||||
x==D_NORMAL ? KERN_WARNING \
|
||||
: x < D_DURING ? KERN_INFO : KERN_DEBUG, \
|
||||
dev->name , ## args)
|
||||
|
||||
/* see how long a function call takes to run, expressed in CPU cycles */
|
||||
#define TIME(name, bytes, call) BUGLVL(D_TIMING) { \
|
||||
unsigned long _x, _y; \
|
||||
_x = get_cycles(); \
|
||||
call; \
|
||||
_y = get_cycles(); \
|
||||
BUGMSG(D_TIMING, \
|
||||
"%s: %d bytes in %lu cycles == " \
|
||||
"%lu Kbytes/100Mcycle\n",\
|
||||
name, bytes, _y - _x, \
|
||||
100000000 / 1024 * bytes / (_y - _x + 1));\
|
||||
} \
|
||||
else { \
|
||||
call;\
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Time needed to reset the card - in ms (milliseconds). This works on my
|
||||
* SMC PC100. I can't find a reference that tells me just how long I
|
||||
* should wait.
|
||||
*/
|
||||
#define RESETtime (300)
|
||||
|
||||
/*
|
||||
* These are the max/min lengths of packet payload, not including the
|
||||
* arc_hardware header, but definitely including the soft header.
|
||||
*
|
||||
* Note: packet sizes 254, 255, 256 are impossible because of the way
|
||||
* ARCnet registers work That's why RFC1201 defines "exception" packets.
|
||||
* In non-RFC1201 protocols, we have to just tack some extra bytes on the
|
||||
* end.
|
||||
*/
|
||||
#define MTU 253 /* normal packet max size */
|
||||
#define MinTU 257 /* extended packet min size */
|
||||
#define XMTU 508 /* extended packet max size */
|
||||
|
||||
/* status/interrupt mask bit fields */
|
||||
#define TXFREEflag 0x01 /* transmitter available */
|
||||
#define TXACKflag 0x02 /* transmitted msg. ackd */
|
||||
#define RECONflag 0x04 /* network reconfigured */
|
||||
#define TESTflag 0x08 /* test flag */
|
||||
#define EXCNAKflag 0x08 /* excesive nak flag */
|
||||
#define RESETflag 0x10 /* power-on-reset */
|
||||
#define RES1flag 0x20 /* reserved - usually set by jumper */
|
||||
#define RES2flag 0x40 /* reserved - usually set by jumper */
|
||||
#define NORXflag 0x80 /* receiver inhibited */
|
||||
|
||||
/* Flags used for IO-mapped memory operations */
|
||||
#define AUTOINCflag 0x40 /* Increase location with each access */
|
||||
#define IOMAPflag 0x02 /* (for 90xx) Use IO mapped memory, not mmap */
|
||||
#define ENABLE16flag 0x80 /* (for 90xx) Enable 16-bit mode */
|
||||
|
||||
/* in the command register, the following bits have these meanings:
|
||||
* 0-2 command
|
||||
* 3-4 page number (for enable rcv/xmt command)
|
||||
* 7 receive broadcasts
|
||||
*/
|
||||
#define NOTXcmd 0x01 /* disable transmitter */
|
||||
#define NORXcmd 0x02 /* disable receiver */
|
||||
#define TXcmd 0x03 /* enable transmitter */
|
||||
#define RXcmd 0x04 /* enable receiver */
|
||||
#define CONFIGcmd 0x05 /* define configuration */
|
||||
#define CFLAGScmd 0x06 /* clear flags */
|
||||
#define TESTcmd 0x07 /* load test flags */
|
||||
|
||||
/* flags for "clear flags" command */
|
||||
#define RESETclear 0x08 /* power-on-reset */
|
||||
#define CONFIGclear 0x10 /* system reconfigured */
|
||||
|
||||
#define EXCNAKclear 0x0E /* Clear and acknowledge the excive nak bit */
|
||||
|
||||
/* flags for "load test flags" command */
|
||||
#define TESTload 0x08 /* test flag (diagnostic) */
|
||||
|
||||
/* byte deposited into first address of buffers on reset */
|
||||
#define TESTvalue 0321 /* that's octal for 0xD1 :) */
|
||||
|
||||
/* for "enable receiver" command */
|
||||
#define RXbcasts 0x80 /* receive broadcasts */
|
||||
|
||||
/* flags for "define configuration" command */
|
||||
#define NORMALconf 0x00 /* 1-249 byte packets */
|
||||
#define EXTconf 0x08 /* 250-504 byte packets */
|
||||
|
||||
/* card feature flags, set during auto-detection.
|
||||
* (currently only used by com20020pci)
|
||||
*/
|
||||
#define ARC_IS_5MBIT 1 /* card default speed is 5MBit */
|
||||
#define ARC_CAN_10MBIT 2 /* card uses COM20022, supporting 10MBit,
|
||||
but default is 2.5MBit. */
|
||||
|
||||
|
||||
/* information needed to define an encapsulation driver */
|
||||
struct ArcProto {
|
||||
char suffix; /* a for RFC1201, e for ether-encap, etc. */
|
||||
int mtu; /* largest possible packet */
|
||||
int is_ip; /* This is a ip plugin - not a raw thing */
|
||||
|
||||
void (*rx) (struct net_device * dev, int bufnum,
|
||||
struct archdr * pkthdr, int length);
|
||||
int (*build_header) (struct sk_buff * skb, struct net_device *dev,
|
||||
unsigned short ethproto, uint8_t daddr);
|
||||
|
||||
/* these functions return '1' if the skb can now be freed */
|
||||
int (*prepare_tx) (struct net_device * dev, struct archdr * pkt, int length,
|
||||
int bufnum);
|
||||
int (*continue_tx) (struct net_device * dev, int bufnum);
|
||||
int (*ack_tx) (struct net_device * dev, int acked);
|
||||
};
|
||||
|
||||
extern struct ArcProto *arc_proto_map[256], *arc_proto_default,
|
||||
*arc_bcast_proto, *arc_raw_proto;
|
||||
|
||||
|
||||
/*
|
||||
* "Incoming" is information needed for each address that could be sending
|
||||
* to us. Mostly for partially-received split packets.
|
||||
*/
|
||||
struct Incoming {
|
||||
struct sk_buff *skb; /* packet data buffer */
|
||||
uint16_t sequence; /* sequence number of assembly */
|
||||
uint8_t lastpacket, /* number of last packet (from 1) */
|
||||
numpackets; /* number of packets in split */
|
||||
};
|
||||
|
||||
|
||||
/* only needed for RFC1201 */
|
||||
struct Outgoing {
|
||||
struct ArcProto *proto; /* protocol driver that owns this:
|
||||
* if NULL, no packet is pending.
|
||||
*/
|
||||
struct sk_buff *skb; /* buffer from upper levels */
|
||||
struct archdr *pkt; /* a pointer into the skb */
|
||||
uint16_t length, /* bytes total */
|
||||
dataleft, /* bytes left */
|
||||
segnum, /* segment being sent */
|
||||
numsegs; /* number of segments */
|
||||
};
|
||||
|
||||
|
||||
struct arcnet_local {
|
||||
struct net_device_stats stats;
|
||||
|
||||
uint8_t config, /* current value of CONFIG register */
|
||||
timeout, /* Extended timeout for COM20020 */
|
||||
backplane, /* Backplane flag for COM20020 */
|
||||
clockp, /* COM20020 clock divider */
|
||||
clockm, /* COM20020 clock multiplier flag */
|
||||
setup, /* Contents of setup1 register */
|
||||
setup2, /* Contents of setup2 register */
|
||||
intmask; /* current value of INTMASK register */
|
||||
uint8_t default_proto[256]; /* default encap to use for each host */
|
||||
int cur_tx, /* buffer used by current transmit, or -1 */
|
||||
next_tx, /* buffer where a packet is ready to send */
|
||||
cur_rx; /* current receive buffer */
|
||||
int lastload_dest, /* can last loaded packet be acked? */
|
||||
lasttrans_dest; /* can last TX'd packet be acked? */
|
||||
int timed_out; /* need to process TX timeout and drop packet */
|
||||
unsigned long last_timeout; /* time of last reported timeout */
|
||||
char *card_name; /* card ident string */
|
||||
int card_flags; /* special card features */
|
||||
|
||||
|
||||
/* On preemtive and SMB a lock is needed */
|
||||
spinlock_t lock;
|
||||
|
||||
/*
|
||||
* Buffer management: an ARCnet card has 4 x 512-byte buffers, each of
|
||||
* which can be used for either sending or receiving. The new dynamic
|
||||
* buffer management routines use a simple circular queue of available
|
||||
* buffers, and take them as they're needed. This way, we simplify
|
||||
* situations in which we (for example) want to pre-load a transmit
|
||||
* buffer, or start receiving while we copy a received packet to
|
||||
* memory.
|
||||
*
|
||||
* The rules: only the interrupt handler is allowed to _add_ buffers to
|
||||
* the queue; thus, this doesn't require a lock. Both the interrupt
|
||||
* handler and the transmit function will want to _remove_ buffers, so
|
||||
* we need to handle the situation where they try to do it at the same
|
||||
* time.
|
||||
*
|
||||
* If next_buf == first_free_buf, the queue is empty. Since there are
|
||||
* only four possible buffers, the queue should never be full.
|
||||
*/
|
||||
atomic_t buf_lock;
|
||||
int buf_queue[5];
|
||||
int next_buf, first_free_buf;
|
||||
|
||||
/* network "reconfiguration" handling */
|
||||
time_t first_recon, /* time of "first" RECON message to count */
|
||||
last_recon; /* time of most recent RECON */
|
||||
int num_recons; /* number of RECONs between first and last. */
|
||||
bool network_down; /* do we think the network is down? */
|
||||
|
||||
bool excnak_pending; /* We just got an excesive nak interrupt */
|
||||
|
||||
struct {
|
||||
uint16_t sequence; /* sequence number (incs with each packet) */
|
||||
uint16_t aborted_seq;
|
||||
|
||||
struct Incoming incoming[256]; /* one from each address */
|
||||
} rfc1201;
|
||||
|
||||
/* really only used by rfc1201, but we'll pretend it's not */
|
||||
struct Outgoing outgoing; /* packet currently being sent */
|
||||
|
||||
/* hardware-specific functions */
|
||||
struct {
|
||||
struct module *owner;
|
||||
void (*command) (struct net_device * dev, int cmd);
|
||||
int (*status) (struct net_device * dev);
|
||||
void (*intmask) (struct net_device * dev, int mask);
|
||||
bool (*reset) (struct net_device * dev, bool really_reset);
|
||||
void (*open) (struct net_device * dev);
|
||||
void (*close) (struct net_device * dev);
|
||||
|
||||
void (*copy_to_card) (struct net_device * dev, int bufnum, int offset,
|
||||
void *buf, int count);
|
||||
void (*copy_from_card) (struct net_device * dev, int bufnum, int offset,
|
||||
void *buf, int count);
|
||||
} hw;
|
||||
|
||||
void __iomem *mem_start; /* pointer to ioremap'ed MMIO */
|
||||
};
|
||||
|
||||
|
||||
#define ARCRESET(x) (lp->hw.reset(dev, (x)))
|
||||
#define ACOMMAND(x) (lp->hw.command(dev, (x)))
|
||||
#define ASTATUS() (lp->hw.status(dev))
|
||||
#define AINTMASK(x) (lp->hw.intmask(dev, (x)))
|
||||
|
||||
|
||||
|
||||
#if ARCNET_DEBUG_MAX & D_SKB
|
||||
void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
|
||||
#else
|
||||
#define arcnet_dump_skb(dev,skb,desc) ;
|
||||
#endif
|
||||
|
||||
void arcnet_unregister_proto(struct ArcProto *proto);
|
||||
irqreturn_t arcnet_interrupt(int irq, void *dev_id);
|
||||
struct net_device *alloc_arcdev(char *name);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_ARCDEVICE_H */
|
||||
8
include/linux/arcfb.h
Normal file
8
include/linux/arcfb.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef __LINUX_ARCFB_H__
|
||||
#define __LINUX_ARCFB_H__
|
||||
|
||||
#define FBIO_WAITEVENT _IO('F', 0x88)
|
||||
#define FBIO_GETCONTROL2 _IOR('F', 0x89, size_t)
|
||||
|
||||
#endif
|
||||
|
||||
409
include/linux/ata.h
Normal file
409
include/linux/ata.h
Normal file
@@ -0,0 +1,409 @@
|
||||
|
||||
/*
|
||||
* Copyright 2003-2004 Red Hat, Inc. All rights reserved.
|
||||
* Copyright 2003-2004 Jeff Garzik
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
*
|
||||
* libata documentation is available via 'make {ps|pdf}docs',
|
||||
* as Documentation/DocBook/libata.*
|
||||
*
|
||||
* Hardware documentation available from http://www.t13.org/
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_ATA_H__
|
||||
#define __LINUX_ATA_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
/* defines only for the constants which don't work well as enums */
|
||||
#define ATA_DMA_BOUNDARY 0xffffUL
|
||||
#define ATA_DMA_MASK 0xffffffffULL
|
||||
|
||||
enum {
|
||||
/* various global constants */
|
||||
ATA_MAX_DEVICES = 2, /* per bus/port */
|
||||
ATA_MAX_PRD = 256, /* we could make these 256/256 */
|
||||
ATA_SECT_SIZE = 512,
|
||||
ATA_MAX_SECTORS_128 = 128,
|
||||
ATA_MAX_SECTORS = 256,
|
||||
ATA_MAX_SECTORS_LBA48 = 65535,/* TODO: 65536? */
|
||||
|
||||
ATA_ID_WORDS = 256,
|
||||
ATA_ID_SERNO = 10,
|
||||
ATA_ID_FW_REV = 23,
|
||||
ATA_ID_PROD = 27,
|
||||
ATA_ID_OLD_PIO_MODES = 51,
|
||||
ATA_ID_FIELD_VALID = 53,
|
||||
ATA_ID_MWDMA_MODES = 63,
|
||||
ATA_ID_PIO_MODES = 64,
|
||||
ATA_ID_EIDE_DMA_MIN = 65,
|
||||
ATA_ID_EIDE_PIO = 67,
|
||||
ATA_ID_EIDE_PIO_IORDY = 68,
|
||||
ATA_ID_UDMA_MODES = 88,
|
||||
ATA_ID_MAJOR_VER = 80,
|
||||
ATA_ID_PIO4 = (1 << 1),
|
||||
|
||||
ATA_ID_SERNO_LEN = 20,
|
||||
ATA_ID_FW_REV_LEN = 8,
|
||||
ATA_ID_PROD_LEN = 40,
|
||||
|
||||
ATA_PCI_CTL_OFS = 2,
|
||||
ATA_UDMA0 = (1 << 0),
|
||||
ATA_UDMA1 = ATA_UDMA0 | (1 << 1),
|
||||
ATA_UDMA2 = ATA_UDMA1 | (1 << 2),
|
||||
ATA_UDMA3 = ATA_UDMA2 | (1 << 3),
|
||||
ATA_UDMA4 = ATA_UDMA3 | (1 << 4),
|
||||
ATA_UDMA5 = ATA_UDMA4 | (1 << 5),
|
||||
ATA_UDMA6 = ATA_UDMA5 | (1 << 6),
|
||||
ATA_UDMA7 = ATA_UDMA6 | (1 << 7),
|
||||
/* ATA_UDMA7 is just for completeness... doesn't exist (yet?). */
|
||||
|
||||
ATA_UDMA_MASK_40C = ATA_UDMA2, /* udma0-2 */
|
||||
|
||||
/* DMA-related */
|
||||
ATA_PRD_SZ = 8,
|
||||
ATA_PRD_TBL_SZ = (ATA_MAX_PRD * ATA_PRD_SZ),
|
||||
ATA_PRD_EOT = (1 << 31), /* end-of-table flag */
|
||||
|
||||
ATA_DMA_TABLE_OFS = 4,
|
||||
ATA_DMA_STATUS = 2,
|
||||
ATA_DMA_CMD = 0,
|
||||
ATA_DMA_WR = (1 << 3),
|
||||
ATA_DMA_START = (1 << 0),
|
||||
ATA_DMA_INTR = (1 << 2),
|
||||
ATA_DMA_ERR = (1 << 1),
|
||||
ATA_DMA_ACTIVE = (1 << 0),
|
||||
|
||||
/* bits in ATA command block registers */
|
||||
ATA_HOB = (1 << 7), /* LBA48 selector */
|
||||
ATA_NIEN = (1 << 1), /* disable-irq flag */
|
||||
ATA_LBA = (1 << 6), /* LBA28 selector */
|
||||
ATA_DEV1 = (1 << 4), /* Select Device 1 (slave) */
|
||||
ATA_DEVICE_OBS = (1 << 7) | (1 << 5), /* obs bits in dev reg */
|
||||
ATA_DEVCTL_OBS = (1 << 3), /* obsolete bit in devctl reg */
|
||||
ATA_BUSY = (1 << 7), /* BSY status bit */
|
||||
ATA_DRDY = (1 << 6), /* device ready */
|
||||
ATA_DF = (1 << 5), /* device fault */
|
||||
ATA_DRQ = (1 << 3), /* data request i/o */
|
||||
ATA_ERR = (1 << 0), /* have an error */
|
||||
ATA_SRST = (1 << 2), /* software reset */
|
||||
ATA_ICRC = (1 << 7), /* interface CRC error */
|
||||
ATA_UNC = (1 << 6), /* uncorrectable media error */
|
||||
ATA_IDNF = (1 << 4), /* ID not found */
|
||||
ATA_ABORTED = (1 << 2), /* command aborted */
|
||||
|
||||
/* ATA command block registers */
|
||||
ATA_REG_DATA = 0x00,
|
||||
ATA_REG_ERR = 0x01,
|
||||
ATA_REG_NSECT = 0x02,
|
||||
ATA_REG_LBAL = 0x03,
|
||||
ATA_REG_LBAM = 0x04,
|
||||
ATA_REG_LBAH = 0x05,
|
||||
ATA_REG_DEVICE = 0x06,
|
||||
ATA_REG_STATUS = 0x07,
|
||||
|
||||
ATA_REG_FEATURE = ATA_REG_ERR, /* and their aliases */
|
||||
ATA_REG_CMD = ATA_REG_STATUS,
|
||||
ATA_REG_BYTEL = ATA_REG_LBAM,
|
||||
ATA_REG_BYTEH = ATA_REG_LBAH,
|
||||
ATA_REG_DEVSEL = ATA_REG_DEVICE,
|
||||
ATA_REG_IRQ = ATA_REG_NSECT,
|
||||
|
||||
/* ATA device commands */
|
||||
ATA_CMD_CHK_POWER = 0xE5, /* check power mode */
|
||||
ATA_CMD_STANDBY = 0xE2, /* place in standby power mode */
|
||||
ATA_CMD_IDLE = 0xE3, /* place in idle power mode */
|
||||
ATA_CMD_EDD = 0x90, /* execute device diagnostic */
|
||||
ATA_CMD_FLUSH = 0xE7,
|
||||
ATA_CMD_FLUSH_EXT = 0xEA,
|
||||
ATA_CMD_ID_ATA = 0xEC,
|
||||
ATA_CMD_ID_ATAPI = 0xA1,
|
||||
ATA_CMD_READ = 0xC8,
|
||||
ATA_CMD_READ_EXT = 0x25,
|
||||
ATA_CMD_WRITE = 0xCA,
|
||||
ATA_CMD_WRITE_EXT = 0x35,
|
||||
ATA_CMD_WRITE_FUA_EXT = 0x3D,
|
||||
ATA_CMD_FPDMA_READ = 0x60,
|
||||
ATA_CMD_FPDMA_WRITE = 0x61,
|
||||
ATA_CMD_PIO_READ = 0x20,
|
||||
ATA_CMD_PIO_READ_EXT = 0x24,
|
||||
ATA_CMD_PIO_WRITE = 0x30,
|
||||
ATA_CMD_PIO_WRITE_EXT = 0x34,
|
||||
ATA_CMD_READ_MULTI = 0xC4,
|
||||
ATA_CMD_READ_MULTI_EXT = 0x29,
|
||||
ATA_CMD_WRITE_MULTI = 0xC5,
|
||||
ATA_CMD_WRITE_MULTI_EXT = 0x39,
|
||||
ATA_CMD_WRITE_MULTI_FUA_EXT = 0xCE,
|
||||
ATA_CMD_SET_FEATURES = 0xEF,
|
||||
ATA_CMD_PACKET = 0xA0,
|
||||
ATA_CMD_VERIFY = 0x40,
|
||||
ATA_CMD_VERIFY_EXT = 0x42,
|
||||
ATA_CMD_STANDBYNOW1 = 0xE0,
|
||||
ATA_CMD_IDLEIMMEDIATE = 0xE1,
|
||||
ATA_CMD_INIT_DEV_PARAMS = 0x91,
|
||||
ATA_CMD_READ_NATIVE_MAX = 0xF8,
|
||||
ATA_CMD_READ_NATIVE_MAX_EXT = 0x27,
|
||||
ATA_CMD_READ_LOG_EXT = 0x2f,
|
||||
|
||||
/* READ_LOG_EXT pages */
|
||||
ATA_LOG_SATA_NCQ = 0x10,
|
||||
|
||||
/* SETFEATURES stuff */
|
||||
SETFEATURES_XFER = 0x03,
|
||||
XFER_UDMA_7 = 0x47,
|
||||
XFER_UDMA_6 = 0x46,
|
||||
XFER_UDMA_5 = 0x45,
|
||||
XFER_UDMA_4 = 0x44,
|
||||
XFER_UDMA_3 = 0x43,
|
||||
XFER_UDMA_2 = 0x42,
|
||||
XFER_UDMA_1 = 0x41,
|
||||
XFER_UDMA_0 = 0x40,
|
||||
XFER_MW_DMA_4 = 0x24, /* CFA only */
|
||||
XFER_MW_DMA_3 = 0x23, /* CFA only */
|
||||
XFER_MW_DMA_2 = 0x22,
|
||||
XFER_MW_DMA_1 = 0x21,
|
||||
XFER_MW_DMA_0 = 0x20,
|
||||
XFER_SW_DMA_2 = 0x12,
|
||||
XFER_SW_DMA_1 = 0x11,
|
||||
XFER_SW_DMA_0 = 0x10,
|
||||
XFER_PIO_6 = 0x0E, /* CFA only */
|
||||
XFER_PIO_5 = 0x0D, /* CFA only */
|
||||
XFER_PIO_4 = 0x0C,
|
||||
XFER_PIO_3 = 0x0B,
|
||||
XFER_PIO_2 = 0x0A,
|
||||
XFER_PIO_1 = 0x09,
|
||||
XFER_PIO_0 = 0x08,
|
||||
XFER_PIO_SLOW = 0x00,
|
||||
|
||||
SETFEATURES_WC_ON = 0x02, /* Enable write cache */
|
||||
SETFEATURES_WC_OFF = 0x82, /* Disable write cache */
|
||||
|
||||
/* ATAPI stuff */
|
||||
ATAPI_PKT_DMA = (1 << 0),
|
||||
ATAPI_DMADIR = (1 << 2), /* ATAPI data dir:
|
||||
0=to device, 1=to host */
|
||||
ATAPI_CDB_LEN = 16,
|
||||
|
||||
/* cable types */
|
||||
ATA_CBL_NONE = 0,
|
||||
ATA_CBL_PATA40 = 1,
|
||||
ATA_CBL_PATA80 = 2,
|
||||
ATA_CBL_PATA40_SHORT = 3, /* 40 wire cable to high UDMA spec */
|
||||
ATA_CBL_PATA_UNK = 4,
|
||||
ATA_CBL_SATA = 5,
|
||||
|
||||
/* SATA Status and Control Registers */
|
||||
SCR_STATUS = 0,
|
||||
SCR_ERROR = 1,
|
||||
SCR_CONTROL = 2,
|
||||
SCR_ACTIVE = 3,
|
||||
SCR_NOTIFICATION = 4,
|
||||
|
||||
/* SError bits */
|
||||
SERR_DATA_RECOVERED = (1 << 0), /* recovered data error */
|
||||
SERR_COMM_RECOVERED = (1 << 1), /* recovered comm failure */
|
||||
SERR_DATA = (1 << 8), /* unrecovered data error */
|
||||
SERR_PERSISTENT = (1 << 9), /* persistent data/comm error */
|
||||
SERR_PROTOCOL = (1 << 10), /* protocol violation */
|
||||
SERR_INTERNAL = (1 << 11), /* host internal error */
|
||||
SERR_PHYRDY_CHG = (1 << 16), /* PHY RDY changed */
|
||||
SERR_DEV_XCHG = (1 << 26), /* device exchanged */
|
||||
|
||||
/* struct ata_taskfile flags */
|
||||
ATA_TFLAG_LBA48 = (1 << 0), /* enable 48-bit LBA and "HOB" */
|
||||
ATA_TFLAG_ISADDR = (1 << 1), /* enable r/w to nsect/lba regs */
|
||||
ATA_TFLAG_DEVICE = (1 << 2), /* enable r/w to device reg */
|
||||
ATA_TFLAG_WRITE = (1 << 3), /* data dir: host->dev==1 (write) */
|
||||
ATA_TFLAG_LBA = (1 << 4), /* enable LBA */
|
||||
ATA_TFLAG_FUA = (1 << 5), /* enable FUA */
|
||||
ATA_TFLAG_POLLING = (1 << 6), /* set nIEN to 1 and use polling */
|
||||
};
|
||||
|
||||
enum ata_tf_protocols {
|
||||
/* ATA taskfile protocols */
|
||||
ATA_PROT_UNKNOWN, /* unknown/invalid */
|
||||
ATA_PROT_NODATA, /* no data */
|
||||
ATA_PROT_PIO, /* PIO single sector */
|
||||
ATA_PROT_DMA, /* DMA */
|
||||
ATA_PROT_NCQ, /* NCQ */
|
||||
ATA_PROT_ATAPI, /* packet command, PIO data xfer*/
|
||||
ATA_PROT_ATAPI_NODATA, /* packet command, no data */
|
||||
ATA_PROT_ATAPI_DMA, /* packet command with special DMA sauce */
|
||||
};
|
||||
|
||||
enum ata_ioctls {
|
||||
ATA_IOC_GET_IO32 = 0x309,
|
||||
ATA_IOC_SET_IO32 = 0x324,
|
||||
};
|
||||
|
||||
/* core structures */
|
||||
|
||||
struct ata_prd {
|
||||
u32 addr;
|
||||
u32 flags_len;
|
||||
};
|
||||
|
||||
struct ata_taskfile {
|
||||
unsigned long flags; /* ATA_TFLAG_xxx */
|
||||
u8 protocol; /* ATA_PROT_xxx */
|
||||
|
||||
u8 ctl; /* control reg */
|
||||
|
||||
u8 hob_feature; /* additional data */
|
||||
u8 hob_nsect; /* to support LBA48 */
|
||||
u8 hob_lbal;
|
||||
u8 hob_lbam;
|
||||
u8 hob_lbah;
|
||||
|
||||
u8 feature;
|
||||
u8 nsect;
|
||||
u8 lbal;
|
||||
u8 lbam;
|
||||
u8 lbah;
|
||||
|
||||
u8 device;
|
||||
|
||||
u8 command; /* IO operation */
|
||||
};
|
||||
|
||||
#define ata_id_is_ata(id) (((id)[0] & (1 << 15)) == 0)
|
||||
#define ata_id_rahead_enabled(id) ((id)[85] & (1 << 6))
|
||||
#define ata_id_wcache_enabled(id) ((id)[85] & (1 << 5))
|
||||
#define ata_id_hpa_enabled(id) ((id)[85] & (1 << 10))
|
||||
#define ata_id_has_fua(id) ((id)[84] & (1 << 6))
|
||||
#define ata_id_has_flush(id) ((id)[83] & (1 << 12))
|
||||
#define ata_id_has_flush_ext(id) ((id)[83] & (1 << 13))
|
||||
#define ata_id_has_lba48(id) ((id)[83] & (1 << 10))
|
||||
#define ata_id_has_hpa(id) ((id)[82] & (1 << 10))
|
||||
#define ata_id_has_wcache(id) ((id)[82] & (1 << 5))
|
||||
#define ata_id_has_pm(id) ((id)[82] & (1 << 3))
|
||||
#define ata_id_has_lba(id) ((id)[49] & (1 << 9))
|
||||
#define ata_id_has_dma(id) ((id)[49] & (1 << 8))
|
||||
#define ata_id_has_ncq(id) ((id)[76] & (1 << 8))
|
||||
#define ata_id_queue_depth(id) (((id)[75] & 0x1f) + 1)
|
||||
#define ata_id_removeable(id) ((id)[0] & (1 << 7))
|
||||
#define ata_id_has_dword_io(id) ((id)[50] & (1 << 0))
|
||||
#define ata_id_iordy_disable(id) ((id)[49] & (1 << 10))
|
||||
#define ata_id_has_iordy(id) ((id)[49] & (1 << 9))
|
||||
#define ata_id_u32(id,n) \
|
||||
(((u32) (id)[(n) + 1] << 16) | ((u32) (id)[(n)]))
|
||||
#define ata_id_u64(id,n) \
|
||||
( ((u64) (id)[(n) + 3] << 48) | \
|
||||
((u64) (id)[(n) + 2] << 32) | \
|
||||
((u64) (id)[(n) + 1] << 16) | \
|
||||
((u64) (id)[(n) + 0]) )
|
||||
|
||||
#define ata_id_cdb_intr(id) (((id)[0] & 0x60) == 0x20)
|
||||
|
||||
static inline unsigned int ata_id_major_version(const u16 *id)
|
||||
{
|
||||
unsigned int mver;
|
||||
|
||||
if (id[ATA_ID_MAJOR_VER] == 0xFFFF)
|
||||
return 0;
|
||||
|
||||
for (mver = 14; mver >= 1; mver--)
|
||||
if (id[ATA_ID_MAJOR_VER] & (1 << mver))
|
||||
break;
|
||||
return mver;
|
||||
}
|
||||
|
||||
static inline int ata_id_is_sata(const u16 *id)
|
||||
{
|
||||
return ata_id_major_version(id) >= 5 && id[93] == 0;
|
||||
}
|
||||
|
||||
static inline int ata_id_current_chs_valid(const u16 *id)
|
||||
{
|
||||
/* For ATA-1 devices, if the INITIALIZE DEVICE PARAMETERS command
|
||||
has not been issued to the device then the values of
|
||||
id[54] to id[56] are vendor specific. */
|
||||
return (id[53] & 0x01) && /* Current translation valid */
|
||||
id[54] && /* cylinders in current translation */
|
||||
id[55] && /* heads in current translation */
|
||||
id[55] <= 16 &&
|
||||
id[56]; /* sectors in current translation */
|
||||
}
|
||||
|
||||
static inline int ata_id_is_cfa(const u16 *id)
|
||||
{
|
||||
u16 v = id[0];
|
||||
if (v == 0x848A) /* Standard CF */
|
||||
return 1;
|
||||
/* Could be CF hiding as standard ATA */
|
||||
if (ata_id_major_version(id) >= 3 && id[82] != 0xFFFF &&
|
||||
(id[82] & ( 1 << 2)))
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int ata_drive_40wire(const u16 *dev_id)
|
||||
{
|
||||
if (ata_id_is_sata(dev_id))
|
||||
return 0; /* SATA */
|
||||
if ((dev_id[93] & 0xE000) == 0x6000)
|
||||
return 0; /* 80 wire */
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline int atapi_cdb_len(const u16 *dev_id)
|
||||
{
|
||||
u16 tmp = dev_id[0] & 0x3;
|
||||
switch (tmp) {
|
||||
case 0: return 12;
|
||||
case 1: return 16;
|
||||
default: return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static inline int is_atapi_taskfile(const struct ata_taskfile *tf)
|
||||
{
|
||||
return (tf->protocol == ATA_PROT_ATAPI) ||
|
||||
(tf->protocol == ATA_PROT_ATAPI_NODATA) ||
|
||||
(tf->protocol == ATA_PROT_ATAPI_DMA);
|
||||
}
|
||||
|
||||
static inline int is_multi_taskfile(struct ata_taskfile *tf)
|
||||
{
|
||||
return (tf->command == ATA_CMD_READ_MULTI) ||
|
||||
(tf->command == ATA_CMD_WRITE_MULTI) ||
|
||||
(tf->command == ATA_CMD_READ_MULTI_EXT) ||
|
||||
(tf->command == ATA_CMD_WRITE_MULTI_EXT) ||
|
||||
(tf->command == ATA_CMD_WRITE_MULTI_FUA_EXT);
|
||||
}
|
||||
|
||||
static inline int ata_ok(u8 status)
|
||||
{
|
||||
return ((status & (ATA_BUSY | ATA_DRDY | ATA_DF | ATA_DRQ | ATA_ERR))
|
||||
== ATA_DRDY);
|
||||
}
|
||||
|
||||
static inline int lba_28_ok(u64 block, u32 n_block)
|
||||
{
|
||||
/* check the ending block number */
|
||||
return ((block + n_block - 1) < ((u64)1 << 28)) && (n_block <= 256);
|
||||
}
|
||||
|
||||
static inline int lba_48_ok(u64 block, u32 n_block)
|
||||
{
|
||||
/* check the ending block number */
|
||||
return ((block + n_block - 1) < ((u64)1 << 48)) && (n_block <= 65536);
|
||||
}
|
||||
|
||||
#endif /* __LINUX_ATA_H__ */
|
||||
209
include/linux/atalk.h
Normal file
209
include/linux/atalk.h
Normal file
@@ -0,0 +1,209 @@
|
||||
#ifndef __LINUX_ATALK_H__
|
||||
#define __LINUX_ATALK_H__
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
/*
|
||||
* AppleTalk networking structures
|
||||
*
|
||||
* The following are directly referenced from the University Of Michigan
|
||||
* netatalk for compatibility reasons.
|
||||
*/
|
||||
#define ATPORT_FIRST 1
|
||||
#define ATPORT_RESERVED 128
|
||||
#define ATPORT_LAST 254 /* 254 is only legal on localtalk */
|
||||
#define ATADDR_ANYNET (__u16)0
|
||||
#define ATADDR_ANYNODE (__u8)0
|
||||
#define ATADDR_ANYPORT (__u8)0
|
||||
#define ATADDR_BCAST (__u8)255
|
||||
#define DDP_MAXSZ 587
|
||||
#define DDP_MAXHOPS 15 /* 4 bits of hop counter */
|
||||
|
||||
#define SIOCATALKDIFADDR (SIOCPROTOPRIVATE + 0)
|
||||
|
||||
struct atalk_addr {
|
||||
__be16 s_net;
|
||||
__u8 s_node;
|
||||
};
|
||||
|
||||
struct sockaddr_at {
|
||||
sa_family_t sat_family;
|
||||
__u8 sat_port;
|
||||
struct atalk_addr sat_addr;
|
||||
char sat_zero[8];
|
||||
};
|
||||
|
||||
struct atalk_netrange {
|
||||
__u8 nr_phase;
|
||||
__be16 nr_firstnet;
|
||||
__be16 nr_lastnet;
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <net/sock.h>
|
||||
|
||||
struct atalk_route {
|
||||
struct net_device *dev;
|
||||
struct atalk_addr target;
|
||||
struct atalk_addr gateway;
|
||||
int flags;
|
||||
struct atalk_route *next;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct atalk_iface - AppleTalk Interface
|
||||
* @dev - Network device associated with this interface
|
||||
* @address - Our address
|
||||
* @status - What are we doing?
|
||||
* @nets - Associated direct netrange
|
||||
* @next - next element in the list of interfaces
|
||||
*/
|
||||
struct atalk_iface {
|
||||
struct net_device *dev;
|
||||
struct atalk_addr address;
|
||||
int status;
|
||||
#define ATIF_PROBE 1 /* Probing for an address */
|
||||
#define ATIF_PROBE_FAIL 2 /* Probe collided */
|
||||
struct atalk_netrange nets;
|
||||
struct atalk_iface *next;
|
||||
};
|
||||
|
||||
struct atalk_sock {
|
||||
/* struct sock has to be the first member of atalk_sock */
|
||||
struct sock sk;
|
||||
__be16 dest_net;
|
||||
__be16 src_net;
|
||||
unsigned char dest_node;
|
||||
unsigned char src_node;
|
||||
unsigned char dest_port;
|
||||
unsigned char src_port;
|
||||
};
|
||||
|
||||
static inline struct atalk_sock *at_sk(struct sock *sk)
|
||||
{
|
||||
return (struct atalk_sock *)sk;
|
||||
}
|
||||
|
||||
#include <asm/byteorder.h>
|
||||
|
||||
struct ddpehdr {
|
||||
__be16 deh_len_hops; /* lower 10 bits are length, next 4 - hops */
|
||||
__be16 deh_sum;
|
||||
__be16 deh_dnet;
|
||||
__be16 deh_snet;
|
||||
__u8 deh_dnode;
|
||||
__u8 deh_snode;
|
||||
__u8 deh_dport;
|
||||
__u8 deh_sport;
|
||||
/* And netatalk apps expect to stick the type in themselves */
|
||||
};
|
||||
|
||||
static __inline__ struct ddpehdr *ddp_hdr(struct sk_buff *skb)
|
||||
{
|
||||
return (struct ddpehdr *)skb->h.raw;
|
||||
}
|
||||
|
||||
/* AppleTalk AARP headers */
|
||||
struct elapaarp {
|
||||
__be16 hw_type;
|
||||
#define AARP_HW_TYPE_ETHERNET 1
|
||||
#define AARP_HW_TYPE_TOKENRING 2
|
||||
__be16 pa_type;
|
||||
__u8 hw_len;
|
||||
__u8 pa_len;
|
||||
#define AARP_PA_ALEN 4
|
||||
__be16 function;
|
||||
#define AARP_REQUEST 1
|
||||
#define AARP_REPLY 2
|
||||
#define AARP_PROBE 3
|
||||
__u8 hw_src[ETH_ALEN];
|
||||
__u8 pa_src_zero;
|
||||
__be16 pa_src_net;
|
||||
__u8 pa_src_node;
|
||||
__u8 hw_dst[ETH_ALEN];
|
||||
__u8 pa_dst_zero;
|
||||
__be16 pa_dst_net;
|
||||
__u8 pa_dst_node;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static __inline__ struct elapaarp *aarp_hdr(struct sk_buff *skb)
|
||||
{
|
||||
return (struct elapaarp *)skb->h.raw;
|
||||
}
|
||||
|
||||
/* Not specified - how long till we drop a resolved entry */
|
||||
#define AARP_EXPIRY_TIME (5 * 60 * HZ)
|
||||
/* Size of hash table */
|
||||
#define AARP_HASH_SIZE 16
|
||||
/* Fast retransmission timer when resolving */
|
||||
#define AARP_TICK_TIME (HZ / 5)
|
||||
/* Send 10 requests then give up (2 seconds) */
|
||||
#define AARP_RETRANSMIT_LIMIT 10
|
||||
/*
|
||||
* Some value bigger than total retransmit time + a bit for last reply to
|
||||
* appear and to stop continual requests
|
||||
*/
|
||||
#define AARP_RESOLVE_TIME (10 * HZ)
|
||||
|
||||
extern struct datalink_proto *ddp_dl, *aarp_dl;
|
||||
extern void aarp_proto_init(void);
|
||||
|
||||
/* Inter module exports */
|
||||
|
||||
/* Give a device find its atif control structure */
|
||||
static inline struct atalk_iface *atalk_find_dev(struct net_device *dev)
|
||||
{
|
||||
return dev->atalk_ptr;
|
||||
}
|
||||
|
||||
extern struct atalk_addr *atalk_find_dev_addr(struct net_device *dev);
|
||||
extern struct net_device *atrtr_get_dev(struct atalk_addr *sa);
|
||||
extern int aarp_send_ddp(struct net_device *dev,
|
||||
struct sk_buff *skb,
|
||||
struct atalk_addr *sa, void *hwaddr);
|
||||
extern void aarp_device_down(struct net_device *dev);
|
||||
extern void aarp_probe_network(struct atalk_iface *atif);
|
||||
extern int aarp_proxy_probe_network(struct atalk_iface *atif,
|
||||
struct atalk_addr *sa);
|
||||
extern void aarp_proxy_remove(struct net_device *dev,
|
||||
struct atalk_addr *sa);
|
||||
|
||||
extern void aarp_cleanup_module(void);
|
||||
|
||||
extern struct hlist_head atalk_sockets;
|
||||
extern rwlock_t atalk_sockets_lock;
|
||||
|
||||
extern struct atalk_route *atalk_routes;
|
||||
extern rwlock_t atalk_routes_lock;
|
||||
|
||||
extern struct atalk_iface *atalk_interfaces;
|
||||
extern rwlock_t atalk_interfaces_lock;
|
||||
|
||||
extern struct atalk_route atrtr_default;
|
||||
|
||||
extern const struct file_operations atalk_seq_arp_fops;
|
||||
|
||||
extern int sysctl_aarp_expiry_time;
|
||||
extern int sysctl_aarp_tick_time;
|
||||
extern int sysctl_aarp_retransmit_limit;
|
||||
extern int sysctl_aarp_resolve_time;
|
||||
|
||||
#ifdef CONFIG_SYSCTL
|
||||
extern void atalk_register_sysctl(void);
|
||||
extern void atalk_unregister_sysctl(void);
|
||||
#else
|
||||
#define atalk_register_sysctl() do { } while(0)
|
||||
#define atalk_unregister_sysctl() do { } while(0)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
extern int atalk_proc_init(void);
|
||||
extern void atalk_proc_exit(void);
|
||||
#else
|
||||
#define atalk_proc_init() ({ 0; })
|
||||
#define atalk_proc_exit() do { } while(0)
|
||||
#endif /* CONFIG_PROC_FS */
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* __LINUX_ATALK_H__ */
|
||||
243
include/linux/atm.h
Normal file
243
include/linux/atm.h
Normal file
@@ -0,0 +1,243 @@
|
||||
/* atm.h - general ATM declarations */
|
||||
|
||||
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
/*
|
||||
* WARNING: User-space programs should not #include <linux/atm.h> directly.
|
||||
* Instead, #include <atm.h>
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_ATM_H
|
||||
#define _LINUX_ATM_H
|
||||
|
||||
/*
|
||||
* BEGIN_xx and END_xx markers are used for automatic generation of
|
||||
* documentation. Do not change them.
|
||||
*/
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/socket.h>
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmsap.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
/* general ATM constants */
|
||||
#define ATM_CELL_SIZE 53 /* ATM cell size incl. header */
|
||||
#define ATM_CELL_PAYLOAD 48 /* ATM payload size */
|
||||
#define ATM_AAL0_SDU 52 /* AAL0 SDU size */
|
||||
#define ATM_MAX_AAL34_PDU 65535 /* maximum AAL3/4 PDU payload */
|
||||
#define ATM_AAL5_TRAILER 8 /* AAL5 trailer size */
|
||||
#define ATM_MAX_AAL5_PDU 65535 /* maximum AAL5 PDU payload */
|
||||
#define ATM_MAX_CDV 9999 /* maximum (default) CDV */
|
||||
#define ATM_NOT_RSV_VCI 32 /* first non-reserved VCI value */
|
||||
|
||||
#define ATM_MAX_VPI 255 /* maximum VPI at the UNI */
|
||||
#define ATM_MAX_VPI_NNI 4096 /* maximum VPI at the NNI */
|
||||
#define ATM_MAX_VCI 65535 /* maximum VCI */
|
||||
|
||||
|
||||
/* "protcol" values for the socket system call */
|
||||
#define ATM_NO_AAL 0 /* AAL not specified */
|
||||
#define ATM_AAL0 13 /* "raw" ATM cells */
|
||||
#define ATM_AAL1 1 /* AAL1 (CBR) */
|
||||
#define ATM_AAL2 2 /* AAL2 (VBR) */
|
||||
#define ATM_AAL34 3 /* AAL3/4 (data) */
|
||||
#define ATM_AAL5 5 /* AAL5 (data) */
|
||||
|
||||
/*
|
||||
* socket option name coding functions
|
||||
*
|
||||
* Note that __SO_ENCODE and __SO_LEVEL are somewhat a hack since the
|
||||
* << 22 only reserves 9 bits for the level. On some architectures
|
||||
* SOL_SOCKET is 0xFFFF, so that's a bit of a problem
|
||||
*/
|
||||
|
||||
#define __SO_ENCODE(l,n,t) ((((l) & 0x1FF) << 22) | ((n) << 16) | \
|
||||
sizeof(t))
|
||||
#define __SO_LEVEL_MATCH(c,m) (((c) >> 22) == ((m) & 0x1FF))
|
||||
#define __SO_NUMBER(c) (((c) >> 16) & 0x3f)
|
||||
#define __SO_SIZE(c) ((c) & 0x3fff)
|
||||
|
||||
/*
|
||||
* ATM layer
|
||||
*/
|
||||
|
||||
#define SO_SETCLP __SO_ENCODE(SOL_ATM,0,int)
|
||||
/* set CLP bit value - TODO */
|
||||
#define SO_CIRANGE __SO_ENCODE(SOL_ATM,1,struct atm_cirange)
|
||||
/* connection identifier range; socket must be
|
||||
bound or connected */
|
||||
#define SO_ATMQOS __SO_ENCODE(SOL_ATM,2,struct atm_qos)
|
||||
/* Quality of Service setting */
|
||||
#define SO_ATMSAP __SO_ENCODE(SOL_ATM,3,struct atm_sap)
|
||||
/* Service Access Point */
|
||||
#define SO_ATMPVC __SO_ENCODE(SOL_ATM,4,struct sockaddr_atmpvc)
|
||||
/* "PVC" address (also for SVCs); get only */
|
||||
#define SO_MULTIPOINT __SO_ENCODE(SOL_ATM, 5, int)
|
||||
/* make this vc a p2mp */
|
||||
|
||||
|
||||
/*
|
||||
* Note @@@: since the socket layers don't really distinguish the control and
|
||||
* the data plane but generally seems to be data plane-centric, any layer is
|
||||
* about equally wrong for the SAP. If you have a better idea about this,
|
||||
* please speak up ...
|
||||
*/
|
||||
|
||||
|
||||
/* ATM cell header (for AAL0) */
|
||||
|
||||
/* BEGIN_CH */
|
||||
#define ATM_HDR_GFC_MASK 0xf0000000
|
||||
#define ATM_HDR_GFC_SHIFT 28
|
||||
#define ATM_HDR_VPI_MASK 0x0ff00000
|
||||
#define ATM_HDR_VPI_SHIFT 20
|
||||
#define ATM_HDR_VCI_MASK 0x000ffff0
|
||||
#define ATM_HDR_VCI_SHIFT 4
|
||||
#define ATM_HDR_PTI_MASK 0x0000000e
|
||||
#define ATM_HDR_PTI_SHIFT 1
|
||||
#define ATM_HDR_CLP 0x00000001
|
||||
/* END_CH */
|
||||
|
||||
|
||||
/* PTI codings */
|
||||
|
||||
/* BEGIN_PTI */
|
||||
#define ATM_PTI_US0 0 /* user data cell, congestion not exp, SDU-type 0 */
|
||||
#define ATM_PTI_US1 1 /* user data cell, congestion not exp, SDU-type 1 */
|
||||
#define ATM_PTI_UCES0 2 /* user data cell, cong. experienced, SDU-type 0 */
|
||||
#define ATM_PTI_UCES1 3 /* user data cell, cong. experienced, SDU-type 1 */
|
||||
#define ATM_PTI_SEGF5 4 /* segment OAM F5 flow related cell */
|
||||
#define ATM_PTI_E2EF5 5 /* end-to-end OAM F5 flow related cell */
|
||||
#define ATM_PTI_RSV_RM 6 /* reserved for traffic control/resource mgmt */
|
||||
#define ATM_PTI_RSV 7 /* reserved */
|
||||
/* END_PTI */
|
||||
|
||||
|
||||
/*
|
||||
* The following items should stay in linux/atm.h, which should be linked to
|
||||
* netatm/atm.h
|
||||
*/
|
||||
|
||||
/* Traffic description */
|
||||
|
||||
#define ATM_NONE 0 /* no traffic */
|
||||
#define ATM_UBR 1
|
||||
#define ATM_CBR 2
|
||||
#define ATM_VBR 3
|
||||
#define ATM_ABR 4
|
||||
#define ATM_ANYCLASS 5 /* compatible with everything */
|
||||
|
||||
#define ATM_MAX_PCR -1 /* maximum available PCR */
|
||||
|
||||
struct atm_trafprm {
|
||||
unsigned char traffic_class; /* traffic class (ATM_UBR, ...) */
|
||||
int max_pcr; /* maximum PCR in cells per second */
|
||||
int pcr; /* desired PCR in cells per second */
|
||||
int min_pcr; /* minimum PCR in cells per second */
|
||||
int max_cdv; /* maximum CDV in microseconds */
|
||||
int max_sdu; /* maximum SDU in bytes */
|
||||
/* extra params for ABR */
|
||||
unsigned int icr; /* Initial Cell Rate (24-bit) */
|
||||
unsigned int tbe; /* Transient Buffer Exposure (24-bit) */
|
||||
unsigned int frtt : 24; /* Fixed Round Trip Time (24-bit) */
|
||||
unsigned int rif : 4; /* Rate Increment Factor (4-bit) */
|
||||
unsigned int rdf : 4; /* Rate Decrease Factor (4-bit) */
|
||||
unsigned int nrm_pres :1; /* nrm present bit */
|
||||
unsigned int trm_pres :1; /* rm present bit */
|
||||
unsigned int adtf_pres :1; /* adtf present bit */
|
||||
unsigned int cdf_pres :1; /* cdf present bit*/
|
||||
unsigned int nrm :3; /* Max # of Cells for each forward RM cell (3-bit) */
|
||||
unsigned int trm :3; /* Time between forward RM cells (3-bit) */
|
||||
unsigned int adtf :10; /* ACR Decrease Time Factor (10-bit) */
|
||||
unsigned int cdf :3; /* Cutoff Decrease Factor (3-bit) */
|
||||
unsigned int spare :9; /* spare bits */
|
||||
};
|
||||
|
||||
struct atm_qos {
|
||||
struct atm_trafprm txtp; /* parameters in TX direction */
|
||||
struct atm_trafprm rxtp __ATM_API_ALIGN;
|
||||
/* parameters in RX direction */
|
||||
unsigned char aal __ATM_API_ALIGN;
|
||||
};
|
||||
|
||||
/* PVC addressing */
|
||||
|
||||
#define ATM_ITF_ANY -1 /* "magic" PVC address values */
|
||||
#define ATM_VPI_ANY -1
|
||||
#define ATM_VCI_ANY -1
|
||||
#define ATM_VPI_UNSPEC -2
|
||||
#define ATM_VCI_UNSPEC -2
|
||||
|
||||
|
||||
struct sockaddr_atmpvc {
|
||||
unsigned short sap_family; /* address family, AF_ATMPVC */
|
||||
struct { /* PVC address */
|
||||
short itf; /* ATM interface */
|
||||
short vpi; /* VPI (only 8 bits at UNI) */
|
||||
int vci; /* VCI (only 16 bits at UNI) */
|
||||
} sap_addr __ATM_API_ALIGN; /* PVC address */
|
||||
};
|
||||
|
||||
/* SVC addressing */
|
||||
|
||||
#define ATM_ESA_LEN 20 /* ATM End System Address length */
|
||||
#define ATM_E164_LEN 12 /* maximum E.164 number length */
|
||||
|
||||
#define ATM_AFI_DCC 0x39 /* DCC ATM Format */
|
||||
#define ATM_AFI_ICD 0x47 /* ICD ATM Format */
|
||||
#define ATM_AFI_E164 0x45 /* E.164 ATM Format */
|
||||
#define ATM_AFI_LOCAL 0x49 /* Local ATM Format */
|
||||
|
||||
#define ATM_AFI_DCC_GROUP 0xBD /* DCC ATM Group Format */
|
||||
#define ATM_AFI_ICD_GROUP 0xC5 /* ICD ATM Group Format */
|
||||
#define ATM_AFI_E164_GROUP 0xC3 /* E.164 ATM Group Format */
|
||||
#define ATM_AFI_LOCAL_GROUP 0xC7 /* Local ATM Group Format */
|
||||
|
||||
#define ATM_LIJ_NONE 0 /* no leaf-initiated join */
|
||||
#define ATM_LIJ 1 /* request joining */
|
||||
#define ATM_LIJ_RPJ 2 /* set to root-prompted join */
|
||||
#define ATM_LIJ_NJ 3 /* set to network join */
|
||||
|
||||
|
||||
struct sockaddr_atmsvc {
|
||||
unsigned short sas_family; /* address family, AF_ATMSVC */
|
||||
struct { /* SVC address */
|
||||
unsigned char prv[ATM_ESA_LEN];/* private ATM address */
|
||||
char pub[ATM_E164_LEN+1]; /* public address (E.164) */
|
||||
/* unused addresses must be bzero'ed */
|
||||
char lij_type; /* role in LIJ call; one of ATM_LIJ* */
|
||||
uint32_t lij_id; /* LIJ call identifier */
|
||||
} sas_addr __ATM_API_ALIGN; /* SVC address */
|
||||
};
|
||||
|
||||
|
||||
static __inline__ int atmsvc_addr_in_use(struct sockaddr_atmsvc addr)
|
||||
{
|
||||
return *addr.sas_addr.prv || *addr.sas_addr.pub;
|
||||
}
|
||||
|
||||
|
||||
static __inline__ int atmpvc_addr_in_use(struct sockaddr_atmpvc addr)
|
||||
{
|
||||
return addr.sap_addr.itf || addr.sap_addr.vpi || addr.sap_addr.vci;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Some stuff for linux/sockios.h
|
||||
*/
|
||||
|
||||
struct atmif_sioc {
|
||||
int number;
|
||||
int length;
|
||||
void __user *arg;
|
||||
};
|
||||
|
||||
typedef unsigned short atm_backend_t;
|
||||
#endif
|
||||
23
include/linux/atm_eni.h
Normal file
23
include/linux/atm_eni.h
Normal file
@@ -0,0 +1,23 @@
|
||||
/* atm_eni.h - Driver-specific declarations of the ENI driver (for use by
|
||||
driver-specific utilities) */
|
||||
|
||||
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_ENI_H
|
||||
#define LINUX_ATM_ENI_H
|
||||
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
struct eni_multipliers {
|
||||
int tx,rx; /* values are in percent and must be > 100 */
|
||||
};
|
||||
|
||||
|
||||
#define ENI_MEMDUMP _IOW('a',ATMIOC_SARPRV,struct atmif_sioc)
|
||||
/* printk memory map */
|
||||
#define ENI_SETMULT _IOW('a',ATMIOC_SARPRV+7,struct atmif_sioc)
|
||||
/* set buffer multipliers */
|
||||
|
||||
#endif
|
||||
20
include/linux/atm_he.h
Normal file
20
include/linux/atm_he.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* atm_he.h */
|
||||
|
||||
#ifndef LINUX_ATM_HE_H
|
||||
#define LINUX_ATM_HE_H
|
||||
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
#define HE_GET_REG _IOW('a', ATMIOC_SARPRV, struct atmif_sioc)
|
||||
|
||||
#define HE_REGTYPE_PCI 1
|
||||
#define HE_REGTYPE_RCM 2
|
||||
#define HE_REGTYPE_TCM 3
|
||||
#define HE_REGTYPE_MBOX 4
|
||||
|
||||
struct he_ioctl_reg {
|
||||
unsigned addr, val;
|
||||
char type;
|
||||
};
|
||||
|
||||
#endif /* LINUX_ATM_HE_H */
|
||||
28
include/linux/atm_idt77105.h
Normal file
28
include/linux/atm_idt77105.h
Normal file
@@ -0,0 +1,28 @@
|
||||
/* atm_idt77105.h - Driver-specific declarations of the IDT77105 driver (for
|
||||
* use by driver-specific utilities) */
|
||||
|
||||
/* Written 1999 by Greg Banks <gnb@linuxfan.com>. Copied from atm_suni.h. */
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_IDT77105_H
|
||||
#define LINUX_ATM_IDT77105_H
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/atmioc.h>
|
||||
#include <linux/atmdev.h>
|
||||
|
||||
/*
|
||||
* Structure for IDT77105_GETSTAT and IDT77105_GETSTATZ ioctls.
|
||||
* Pointed to by `arg' in atmif_sioc.
|
||||
*/
|
||||
struct idt77105_stats {
|
||||
__u32 symbol_errors; /* wire symbol errors */
|
||||
__u32 tx_cells; /* cells transmitted */
|
||||
__u32 rx_cells; /* cells received */
|
||||
__u32 rx_hec_errors; /* Header Error Check errors on receive */
|
||||
};
|
||||
|
||||
#define IDT77105_GETSTAT _IOW('a',ATMIOC_PHYPRV+2,struct atmif_sioc) /* get stats */
|
||||
#define IDT77105_GETSTATZ _IOW('a',ATMIOC_PHYPRV+3,struct atmif_sioc) /* get stats and zero */
|
||||
|
||||
#endif
|
||||
53
include/linux/atm_nicstar.h
Normal file
53
include/linux/atm_nicstar.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* atm_nicstar.h
|
||||
*
|
||||
* Driver-specific declarations for use by NICSTAR driver specific utils.
|
||||
*
|
||||
* Author: Rui Prior
|
||||
*
|
||||
* (C) INESC 1998
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_NICSTAR_H
|
||||
#define LINUX_ATM_NICSTAR_H
|
||||
|
||||
/* Note: non-kernel programs including this file must also include
|
||||
* sys/types.h for struct timeval
|
||||
*/
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
#define NS_GETPSTAT _IOWR('a',ATMIOC_SARPRV+1,struct atmif_sioc)
|
||||
/* get pool statistics */
|
||||
#define NS_SETBUFLEV _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
|
||||
/* set buffer level markers */
|
||||
#define NS_ADJBUFLEV _IO('a',ATMIOC_SARPRV+3)
|
||||
/* adjust buffer level */
|
||||
|
||||
typedef struct buf_nr
|
||||
{
|
||||
unsigned min;
|
||||
unsigned init;
|
||||
unsigned max;
|
||||
}buf_nr;
|
||||
|
||||
|
||||
typedef struct pool_levels
|
||||
{
|
||||
int buftype;
|
||||
int count; /* (At least for now) only used in NS_GETPSTAT */
|
||||
buf_nr level;
|
||||
} pool_levels;
|
||||
|
||||
/* type must be one of the following: */
|
||||
#define NS_BUFTYPE_SMALL 1
|
||||
#define NS_BUFTYPE_LARGE 2
|
||||
#define NS_BUFTYPE_HUGE 3
|
||||
#define NS_BUFTYPE_IOVEC 4
|
||||
|
||||
|
||||
#endif /* LINUX_ATM_NICSTAR_H */
|
||||
12
include/linux/atm_suni.h
Normal file
12
include/linux/atm_suni.h
Normal file
@@ -0,0 +1,12 @@
|
||||
/* atm_suni.h - Driver-specific declarations of the SUNI driver (for use by
|
||||
driver-specific utilities) */
|
||||
|
||||
/* Written 1998,2000 by Werner Almesberger, EPFL ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_SUNI_H
|
||||
#define LINUX_ATM_SUNI_H
|
||||
|
||||
/* everything obsoleted */
|
||||
|
||||
#endif
|
||||
75
include/linux/atm_tcp.h
Normal file
75
include/linux/atm_tcp.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* atm_tcp.h - Driver-specific declarations of the ATMTCP driver (for use by
|
||||
driver-specific utilities) */
|
||||
|
||||
/* Written 1997-2000 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_TCP_H
|
||||
#define LINUX_ATM_TCP_H
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/types.h>
|
||||
#endif
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
/*
|
||||
* All values in struct atmtcp_hdr are in network byte order
|
||||
*/
|
||||
|
||||
struct atmtcp_hdr {
|
||||
uint16_t vpi;
|
||||
uint16_t vci;
|
||||
uint32_t length; /* ... of data part */
|
||||
};
|
||||
|
||||
/*
|
||||
* All values in struct atmtcp_command are in host byte order
|
||||
*/
|
||||
|
||||
#define ATMTCP_HDR_MAGIC (~0) /* this length indicates a command */
|
||||
#define ATMTCP_CTRL_OPEN 1 /* request/reply */
|
||||
#define ATMTCP_CTRL_CLOSE 2 /* request/reply */
|
||||
|
||||
struct atmtcp_control {
|
||||
struct atmtcp_hdr hdr; /* must be first */
|
||||
int type; /* message type; both directions */
|
||||
atm_kptr_t vcc; /* both directions */
|
||||
struct sockaddr_atmpvc addr; /* suggested value from kernel */
|
||||
struct atm_qos qos; /* both directions */
|
||||
int result; /* to kernel only */
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
/*
|
||||
* Field usage:
|
||||
* Messge type dir. hdr.v?i type addr qos vcc result
|
||||
* ----------- ---- ------- ---- ---- --- --- ------
|
||||
* OPEN K->D Y Y Y Y Y 0
|
||||
* OPEN D->K - Y Y Y Y Y
|
||||
* CLOSE K->D - - Y - Y 0
|
||||
* CLOSE D->K - - - - Y Y
|
||||
*/
|
||||
|
||||
#define SIOCSIFATMTCP _IO('a',ATMIOC_ITF) /* set ATMTCP mode */
|
||||
#define ATMTCP_CREATE _IO('a',ATMIOC_ITF+14) /* create persistent ATMTCP
|
||||
interface */
|
||||
#define ATMTCP_REMOVE _IO('a',ATMIOC_ITF+15) /* destroy persistent ATMTCP
|
||||
interface */
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
struct atm_tcp_ops {
|
||||
int (*attach)(struct atm_vcc *vcc,int itf);
|
||||
int (*create_persistent)(int itf);
|
||||
int (*remove_persistent)(int itf);
|
||||
struct module *owner;
|
||||
};
|
||||
|
||||
extern struct atm_tcp_ops atm_tcp_ops;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
52
include/linux/atm_zatm.h
Normal file
52
include/linux/atm_zatm.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* atm_zatm.h - Driver-specific declarations of the ZATM driver (for use by
|
||||
driver-specific utilities) */
|
||||
|
||||
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATM_ZATM_H
|
||||
#define LINUX_ATM_ZATM_H
|
||||
|
||||
/*
|
||||
* Note: non-kernel programs including this file must also include
|
||||
* sys/types.h for struct timeval
|
||||
*/
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
#define ZATM_GETPOOL _IOW('a',ATMIOC_SARPRV+1,struct atmif_sioc)
|
||||
/* get pool statistics */
|
||||
#define ZATM_GETPOOLZ _IOW('a',ATMIOC_SARPRV+2,struct atmif_sioc)
|
||||
/* get statistics and zero */
|
||||
#define ZATM_SETPOOL _IOW('a',ATMIOC_SARPRV+3,struct atmif_sioc)
|
||||
/* set pool parameters */
|
||||
|
||||
struct zatm_pool_info {
|
||||
int ref_count; /* free buffer pool usage counters */
|
||||
int low_water,high_water; /* refill parameters */
|
||||
int rqa_count,rqu_count; /* queue condition counters */
|
||||
int offset,next_off; /* alignment optimizations: offset */
|
||||
int next_cnt,next_thres; /* repetition counter and threshold */
|
||||
};
|
||||
|
||||
struct zatm_pool_req {
|
||||
int pool_num; /* pool number */
|
||||
struct zatm_pool_info info; /* actual information */
|
||||
};
|
||||
|
||||
struct zatm_t_hist {
|
||||
struct timeval real; /* real (wall-clock) time */
|
||||
struct timeval expected; /* expected real time */
|
||||
};
|
||||
|
||||
|
||||
#define ZATM_OAM_POOL 0 /* free buffer pool for OAM cells */
|
||||
#define ZATM_AAL0_POOL 1 /* free buffer pool for AAL0 cells */
|
||||
#define ZATM_AAL5_POOL_BASE 2 /* first AAL5 free buffer pool */
|
||||
#define ZATM_LAST_POOL ZATM_AAL5_POOL_BASE+10 /* max. 64 kB */
|
||||
|
||||
#define ZATM_TIMER_HISTORY_SIZE 16 /* number of timer adjustments to
|
||||
record; must be 2^n */
|
||||
|
||||
#endif
|
||||
29
include/linux/atmapi.h
Normal file
29
include/linux/atmapi.h
Normal file
@@ -0,0 +1,29 @@
|
||||
/* atmapi.h - ATM API user space/kernel compatibility */
|
||||
|
||||
/* Written 1999,2000 by Werner Almesberger, EPFL ICA */
|
||||
|
||||
|
||||
#ifndef _LINUX_ATMAPI_H
|
||||
#define _LINUX_ATMAPI_H
|
||||
|
||||
#if defined(__sparc__) || defined(__ia64__)
|
||||
/* such alignment is not required on 32 bit sparcs, but we can't
|
||||
figure that we are on a sparc64 while compiling user-space programs. */
|
||||
#define __ATM_API_ALIGN __attribute__((aligned(8)))
|
||||
#else
|
||||
#define __ATM_API_ALIGN
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Opaque type for kernel pointers. Note that _ is never accessed. We need
|
||||
* the struct in order hide the array, so that we can make simple assignments
|
||||
* instead of being forced to use memcpy. It also improves error reporting for
|
||||
* code that still assumes that we're passing unsigned longs.
|
||||
*
|
||||
* Convention: NULL pointers are passed as a field of all zeroes.
|
||||
*/
|
||||
|
||||
typedef struct { unsigned char _[8]; } __ATM_API_ALIGN atm_kptr_t;
|
||||
|
||||
#endif
|
||||
41
include/linux/atmarp.h
Normal file
41
include/linux/atmarp.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* atmarp.h - ATM ARP protocol and kernel-demon interface definitions */
|
||||
|
||||
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef _LINUX_ATMARP_H
|
||||
#define _LINUX_ATMARP_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
#define ATMARP_RETRY_DELAY 30 /* request next resolution or forget
|
||||
NAK after 30 sec - should go into
|
||||
atmclip.h */
|
||||
#define ATMARP_MAX_UNRES_PACKETS 5 /* queue that many packets while
|
||||
waiting for the resolver */
|
||||
|
||||
|
||||
#define ATMARPD_CTRL _IO('a',ATMIOC_CLIP+1) /* become atmarpd ctrl sock */
|
||||
#define ATMARP_MKIP _IO('a',ATMIOC_CLIP+2) /* attach socket to IP */
|
||||
#define ATMARP_SETENTRY _IO('a',ATMIOC_CLIP+3) /* fill or hide ARP entry */
|
||||
#define ATMARP_ENCAP _IO('a',ATMIOC_CLIP+5) /* change encapsulation */
|
||||
|
||||
|
||||
enum atmarp_ctrl_type {
|
||||
act_invalid, /* catch uninitialized structures */
|
||||
act_need, /* need address resolution */
|
||||
act_up, /* interface is coming up */
|
||||
act_down, /* interface is going down */
|
||||
act_change /* interface configuration has changed */
|
||||
};
|
||||
|
||||
struct atmarp_ctrl {
|
||||
enum atmarp_ctrl_type type; /* message type */
|
||||
int itf_num;/* interface number (if present) */
|
||||
__be32 ip; /* IP address (act_need only) */
|
||||
};
|
||||
|
||||
#endif
|
||||
101
include/linux/atmbr2684.h
Normal file
101
include/linux/atmbr2684.h
Normal file
@@ -0,0 +1,101 @@
|
||||
#ifndef _LINUX_ATMBR2684_H
|
||||
#define _LINUX_ATMBR2684_H
|
||||
|
||||
#include <linux/atm.h>
|
||||
#include <linux/if.h> /* For IFNAMSIZ */
|
||||
|
||||
/*
|
||||
* Type of media we're bridging (ethernet, token ring, etc) Currently only
|
||||
* ethernet is supported
|
||||
*/
|
||||
#define BR2684_MEDIA_ETHERNET (0) /* 802.3 */
|
||||
#define BR2684_MEDIA_802_4 (1) /* 802.4 */
|
||||
#define BR2684_MEDIA_TR (2) /* 802.5 - token ring */
|
||||
#define BR2684_MEDIA_FDDI (3)
|
||||
#define BR2684_MEDIA_802_6 (4) /* 802.6 */
|
||||
|
||||
/*
|
||||
* Is there FCS inbound on this VC? This currently isn't supported.
|
||||
*/
|
||||
#define BR2684_FCSIN_NO (0)
|
||||
#define BR2684_FCSIN_IGNORE (1)
|
||||
#define BR2684_FCSIN_VERIFY (2)
|
||||
|
||||
/*
|
||||
* Is there FCS outbound on this VC? This currently isn't supported.
|
||||
*/
|
||||
#define BR2684_FCSOUT_NO (0)
|
||||
#define BR2684_FCSOUT_SENDZERO (1)
|
||||
#define BR2684_FCSOUT_GENERATE (2)
|
||||
|
||||
/*
|
||||
* Does this VC include LLC encapsulation?
|
||||
*/
|
||||
#define BR2684_ENCAPS_VC (0) /* VC-mux */
|
||||
#define BR2684_ENCAPS_LLC (1)
|
||||
#define BR2684_ENCAPS_AUTODETECT (2) /* Unsuported */
|
||||
|
||||
/*
|
||||
* This is for the ATM_NEWBACKENDIF call - these are like socket families:
|
||||
* the first element of the structure is the backend number and the rest
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_newif_br2684 {
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
int media; /* BR2684_MEDIA_* */
|
||||
char ifname[IFNAMSIZ];
|
||||
int mtu;
|
||||
};
|
||||
|
||||
/*
|
||||
* This structure is used to specify a br2684 interface - either by a
|
||||
* positive integer (returned by ATM_NEWBACKENDIF) or the interfaces name
|
||||
*/
|
||||
#define BR2684_FIND_BYNOTHING (0)
|
||||
#define BR2684_FIND_BYNUM (1)
|
||||
#define BR2684_FIND_BYIFNAME (2)
|
||||
struct br2684_if_spec {
|
||||
int method; /* BR2684_FIND_* */
|
||||
union {
|
||||
char ifname[IFNAMSIZ];
|
||||
int devnum;
|
||||
} spec;
|
||||
};
|
||||
|
||||
/*
|
||||
* This is for the ATM_SETBACKEND call - these are like socket families:
|
||||
* the first element of the structure is the backend number and the rest
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_backend_br2684 {
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_BR2684 */
|
||||
struct br2684_if_spec ifspec;
|
||||
int fcs_in; /* BR2684_FCSIN_* */
|
||||
int fcs_out; /* BR2684_FCSOUT_* */
|
||||
int fcs_auto; /* 1: fcs_{in,out} disabled if no FCS rx'ed */
|
||||
int encaps; /* BR2684_ENCAPS_* */
|
||||
int has_vpiid; /* 1: use vpn_id - Unsupported */
|
||||
__u8 vpn_id[7];
|
||||
int send_padding; /* unsupported */
|
||||
int min_size; /* we will pad smaller packets than this */
|
||||
};
|
||||
|
||||
/*
|
||||
* The BR2684_SETFILT ioctl is an experimental mechanism for folks
|
||||
* terminating a large number of IP-only vcc's. When netfilter allows
|
||||
* efficient per-if in/out filters, this support will be removed
|
||||
*/
|
||||
struct br2684_filter {
|
||||
__be32 prefix; /* network byte order */
|
||||
__be32 netmask; /* 0 = disable filter */
|
||||
};
|
||||
|
||||
struct br2684_filter_set {
|
||||
struct br2684_if_spec ifspec;
|
||||
struct br2684_filter filter;
|
||||
};
|
||||
|
||||
#define BR2684_SETFILT _IOW( 'a', ATMIOC_BACKEND + 0, \
|
||||
struct br2684_filter_set)
|
||||
|
||||
#endif /* _LINUX_ATMBR2684_H */
|
||||
21
include/linux/atmclip.h
Normal file
21
include/linux/atmclip.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* atmclip.h - Classical IP over ATM */
|
||||
|
||||
/* Written 1995-1998 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATMCLIP_H
|
||||
#define LINUX_ATMCLIP_H
|
||||
|
||||
#include <linux/sockios.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
#define RFC1483LLC_LEN 8 /* LLC+OUI+PID = 8 */
|
||||
#define RFC1626_MTU 9180 /* RFC1626 default MTU */
|
||||
|
||||
#define CLIP_DEFAULT_IDLETIMER 1200 /* 20 minutes, see RFC1755 */
|
||||
#define CLIP_CHECK_INTERVAL 10 /* check every ten seconds */
|
||||
|
||||
#define SIOCMKCLIP _IO('a',ATMIOC_CLIP) /* create IP interface */
|
||||
|
||||
#endif
|
||||
500
include/linux/atmdev.h
Normal file
500
include/linux/atmdev.h
Normal file
@@ -0,0 +1,500 @@
|
||||
/* atmdev.h - ATM device driver declarations and various related items */
|
||||
|
||||
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef LINUX_ATMDEV_H
|
||||
#define LINUX_ATMDEV_H
|
||||
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atm.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
#define ESI_LEN 6
|
||||
|
||||
#define ATM_OC3_PCR (155520000/270*260/8/53)
|
||||
/* OC3 link rate: 155520000 bps
|
||||
SONET overhead: /270*260 (9 section, 1 path)
|
||||
bits per cell: /8/53
|
||||
max cell rate: 353207.547 cells/sec */
|
||||
#define ATM_25_PCR ((25600000/8-8000)/54)
|
||||
/* 25 Mbps ATM cell rate (59111) */
|
||||
#define ATM_OC12_PCR (622080000/1080*1040/8/53)
|
||||
/* OC12 link rate: 622080000 bps
|
||||
SONET overhead: /1080*1040
|
||||
bits per cell: /8/53
|
||||
max cell rate: 1412830.188 cells/sec */
|
||||
#define ATM_DS3_PCR (8000*12)
|
||||
/* DS3: 12 cells in a 125 usec time slot */
|
||||
|
||||
|
||||
#define __AAL_STAT_ITEMS \
|
||||
__HANDLE_ITEM(tx); /* TX okay */ \
|
||||
__HANDLE_ITEM(tx_err); /* TX errors */ \
|
||||
__HANDLE_ITEM(rx); /* RX okay */ \
|
||||
__HANDLE_ITEM(rx_err); /* RX errors */ \
|
||||
__HANDLE_ITEM(rx_drop); /* RX out of memory */
|
||||
|
||||
struct atm_aal_stats {
|
||||
#define __HANDLE_ITEM(i) int i
|
||||
__AAL_STAT_ITEMS
|
||||
#undef __HANDLE_ITEM
|
||||
};
|
||||
|
||||
|
||||
struct atm_dev_stats {
|
||||
struct atm_aal_stats aal0;
|
||||
struct atm_aal_stats aal34;
|
||||
struct atm_aal_stats aal5;
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
|
||||
#define ATM_GETLINKRATE _IOW('a',ATMIOC_ITF+1,struct atmif_sioc)
|
||||
/* get link rate */
|
||||
#define ATM_GETNAMES _IOW('a',ATMIOC_ITF+3,struct atm_iobuf)
|
||||
/* get interface names (numbers) */
|
||||
#define ATM_GETTYPE _IOW('a',ATMIOC_ITF+4,struct atmif_sioc)
|
||||
/* get interface type name */
|
||||
#define ATM_GETESI _IOW('a',ATMIOC_ITF+5,struct atmif_sioc)
|
||||
/* get interface ESI */
|
||||
#define ATM_GETADDR _IOW('a',ATMIOC_ITF+6,struct atmif_sioc)
|
||||
/* get itf's local ATM addr. list */
|
||||
#define ATM_RSTADDR _IOW('a',ATMIOC_ITF+7,struct atmif_sioc)
|
||||
/* reset itf's ATM address list */
|
||||
#define ATM_ADDADDR _IOW('a',ATMIOC_ITF+8,struct atmif_sioc)
|
||||
/* add a local ATM address */
|
||||
#define ATM_DELADDR _IOW('a',ATMIOC_ITF+9,struct atmif_sioc)
|
||||
/* remove a local ATM address */
|
||||
#define ATM_GETCIRANGE _IOW('a',ATMIOC_ITF+10,struct atmif_sioc)
|
||||
/* get connection identifier range */
|
||||
#define ATM_SETCIRANGE _IOW('a',ATMIOC_ITF+11,struct atmif_sioc)
|
||||
/* set connection identifier range */
|
||||
#define ATM_SETESI _IOW('a',ATMIOC_ITF+12,struct atmif_sioc)
|
||||
/* set interface ESI */
|
||||
#define ATM_SETESIF _IOW('a',ATMIOC_ITF+13,struct atmif_sioc)
|
||||
/* force interface ESI */
|
||||
#define ATM_ADDLECSADDR _IOW('a', ATMIOC_ITF+14, struct atmif_sioc)
|
||||
/* register a LECS address */
|
||||
#define ATM_DELLECSADDR _IOW('a', ATMIOC_ITF+15, struct atmif_sioc)
|
||||
/* unregister a LECS address */
|
||||
#define ATM_GETLECSADDR _IOW('a', ATMIOC_ITF+16, struct atmif_sioc)
|
||||
/* retrieve LECS address(es) */
|
||||
|
||||
#define ATM_GETSTAT _IOW('a',ATMIOC_SARCOM+0,struct atmif_sioc)
|
||||
/* get AAL layer statistics */
|
||||
#define ATM_GETSTATZ _IOW('a',ATMIOC_SARCOM+1,struct atmif_sioc)
|
||||
/* get AAL layer statistics and zero */
|
||||
#define ATM_GETLOOP _IOW('a',ATMIOC_SARCOM+2,struct atmif_sioc)
|
||||
/* get loopback mode */
|
||||
#define ATM_SETLOOP _IOW('a',ATMIOC_SARCOM+3,struct atmif_sioc)
|
||||
/* set loopback mode */
|
||||
#define ATM_QUERYLOOP _IOW('a',ATMIOC_SARCOM+4,struct atmif_sioc)
|
||||
/* query supported loopback modes */
|
||||
#define ATM_SETSC _IOW('a',ATMIOC_SPECIAL+1,int)
|
||||
/* enable or disable single-copy */
|
||||
#define ATM_SETBACKEND _IOW('a',ATMIOC_SPECIAL+2,atm_backend_t)
|
||||
/* set backend handler */
|
||||
#define ATM_NEWBACKENDIF _IOW('a',ATMIOC_SPECIAL+3,atm_backend_t)
|
||||
/* use backend to make new if */
|
||||
#define ATM_ADDPARTY _IOW('a', ATMIOC_SPECIAL+4,struct atm_iobuf)
|
||||
/* add party to p2mp call */
|
||||
#define ATM_DROPPARTY _IOW('a', ATMIOC_SPECIAL+5,int)
|
||||
/* drop party from p2mp call */
|
||||
|
||||
/*
|
||||
* These are backend handkers that can be set via the ATM_SETBACKEND call
|
||||
* above. In the future we may support dynamic loading of these - for now,
|
||||
* they're just being used to share the ATMIOC_BACKEND ioctls
|
||||
*/
|
||||
#define ATM_BACKEND_RAW 0
|
||||
#define ATM_BACKEND_PPP 1 /* PPPoATM - RFC2364 */
|
||||
#define ATM_BACKEND_BR2684 2 /* Bridged RFC1483/2684 */
|
||||
|
||||
/* for ATM_GETTYPE */
|
||||
#define ATM_ITFTYP_LEN 8 /* maximum length of interface type name */
|
||||
|
||||
/*
|
||||
* Loopback modes for ATM_{PHY,SAR}_{GET,SET}LOOP
|
||||
*/
|
||||
|
||||
/* Point of loopback CPU-->SAR-->PHY-->line--> ... */
|
||||
#define __ATM_LM_NONE 0 /* no loop back ^ ^ ^ ^ */
|
||||
#define __ATM_LM_AAL 1 /* loop back PDUs --' | | | */
|
||||
#define __ATM_LM_ATM 2 /* loop back ATM cells ---' | | */
|
||||
/* RESERVED 4 loop back on PHY side ---' */
|
||||
#define __ATM_LM_PHY 8 /* loop back bits (digital) ----' | */
|
||||
#define __ATM_LM_ANALOG 16 /* loop back the analog signal --------' */
|
||||
|
||||
/* Direction of loopback */
|
||||
#define __ATM_LM_MKLOC(n) ((n)) /* Local (i.e. loop TX to RX) */
|
||||
#define __ATM_LM_MKRMT(n) ((n) << 8) /* Remote (i.e. loop RX to TX) */
|
||||
|
||||
#define __ATM_LM_XTLOC(n) ((n) & 0xff)
|
||||
#define __ATM_LM_XTRMT(n) (((n) >> 8) & 0xff)
|
||||
|
||||
#define ATM_LM_NONE 0 /* no loopback */
|
||||
|
||||
#define ATM_LM_LOC_AAL __ATM_LM_MKLOC(__ATM_LM_AAL)
|
||||
#define ATM_LM_LOC_ATM __ATM_LM_MKLOC(__ATM_LM_ATM)
|
||||
#define ATM_LM_LOC_PHY __ATM_LM_MKLOC(__ATM_LM_PHY)
|
||||
#define ATM_LM_LOC_ANALOG __ATM_LM_MKLOC(__ATM_LM_ANALOG)
|
||||
|
||||
#define ATM_LM_RMT_AAL __ATM_LM_MKRMT(__ATM_LM_AAL)
|
||||
#define ATM_LM_RMT_ATM __ATM_LM_MKRMT(__ATM_LM_ATM)
|
||||
#define ATM_LM_RMT_PHY __ATM_LM_MKRMT(__ATM_LM_PHY)
|
||||
#define ATM_LM_RMT_ANALOG __ATM_LM_MKRMT(__ATM_LM_ANALOG)
|
||||
|
||||
/*
|
||||
* Note: ATM_LM_LOC_* and ATM_LM_RMT_* can be combined, provided that
|
||||
* __ATM_LM_XTLOC(x) <= __ATM_LM_XTRMT(x)
|
||||
*/
|
||||
|
||||
|
||||
struct atm_iobuf {
|
||||
int length;
|
||||
void __user *buffer;
|
||||
};
|
||||
|
||||
/* for ATM_GETCIRANGE / ATM_SETCIRANGE */
|
||||
|
||||
#define ATM_CI_MAX -1 /* use maximum range of VPI/VCI */
|
||||
|
||||
struct atm_cirange {
|
||||
signed char vpi_bits; /* 1..8, ATM_CI_MAX (-1) for maximum */
|
||||
signed char vci_bits; /* 1..16, ATM_CI_MAX (-1) for maximum */
|
||||
};
|
||||
|
||||
/* for ATM_SETSC; actually taken from the ATM_VF number space */
|
||||
|
||||
#define ATM_SC_RX 1024 /* enable RX single-copy */
|
||||
#define ATM_SC_TX 2048 /* enable TX single-copy */
|
||||
|
||||
#define ATM_BACKLOG_DEFAULT 32 /* if we get more, we're likely to time out
|
||||
anyway */
|
||||
|
||||
/* MF: change_qos (Modify) flags */
|
||||
|
||||
#define ATM_MF_IMMED 1 /* Block until change is effective */
|
||||
#define ATM_MF_INC_RSV 2 /* Change reservation on increase */
|
||||
#define ATM_MF_INC_SHP 4 /* Change shaping on increase */
|
||||
#define ATM_MF_DEC_RSV 8 /* Change reservation on decrease */
|
||||
#define ATM_MF_DEC_SHP 16 /* Change shaping on decrease */
|
||||
#define ATM_MF_BWD 32 /* Set the backward direction parameters */
|
||||
|
||||
#define ATM_MF_SET (ATM_MF_INC_RSV | ATM_MF_INC_SHP | ATM_MF_DEC_RSV | \
|
||||
ATM_MF_DEC_SHP | ATM_MF_BWD)
|
||||
|
||||
/*
|
||||
* ATM_VS_* are used to express VC state in a human-friendly way.
|
||||
*/
|
||||
|
||||
#define ATM_VS_IDLE 0 /* VC is not used */
|
||||
#define ATM_VS_CONNECTED 1 /* VC is connected */
|
||||
#define ATM_VS_CLOSING 2 /* VC is closing */
|
||||
#define ATM_VS_LISTEN 3 /* VC is listening for incoming setups */
|
||||
#define ATM_VS_INUSE 4 /* VC is in use (registered with atmsigd) */
|
||||
#define ATM_VS_BOUND 5 /* VC is bound */
|
||||
|
||||
#define ATM_VS2TXT_MAP \
|
||||
"IDLE", "CONNECTED", "CLOSING", "LISTEN", "INUSE", "BOUND"
|
||||
|
||||
#define ATM_VF2TXT_MAP \
|
||||
"ADDR", "READY", "PARTIAL", "REGIS", \
|
||||
"RELEASED", "HASQOS", "LISTEN", "META", \
|
||||
"256", "512", "1024", "2048", \
|
||||
"SESSION", "HASSAP", "BOUND", "CLOSE"
|
||||
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/wait.h> /* wait_queue_head_t */
|
||||
#include <linux/time.h> /* struct timeval */
|
||||
#include <linux/net.h>
|
||||
#include <linux/skbuff.h> /* struct sk_buff */
|
||||
#include <linux/uio.h>
|
||||
#include <net/sock.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
#include <linux/proc_fs.h>
|
||||
|
||||
extern struct proc_dir_entry *atm_proc_root;
|
||||
#endif
|
||||
|
||||
|
||||
struct k_atm_aal_stats {
|
||||
#define __HANDLE_ITEM(i) atomic_t i
|
||||
__AAL_STAT_ITEMS
|
||||
#undef __HANDLE_ITEM
|
||||
};
|
||||
|
||||
|
||||
struct k_atm_dev_stats {
|
||||
struct k_atm_aal_stats aal0;
|
||||
struct k_atm_aal_stats aal34;
|
||||
struct k_atm_aal_stats aal5;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
ATM_VF_ADDR, /* Address is in use. Set by anybody, cleared
|
||||
by device driver. */
|
||||
ATM_VF_READY, /* VC is ready to transfer data. Set by device
|
||||
driver, cleared by anybody. */
|
||||
ATM_VF_PARTIAL, /* resources are bound to PVC (partial PVC
|
||||
setup), controlled by socket layer */
|
||||
ATM_VF_REGIS, /* registered with demon, controlled by SVC
|
||||
socket layer */
|
||||
ATM_VF_BOUND, /* local SAP is set, controlled by SVC socket
|
||||
layer */
|
||||
ATM_VF_RELEASED, /* demon has indicated/requested release,
|
||||
controlled by SVC socket layer */
|
||||
ATM_VF_HASQOS, /* QOS parameters have been set */
|
||||
ATM_VF_LISTEN, /* socket is used for listening */
|
||||
ATM_VF_META, /* SVC socket isn't used for normal data
|
||||
traffic and doesn't depend on signaling
|
||||
to be available */
|
||||
ATM_VF_SESSION, /* VCC is p2mp session control descriptor */
|
||||
ATM_VF_HASSAP, /* SAP has been set */
|
||||
ATM_VF_CLOSE, /* asynchronous close - treat like VF_RELEASED*/
|
||||
ATM_VF_WAITING, /* waiting for reply from sigd */
|
||||
ATM_VF_IS_CLIP, /* in use by CLIP protocol */
|
||||
};
|
||||
|
||||
|
||||
#define ATM_VF2VS(flags) \
|
||||
(test_bit(ATM_VF_READY,&(flags)) ? ATM_VS_CONNECTED : \
|
||||
test_bit(ATM_VF_RELEASED,&(flags)) ? ATM_VS_CLOSING : \
|
||||
test_bit(ATM_VF_LISTEN,&(flags)) ? ATM_VS_LISTEN : \
|
||||
test_bit(ATM_VF_REGIS,&(flags)) ? ATM_VS_INUSE : \
|
||||
test_bit(ATM_VF_BOUND,&(flags)) ? ATM_VS_BOUND : ATM_VS_IDLE)
|
||||
|
||||
|
||||
enum {
|
||||
ATM_DF_REMOVED, /* device was removed from atm_devs list */
|
||||
};
|
||||
|
||||
|
||||
#define ATM_PHY_SIG_LOST 0 /* no carrier/light */
|
||||
#define ATM_PHY_SIG_UNKNOWN 1 /* carrier/light status is unknown */
|
||||
#define ATM_PHY_SIG_FOUND 2 /* carrier/light okay */
|
||||
|
||||
#define ATM_ATMOPT_CLP 1 /* set CLP bit */
|
||||
|
||||
struct atm_vcc {
|
||||
/* struct sock has to be the first member of atm_vcc */
|
||||
struct sock sk;
|
||||
unsigned long flags; /* VCC flags (ATM_VF_*) */
|
||||
short vpi; /* VPI and VCI (types must be equal */
|
||||
/* with sockaddr) */
|
||||
int vci;
|
||||
unsigned long aal_options; /* AAL layer options */
|
||||
unsigned long atm_options; /* ATM layer options */
|
||||
struct atm_dev *dev; /* device back pointer */
|
||||
struct atm_qos qos; /* QOS */
|
||||
struct atm_sap sap; /* SAP */
|
||||
void (*push)(struct atm_vcc *vcc,struct sk_buff *skb);
|
||||
void (*pop)(struct atm_vcc *vcc,struct sk_buff *skb); /* optional */
|
||||
int (*push_oam)(struct atm_vcc *vcc,void *cell);
|
||||
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
|
||||
void *dev_data; /* per-device data */
|
||||
void *proto_data; /* per-protocol data */
|
||||
struct k_atm_aal_stats *stats; /* pointer to AAL stats group */
|
||||
/* SVC part --- may move later ------------------------------------- */
|
||||
short itf; /* interface number */
|
||||
struct sockaddr_atmsvc local;
|
||||
struct sockaddr_atmsvc remote;
|
||||
/* Multipoint part ------------------------------------------------- */
|
||||
struct atm_vcc *session; /* session VCC descriptor */
|
||||
/* Other stuff ----------------------------------------------------- */
|
||||
void *user_back; /* user backlink - not touched by */
|
||||
/* native ATM stack. Currently used */
|
||||
/* by CLIP and sch_atm. */
|
||||
};
|
||||
|
||||
static inline struct atm_vcc *atm_sk(struct sock *sk)
|
||||
{
|
||||
return (struct atm_vcc *)sk;
|
||||
}
|
||||
|
||||
static inline struct atm_vcc *ATM_SD(struct socket *sock)
|
||||
{
|
||||
return atm_sk(sock->sk);
|
||||
}
|
||||
|
||||
static inline struct sock *sk_atm(struct atm_vcc *vcc)
|
||||
{
|
||||
return (struct sock *)vcc;
|
||||
}
|
||||
|
||||
struct atm_dev_addr {
|
||||
struct sockaddr_atmsvc addr; /* ATM address */
|
||||
struct list_head entry; /* next address */
|
||||
};
|
||||
|
||||
enum atm_addr_type_t { ATM_ADDR_LOCAL, ATM_ADDR_LECS };
|
||||
|
||||
struct atm_dev {
|
||||
const struct atmdev_ops *ops; /* device operations; NULL if unused */
|
||||
const struct atmphy_ops *phy; /* PHY operations, may be undefined */
|
||||
/* (NULL) */
|
||||
const char *type; /* device type name */
|
||||
int number; /* device index */
|
||||
void *dev_data; /* per-device data */
|
||||
void *phy_data; /* private PHY date */
|
||||
unsigned long flags; /* device flags (ATM_DF_*) */
|
||||
struct list_head local; /* local ATM addresses */
|
||||
struct list_head lecs; /* LECS ATM addresses learned via ILMI */
|
||||
unsigned char esi[ESI_LEN]; /* ESI ("MAC" addr) */
|
||||
struct atm_cirange ci_range; /* VPI/VCI range */
|
||||
struct k_atm_dev_stats stats; /* statistics */
|
||||
char signal; /* signal status (ATM_PHY_SIG_*) */
|
||||
int link_rate; /* link rate (default: OC3) */
|
||||
atomic_t refcnt; /* reference count */
|
||||
spinlock_t lock; /* protect internal members */
|
||||
#ifdef CONFIG_PROC_FS
|
||||
struct proc_dir_entry *proc_entry; /* proc entry */
|
||||
char *proc_name; /* proc entry name */
|
||||
#endif
|
||||
struct class_device class_dev; /* sysfs class device */
|
||||
struct list_head dev_list; /* linkage */
|
||||
};
|
||||
|
||||
|
||||
/* OF: send_Oam Flags */
|
||||
|
||||
#define ATM_OF_IMMED 1 /* Attempt immediate delivery */
|
||||
#define ATM_OF_INRATE 2 /* Attempt in-rate delivery */
|
||||
|
||||
|
||||
/*
|
||||
* ioctl, getsockopt, and setsockopt are optional and can be set to NULL.
|
||||
*/
|
||||
|
||||
struct atmdev_ops { /* only send is required */
|
||||
void (*dev_close)(struct atm_dev *dev);
|
||||
int (*open)(struct atm_vcc *vcc);
|
||||
void (*close)(struct atm_vcc *vcc);
|
||||
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
|
||||
int (*getsockopt)(struct atm_vcc *vcc,int level,int optname,
|
||||
void __user *optval,int optlen);
|
||||
int (*setsockopt)(struct atm_vcc *vcc,int level,int optname,
|
||||
void __user *optval,int optlen);
|
||||
int (*send)(struct atm_vcc *vcc,struct sk_buff *skb);
|
||||
int (*send_oam)(struct atm_vcc *vcc,void *cell,int flags);
|
||||
void (*phy_put)(struct atm_dev *dev,unsigned char value,
|
||||
unsigned long addr);
|
||||
unsigned char (*phy_get)(struct atm_dev *dev,unsigned long addr);
|
||||
int (*change_qos)(struct atm_vcc *vcc,struct atm_qos *qos,int flags);
|
||||
int (*proc_read)(struct atm_dev *dev,loff_t *pos,char *page);
|
||||
struct module *owner;
|
||||
};
|
||||
|
||||
struct atmphy_ops {
|
||||
int (*start)(struct atm_dev *dev);
|
||||
int (*ioctl)(struct atm_dev *dev,unsigned int cmd,void __user *arg);
|
||||
void (*interrupt)(struct atm_dev *dev);
|
||||
int (*stop)(struct atm_dev *dev);
|
||||
};
|
||||
|
||||
struct atm_skb_data {
|
||||
struct atm_vcc *vcc; /* ATM VCC */
|
||||
unsigned long atm_options; /* ATM layer options */
|
||||
};
|
||||
|
||||
#define VCC_HTABLE_SIZE 32
|
||||
|
||||
extern struct hlist_head vcc_hash[VCC_HTABLE_SIZE];
|
||||
extern rwlock_t vcc_sklist_lock;
|
||||
|
||||
#define ATM_SKB(skb) (((struct atm_skb_data *) (skb)->cb))
|
||||
|
||||
struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
|
||||
int number,unsigned long *flags); /* number == -1: pick first available */
|
||||
struct atm_dev *atm_dev_lookup(int number);
|
||||
void atm_dev_deregister(struct atm_dev *dev);
|
||||
void vcc_insert_socket(struct sock *sk);
|
||||
|
||||
|
||||
/*
|
||||
* This is approximately the algorithm used by alloc_skb.
|
||||
*
|
||||
*/
|
||||
|
||||
static inline int atm_guess_pdu2truesize(int size)
|
||||
{
|
||||
return (SKB_DATA_ALIGN(size) + sizeof(struct skb_shared_info));
|
||||
}
|
||||
|
||||
|
||||
static inline void atm_force_charge(struct atm_vcc *vcc,int truesize)
|
||||
{
|
||||
atomic_add(truesize, &sk_atm(vcc)->sk_rmem_alloc);
|
||||
}
|
||||
|
||||
|
||||
static inline void atm_return(struct atm_vcc *vcc,int truesize)
|
||||
{
|
||||
atomic_sub(truesize, &sk_atm(vcc)->sk_rmem_alloc);
|
||||
}
|
||||
|
||||
|
||||
static inline int atm_may_send(struct atm_vcc *vcc,unsigned int size)
|
||||
{
|
||||
return (size + atomic_read(&sk_atm(vcc)->sk_wmem_alloc)) <
|
||||
sk_atm(vcc)->sk_sndbuf;
|
||||
}
|
||||
|
||||
|
||||
static inline void atm_dev_hold(struct atm_dev *dev)
|
||||
{
|
||||
atomic_inc(&dev->refcnt);
|
||||
}
|
||||
|
||||
|
||||
static inline void atm_dev_put(struct atm_dev *dev)
|
||||
{
|
||||
if (atomic_dec_and_test(&dev->refcnt)) {
|
||||
BUG_ON(!test_bit(ATM_DF_REMOVED, &dev->flags));
|
||||
if (dev->ops->dev_close)
|
||||
dev->ops->dev_close(dev);
|
||||
class_device_put(&dev->class_dev);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int atm_charge(struct atm_vcc *vcc,int truesize);
|
||||
struct sk_buff *atm_alloc_charge(struct atm_vcc *vcc,int pdu_size,
|
||||
gfp_t gfp_flags);
|
||||
int atm_pcr_goal(const struct atm_trafprm *tp);
|
||||
|
||||
void vcc_release_async(struct atm_vcc *vcc, int reply);
|
||||
|
||||
struct atm_ioctl {
|
||||
struct module *owner;
|
||||
/* A module reference is kept if appropriate over this call.
|
||||
* Return -ENOIOCTLCMD if you don't handle it. */
|
||||
int (*ioctl)(struct socket *, unsigned int cmd, unsigned long arg);
|
||||
struct list_head list;
|
||||
};
|
||||
|
||||
/**
|
||||
* register_atm_ioctl - register handler for ioctl operations
|
||||
*
|
||||
* Special (non-device) handlers of ioctl's should
|
||||
* register here. If you're a normal device, you should
|
||||
* set .ioctl in your atmdev_ops instead.
|
||||
*/
|
||||
void register_atm_ioctl(struct atm_ioctl *);
|
||||
|
||||
/**
|
||||
* deregister_atm_ioctl - remove the ioctl handler
|
||||
*/
|
||||
void deregister_atm_ioctl(struct atm_ioctl *);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif
|
||||
36
include/linux/atmel_pdc.h
Normal file
36
include/linux/atmel_pdc.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* include/linux/atmel_pdc.h
|
||||
*
|
||||
* Copyright (C) 2005 Ivan Kokshaysky
|
||||
* Copyright (C) SAN People
|
||||
*
|
||||
* Peripheral Data Controller (PDC) registers.
|
||||
* Based on AT91RM9200 datasheet revision E.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef ATMEL_PDC_H
|
||||
#define ATMEL_PDC_H
|
||||
|
||||
#define ATMEL_PDC_RPR 0x100 /* Receive Pointer Register */
|
||||
#define ATMEL_PDC_RCR 0x104 /* Receive Counter Register */
|
||||
#define ATMEL_PDC_TPR 0x108 /* Transmit Pointer Register */
|
||||
#define ATMEL_PDC_TCR 0x10c /* Transmit Counter Register */
|
||||
#define ATMEL_PDC_RNPR 0x110 /* Receive Next Pointer Register */
|
||||
#define ATMEL_PDC_RNCR 0x114 /* Receive Next Counter Register */
|
||||
#define ATMEL_PDC_TNPR 0x118 /* Transmit Next Pointer Register */
|
||||
#define ATMEL_PDC_TNCR 0x11c /* Transmit Next Counter Register */
|
||||
|
||||
#define ATMEL_PDC_PTCR 0x120 /* Transfer Control Register */
|
||||
#define ATMEL_PDC_RXTEN (1 << 0) /* Receiver Transfer Enable */
|
||||
#define ATMEL_PDC_RXTDIS (1 << 1) /* Receiver Transfer Disable */
|
||||
#define ATMEL_PDC_TXTEN (1 << 8) /* Transmitter Transfer Enable */
|
||||
#define ATMEL_PDC_TXTDIS (1 << 9) /* Transmitter Transfer Disable */
|
||||
|
||||
#define ATMEL_PDC_PTSR 0x124 /* Transfer Status Register */
|
||||
|
||||
#endif
|
||||
41
include/linux/atmioc.h
Normal file
41
include/linux/atmioc.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/* atmioc.h - ranges for ATM-related ioctl numbers */
|
||||
|
||||
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
/*
|
||||
* See http://icawww1.epfl.ch/linux-atm/magic.html for the complete list of
|
||||
* "magic" ioctl numbers.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _LINUX_ATMIOC_H
|
||||
#define _LINUX_ATMIOC_H
|
||||
|
||||
#include <asm/ioctl.h>
|
||||
/* everybody including atmioc.h will also need _IO{,R,W,WR} */
|
||||
|
||||
#define ATMIOC_PHYCOM 0x00 /* PHY device common ioctls, globally unique */
|
||||
#define ATMIOC_PHYCOM_END 0x0f
|
||||
#define ATMIOC_PHYTYP 0x10 /* PHY dev type ioctls, unique per PHY type */
|
||||
#define ATMIOC_PHYTYP_END 0x2f
|
||||
#define ATMIOC_PHYPRV 0x30 /* PHY dev private ioctls, unique per driver */
|
||||
#define ATMIOC_PHYPRV_END 0x4f
|
||||
#define ATMIOC_SARCOM 0x50 /* SAR device common ioctls, globally unique */
|
||||
#define ATMIOC_SARCOM_END 0x50
|
||||
#define ATMIOC_SARPRV 0x60 /* SAR dev private ioctls, unique per driver */
|
||||
#define ATMIOC_SARPRV_END 0x7f
|
||||
#define ATMIOC_ITF 0x80 /* Interface ioctls, globally unique */
|
||||
#define ATMIOC_ITF_END 0x8f
|
||||
#define ATMIOC_BACKEND 0x90 /* ATM generic backend ioctls, u. per backend */
|
||||
#define ATMIOC_BACKEND_END 0xaf
|
||||
/* 0xb0-0xbf: Reserved for future use */
|
||||
#define ATMIOC_AREQUIPA 0xc0 /* Application requested IP over ATM, glob. u. */
|
||||
#define ATMIOC_LANE 0xd0 /* LAN Emulation, globally unique */
|
||||
#define ATMIOC_MPOA 0xd8 /* MPOA, globally unique */
|
||||
#define ATMIOC_CLIP 0xe0 /* Classical IP over ATM control, globally u. */
|
||||
#define ATMIOC_CLIP_END 0xef
|
||||
#define ATMIOC_SPECIAL 0xf0 /* Special-purpose controls, globally unique */
|
||||
#define ATMIOC_SPECIAL_END 0xff
|
||||
|
||||
#endif
|
||||
97
include/linux/atmlec.h
Normal file
97
include/linux/atmlec.h
Normal file
@@ -0,0 +1,97 @@
|
||||
/*
|
||||
* ATM Lan Emulation Daemon driver interface
|
||||
*
|
||||
* Marko Kiiskila <mkiiskila@yahoo.com>
|
||||
*/
|
||||
|
||||
#ifndef _ATMLEC_H_
|
||||
#define _ATMLEC_H_
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmioc.h>
|
||||
#include <linux/atm.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
||||
/* ATM lec daemon control socket */
|
||||
#define ATMLEC_CTRL _IO('a', ATMIOC_LANE)
|
||||
#define ATMLEC_DATA _IO('a', ATMIOC_LANE+1)
|
||||
#define ATMLEC_MCAST _IO('a', ATMIOC_LANE+2)
|
||||
|
||||
/* Maximum number of LEC interfaces (tweakable) */
|
||||
#define MAX_LEC_ITF 48
|
||||
|
||||
/*
|
||||
* From the total of MAX_LEC_ITF, last NUM_TR_DEVS are reserved for Token Ring.
|
||||
* E.g. if MAX_LEC_ITF = 48 and NUM_TR_DEVS = 8, then lec0-lec39 are for
|
||||
* Ethernet ELANs and lec40-lec47 are for Token Ring ELANS.
|
||||
*/
|
||||
#define NUM_TR_DEVS 8
|
||||
|
||||
typedef enum {
|
||||
l_set_mac_addr,
|
||||
l_del_mac_addr,
|
||||
l_svc_setup,
|
||||
l_addr_delete,
|
||||
l_topology_change,
|
||||
l_flush_complete,
|
||||
l_arp_update,
|
||||
l_narp_req, /* LANE2 mandates the use of this */
|
||||
l_config,
|
||||
l_flush_tran_id,
|
||||
l_set_lecid,
|
||||
l_arp_xmt,
|
||||
l_rdesc_arp_xmt,
|
||||
l_associate_req,
|
||||
l_should_bridge /* should we bridge this MAC? */
|
||||
} atmlec_msg_type;
|
||||
|
||||
#define ATMLEC_MSG_TYPE_MAX l_should_bridge
|
||||
|
||||
struct atmlec_config_msg {
|
||||
unsigned int maximum_unknown_frame_count;
|
||||
unsigned int max_unknown_frame_time;
|
||||
unsigned short max_retry_count;
|
||||
unsigned int aging_time;
|
||||
unsigned int forward_delay_time;
|
||||
unsigned int arp_response_time;
|
||||
unsigned int flush_timeout;
|
||||
unsigned int path_switching_delay;
|
||||
unsigned int lane_version; /* LANE2: 1 for LANEv1, 2 for LANEv2 */
|
||||
int mtu;
|
||||
int is_proxy;
|
||||
};
|
||||
|
||||
struct atmlec_msg {
|
||||
atmlec_msg_type type;
|
||||
int sizeoftlvs; /* LANE2: if != 0, tlvs follow */
|
||||
union {
|
||||
struct {
|
||||
unsigned char mac_addr[ETH_ALEN];
|
||||
unsigned char atm_addr[ATM_ESA_LEN];
|
||||
unsigned int flag; /*
|
||||
* Topology_change flag,
|
||||
* remoteflag, permanent flag,
|
||||
* lecid, transaction id
|
||||
*/
|
||||
unsigned int targetless_le_arp; /* LANE2 */
|
||||
unsigned int no_source_le_narp; /* LANE2 */
|
||||
} normal;
|
||||
struct atmlec_config_msg config;
|
||||
struct {
|
||||
uint16_t lec_id; /* requestor lec_id */
|
||||
uint32_t tran_id; /* transaction id */
|
||||
unsigned char mac_addr[ETH_ALEN]; /* dst mac addr */
|
||||
unsigned char atm_addr[ATM_ESA_LEN]; /* reqestor ATM addr */
|
||||
} proxy; /*
|
||||
* For mapping LE_ARP requests to responses. Filled by
|
||||
* zeppelin, returned by kernel. Used only when proxying
|
||||
*/
|
||||
} content;
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
struct atmlec_ioc {
|
||||
int dev_num;
|
||||
unsigned char atm_addr[ATM_ESA_LEN];
|
||||
unsigned char receive; /* 1= receive vcc, 0 = send vcc */
|
||||
};
|
||||
#endif /* _ATMLEC_H_ */
|
||||
125
include/linux/atmmpc.h
Normal file
125
include/linux/atmmpc.h
Normal file
@@ -0,0 +1,125 @@
|
||||
#ifndef _ATMMPC_H_
|
||||
#define _ATMMPC_H_
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atmioc.h>
|
||||
#include <linux/atm.h>
|
||||
|
||||
#define ATMMPC_CTRL _IO('a', ATMIOC_MPOA)
|
||||
#define ATMMPC_DATA _IO('a', ATMIOC_MPOA+1)
|
||||
|
||||
#define MPC_SOCKET_INGRESS 1
|
||||
#define MPC_SOCKET_EGRESS 2
|
||||
|
||||
struct atmmpc_ioc {
|
||||
int dev_num;
|
||||
__be32 ipaddr; /* the IP address of the shortcut */
|
||||
int type; /* ingress or egress */
|
||||
};
|
||||
|
||||
typedef struct in_ctrl_info {
|
||||
uint8_t Last_NHRP_CIE_code;
|
||||
uint8_t Last_Q2931_cause_value;
|
||||
uint8_t eg_MPC_ATM_addr[ATM_ESA_LEN];
|
||||
__be32 tag;
|
||||
__be32 in_dst_ip; /* IP address this ingress MPC sends packets to */
|
||||
uint16_t holding_time;
|
||||
uint32_t request_id;
|
||||
} in_ctrl_info;
|
||||
|
||||
typedef struct eg_ctrl_info {
|
||||
uint8_t DLL_header[256];
|
||||
uint8_t DH_length;
|
||||
__be32 cache_id;
|
||||
__be32 tag;
|
||||
__be32 mps_ip;
|
||||
__be32 eg_dst_ip; /* IP address to which ingress MPC sends packets */
|
||||
uint8_t in_MPC_data_ATM_addr[ATM_ESA_LEN];
|
||||
uint16_t holding_time;
|
||||
} eg_ctrl_info;
|
||||
|
||||
struct mpc_parameters {
|
||||
uint16_t mpc_p1; /* Shortcut-Setup Frame Count */
|
||||
uint16_t mpc_p2; /* Shortcut-Setup Frame Time */
|
||||
uint8_t mpc_p3[8]; /* Flow-detection Protocols */
|
||||
uint16_t mpc_p4; /* MPC Initial Retry Time */
|
||||
uint16_t mpc_p5; /* MPC Retry Time Maximum */
|
||||
uint16_t mpc_p6; /* Hold Down Time */
|
||||
} ;
|
||||
|
||||
struct k_message {
|
||||
uint16_t type;
|
||||
__be32 ip_mask;
|
||||
uint8_t MPS_ctrl[ATM_ESA_LEN];
|
||||
union {
|
||||
in_ctrl_info in_info;
|
||||
eg_ctrl_info eg_info;
|
||||
struct mpc_parameters params;
|
||||
} content;
|
||||
struct atm_qos qos;
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
struct llc_snap_hdr {
|
||||
/* RFC 1483 LLC/SNAP encapsulation for routed IP PDUs */
|
||||
uint8_t dsap; /* Destination Service Access Point (0xAA) */
|
||||
uint8_t ssap; /* Source Service Access Point (0xAA) */
|
||||
uint8_t ui; /* Unnumbered Information (0x03) */
|
||||
uint8_t org[3]; /* Organizational identification (0x000000) */
|
||||
uint8_t type[2]; /* Ether type (for IP) (0x0800) */
|
||||
};
|
||||
|
||||
/* TLVs this MPC recognizes */
|
||||
#define TLV_MPOA_DEVICE_TYPE 0x00a03e2a
|
||||
|
||||
/* MPOA device types in MPOA Device Type TLV */
|
||||
#define NON_MPOA 0
|
||||
#define MPS 1
|
||||
#define MPC 2
|
||||
#define MPS_AND_MPC 3
|
||||
|
||||
|
||||
/* MPC parameter defaults */
|
||||
|
||||
#define MPC_P1 10 /* Shortcut-Setup Frame Count */
|
||||
#define MPC_P2 1 /* Shortcut-Setup Frame Time */
|
||||
#define MPC_P3 0 /* Flow-detection Protocols */
|
||||
#define MPC_P4 5 /* MPC Initial Retry Time */
|
||||
#define MPC_P5 40 /* MPC Retry Time Maximum */
|
||||
#define MPC_P6 160 /* Hold Down Time */
|
||||
#define HOLDING_TIME_DEFAULT 1200 /* same as MPS-p7 */
|
||||
|
||||
/* MPC constants */
|
||||
|
||||
#define MPC_C1 2 /* Retry Time Multiplier */
|
||||
#define MPC_C2 60 /* Initial Keep-Alive Lifetime */
|
||||
|
||||
/* Message types - to MPOA daemon */
|
||||
|
||||
#define SND_MPOA_RES_RQST 201
|
||||
#define SET_MPS_CTRL_ADDR 202
|
||||
#define SND_MPOA_RES_RTRY 203 /* Different type in a retry due to req id */
|
||||
#define STOP_KEEP_ALIVE_SM 204
|
||||
#define EGRESS_ENTRY_REMOVED 205
|
||||
#define SND_EGRESS_PURGE 206
|
||||
#define DIE 207 /* tell the daemon to exit() */
|
||||
#define DATA_PLANE_PURGE 208 /* Data plane purge because of egress cache hit miss or dead MPS */
|
||||
#define OPEN_INGRESS_SVC 209
|
||||
|
||||
/* Message types - from MPOA daemon */
|
||||
|
||||
#define MPOA_TRIGGER_RCVD 101
|
||||
#define MPOA_RES_REPLY_RCVD 102
|
||||
#define INGRESS_PURGE_RCVD 103
|
||||
#define EGRESS_PURGE_RCVD 104
|
||||
#define MPS_DEATH 105
|
||||
#define CACHE_IMPOS_RCVD 106
|
||||
#define SET_MPC_CTRL_ADDR 107 /* Our MPC's control ATM address */
|
||||
#define SET_MPS_MAC_ADDR 108
|
||||
#define CLEAN_UP_AND_EXIT 109
|
||||
#define SET_MPC_PARAMS 110 /* MPC configuration parameters */
|
||||
|
||||
/* Message types - bidirectional */
|
||||
|
||||
#define RELOAD 301 /* kill -HUP the daemon for reload */
|
||||
|
||||
#endif /* _ATMMPC_H_ */
|
||||
24
include/linux/atmppp.h
Normal file
24
include/linux/atmppp.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/* atmppp.h - RFC2364 PPPoATM */
|
||||
|
||||
/* Written 2000 by Mitchell Blank Jr */
|
||||
|
||||
#ifndef _LINUX_ATMPPP_H
|
||||
#define _LINUX_ATMPPP_H
|
||||
|
||||
#include <linux/atm.h>
|
||||
|
||||
#define PPPOATM_ENCAPS_AUTODETECT (0)
|
||||
#define PPPOATM_ENCAPS_VC (1)
|
||||
#define PPPOATM_ENCAPS_LLC (2)
|
||||
|
||||
/*
|
||||
* This is for the ATM_SETBACKEND call - these are like socket families:
|
||||
* the first element of the structure is the backend number and the rest
|
||||
* is per-backend specific
|
||||
*/
|
||||
struct atm_backend_ppp {
|
||||
atm_backend_t backend_num; /* ATM_BACKEND_PPP */
|
||||
int encaps; /* PPPOATM_ENCAPS_* */
|
||||
};
|
||||
|
||||
#endif /* _LINUX_ATMPPP_H */
|
||||
162
include/linux/atmsap.h
Normal file
162
include/linux/atmsap.h
Normal file
@@ -0,0 +1,162 @@
|
||||
/* atmsap.h - ATM Service Access Point addressing definitions */
|
||||
|
||||
/* Written 1995-1999 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef _LINUX_ATMSAP_H
|
||||
#define _LINUX_ATMSAP_H
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
|
||||
/*
|
||||
* BEGIN_xx and END_xx markers are used for automatic generation of
|
||||
* documentation. Do not change them.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Layer 2 protocol identifiers
|
||||
*/
|
||||
|
||||
/* BEGIN_L2 */
|
||||
#define ATM_L2_NONE 0 /* L2 not specified */
|
||||
#define ATM_L2_ISO1745 0x01 /* Basic mode ISO 1745 */
|
||||
#define ATM_L2_Q291 0x02 /* ITU-T Q.291 (Rec. I.441) */
|
||||
#define ATM_L2_X25_LL 0x06 /* ITU-T X.25, link layer */
|
||||
#define ATM_L2_X25_ML 0x07 /* ITU-T X.25, multilink */
|
||||
#define ATM_L2_LAPB 0x08 /* Extended LAPB, half-duplex (Rec. T.71) */
|
||||
#define ATM_L2_HDLC_ARM 0x09 /* HDLC ARM (ISO/IEC 4335) */
|
||||
#define ATM_L2_HDLC_NRM 0x0a /* HDLC NRM (ISO/IEC 4335) */
|
||||
#define ATM_L2_HDLC_ABM 0x0b /* HDLC ABM (ISO/IEC 4335) */
|
||||
#define ATM_L2_ISO8802 0x0c /* LAN LLC (ISO/IEC 8802/2) */
|
||||
#define ATM_L2_X75 0x0d /* ITU-T X.75, SLP */
|
||||
#define ATM_L2_Q922 0x0e /* ITU-T Q.922 */
|
||||
#define ATM_L2_USER 0x10 /* user-specified */
|
||||
#define ATM_L2_ISO7776 0x11 /* ISO 7776 DTE-DTE */
|
||||
/* END_L2 */
|
||||
|
||||
|
||||
/*
|
||||
* Layer 3 protocol identifiers
|
||||
*/
|
||||
|
||||
/* BEGIN_L3 */
|
||||
#define ATM_L3_NONE 0 /* L3 not specified */
|
||||
#define ATM_L3_X25 0x06 /* ITU-T X.25, packet layer */
|
||||
#define ATM_L3_ISO8208 0x07 /* ISO/IEC 8208 */
|
||||
#define ATM_L3_X223 0x08 /* ITU-T X.223 | ISO/IEC 8878 */
|
||||
#define ATM_L3_ISO8473 0x09 /* ITU-T X.233 | ISO/IEC 8473 */
|
||||
#define ATM_L3_T70 0x0a /* ITU-T T.70 minimum network layer */
|
||||
#define ATM_L3_TR9577 0x0b /* ISO/IEC TR 9577 */
|
||||
#define ATM_L3_H310 0x0c /* ITU-T Recommendation H.310 */
|
||||
#define ATM_L3_H321 0x0d /* ITU-T Recommendation H.321 */
|
||||
#define ATM_L3_USER 0x10 /* user-specified */
|
||||
/* END_L3 */
|
||||
|
||||
|
||||
/*
|
||||
* High layer identifiers
|
||||
*/
|
||||
|
||||
/* BEGIN_HL */
|
||||
#define ATM_HL_NONE 0 /* HL not specified */
|
||||
#define ATM_HL_ISO 0x01 /* ISO */
|
||||
#define ATM_HL_USER 0x02 /* user-specific */
|
||||
#define ATM_HL_HLP 0x03 /* high layer profile - UNI 3.0 only */
|
||||
#define ATM_HL_VENDOR 0x04 /* vendor-specific application identifier */
|
||||
/* END_HL */
|
||||
|
||||
|
||||
/*
|
||||
* ITU-T coded mode of operation
|
||||
*/
|
||||
|
||||
/* BEGIN_IMD */
|
||||
#define ATM_IMD_NONE 0 /* mode not specified */
|
||||
#define ATM_IMD_NORMAL 1 /* normal mode of operation */
|
||||
#define ATM_IMD_EXTENDED 2 /* extended mode of operation */
|
||||
/* END_IMD */
|
||||
|
||||
/*
|
||||
* H.310 code points
|
||||
*/
|
||||
|
||||
#define ATM_TT_NONE 0 /* terminal type not specified */
|
||||
#define ATM_TT_RX 1 /* receive only */
|
||||
#define ATM_TT_TX 2 /* send only */
|
||||
#define ATM_TT_RXTX 3 /* receive and send */
|
||||
|
||||
#define ATM_MC_NONE 0 /* no multiplexing */
|
||||
#define ATM_MC_TS 1 /* transport stream (TS) */
|
||||
#define ATM_MC_TS_FEC 2 /* transport stream with forward error corr. */
|
||||
#define ATM_MC_PS 3 /* program stream (PS) */
|
||||
#define ATM_MC_PS_FEC 4 /* program stream with forward error corr. */
|
||||
#define ATM_MC_H221 5 /* ITU-T Rec. H.221 */
|
||||
|
||||
/*
|
||||
* SAP structures
|
||||
*/
|
||||
|
||||
#define ATM_MAX_HLI 8 /* maximum high-layer information length */
|
||||
|
||||
|
||||
struct atm_blli {
|
||||
unsigned char l2_proto; /* layer 2 protocol */
|
||||
union {
|
||||
struct {
|
||||
unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
|
||||
/* absent */
|
||||
unsigned char window; /* window size (k), 1-127 (0 to omit) */
|
||||
} itu; /* ITU-T encoding */
|
||||
unsigned char user; /* user-specified l2 information */
|
||||
} l2;
|
||||
unsigned char l3_proto; /* layer 3 protocol */
|
||||
union {
|
||||
struct {
|
||||
unsigned char mode; /* mode of operation (ATM_IMD_xxx), 0 if */
|
||||
/* absent */
|
||||
unsigned char def_size; /* default packet size (log2), 4-12 (0 to */
|
||||
/* omit) */
|
||||
unsigned char window;/* packet window size, 1-127 (0 to omit) */
|
||||
} itu; /* ITU-T encoding */
|
||||
unsigned char user; /* user specified l3 information */
|
||||
struct { /* if l3_proto = ATM_L3_H310 */
|
||||
unsigned char term_type; /* terminal type */
|
||||
unsigned char fw_mpx_cap; /* forward multiplexing capability */
|
||||
/* only if term_type != ATM_TT_NONE */
|
||||
unsigned char bw_mpx_cap; /* backward multiplexing capability */
|
||||
/* only if term_type != ATM_TT_NONE */
|
||||
} h310;
|
||||
struct { /* if l3_proto = ATM_L3_TR9577 */
|
||||
unsigned char ipi; /* initial protocol id */
|
||||
unsigned char snap[5];/* IEEE 802.1 SNAP identifier */
|
||||
/* (only if ipi == NLPID_IEEE802_1_SNAP) */
|
||||
} tr9577;
|
||||
} l3;
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
|
||||
struct atm_bhli {
|
||||
unsigned char hl_type; /* high layer information type */
|
||||
unsigned char hl_length; /* length (only if hl_type == ATM_HL_USER || */
|
||||
/* hl_type == ATM_HL_ISO) */
|
||||
unsigned char hl_info[ATM_MAX_HLI];/* high layer information */
|
||||
};
|
||||
|
||||
|
||||
#define ATM_MAX_BLLI 3 /* maximum number of BLLI elements */
|
||||
|
||||
|
||||
struct atm_sap {
|
||||
struct atm_bhli bhli; /* local SAP, high-layer information */
|
||||
struct atm_blli blli[ATM_MAX_BLLI] __ATM_API_ALIGN;
|
||||
/* local SAP, low-layer info */
|
||||
};
|
||||
|
||||
|
||||
static __inline__ int blli_in_use(struct atm_blli blli)
|
||||
{
|
||||
return blli.l2_proto || blli.l3_proto;
|
||||
}
|
||||
|
||||
#endif
|
||||
55
include/linux/atmsvc.h
Normal file
55
include/linux/atmsvc.h
Normal file
@@ -0,0 +1,55 @@
|
||||
/* atmsvc.h - ATM signaling kernel-demon interface definitions */
|
||||
|
||||
/* Written 1995-2000 by Werner Almesberger, EPFL LRC/ICA */
|
||||
|
||||
|
||||
#ifndef _LINUX_ATMSVC_H
|
||||
#define _LINUX_ATMSVC_H
|
||||
|
||||
#include <linux/atmapi.h>
|
||||
#include <linux/atm.h>
|
||||
#include <linux/atmioc.h>
|
||||
|
||||
|
||||
#define ATMSIGD_CTRL _IO('a',ATMIOC_SPECIAL)
|
||||
/* become ATM signaling demon control socket */
|
||||
|
||||
enum atmsvc_msg_type { as_catch_null, as_bind, as_connect, as_accept, as_reject,
|
||||
as_listen, as_okay, as_error, as_indicate, as_close,
|
||||
as_itf_notify, as_modify, as_identify, as_terminate,
|
||||
as_addparty, as_dropparty };
|
||||
|
||||
struct atmsvc_msg {
|
||||
enum atmsvc_msg_type type;
|
||||
atm_kptr_t vcc;
|
||||
atm_kptr_t listen_vcc; /* indicate */
|
||||
int reply; /* for okay and close: */
|
||||
/* < 0: error before active */
|
||||
/* (sigd has discarded ctx) */
|
||||
/* ==0: success */
|
||||
/* > 0: error when active (still */
|
||||
/* need to close) */
|
||||
struct sockaddr_atmpvc pvc; /* indicate, okay (connect) */
|
||||
struct sockaddr_atmsvc local; /* local SVC address */
|
||||
struct atm_qos qos; /* QOS parameters */
|
||||
struct atm_sap sap; /* SAP */
|
||||
unsigned int session; /* for p2pm */
|
||||
struct sockaddr_atmsvc svc; /* SVC address */
|
||||
} __ATM_API_ALIGN;
|
||||
|
||||
/*
|
||||
* Message contents: see ftp://icaftp.epfl.ch/pub/linux/atm/docs/isp-*.tar.gz
|
||||
*/
|
||||
|
||||
/*
|
||||
* Some policy stuff for atmsigd and for net/atm/svc.c. Both have to agree on
|
||||
* what PCR is used to request bandwidth from the device driver. net/atm/svc.c
|
||||
* tries to do better than that, but only if there's no routing decision (i.e.
|
||||
* if signaling only uses one ATM interface).
|
||||
*/
|
||||
|
||||
#define SELECT_TOP_PCR(tp) ((tp).pcr ? (tp).pcr : \
|
||||
(tp).max_pcr && (tp).max_pcr != ATM_MAX_PCR ? (tp).max_pcr : \
|
||||
(tp).min_pcr ? (tp).min_pcr : ATM_MAX_PCR)
|
||||
|
||||
#endif
|
||||
71
include/linux/attribute_container.h
Normal file
71
include/linux/attribute_container.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* class_container.h - a generic container for all classes
|
||||
*
|
||||
* Copyright (c) 2005 - James Bottomley <James.Bottomley@steeleye.com>
|
||||
*
|
||||
* This file is licensed under GPLv2
|
||||
*/
|
||||
|
||||
#ifndef _ATTRIBUTE_CONTAINER_H_
|
||||
#define _ATTRIBUTE_CONTAINER_H_
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/klist.h>
|
||||
#include <linux/spinlock.h>
|
||||
|
||||
struct attribute_container {
|
||||
struct list_head node;
|
||||
struct klist containers;
|
||||
struct class *class;
|
||||
struct class_device_attribute **attrs;
|
||||
int (*match)(struct attribute_container *, struct device *);
|
||||
#define ATTRIBUTE_CONTAINER_NO_CLASSDEVS 0x01
|
||||
unsigned long flags;
|
||||
};
|
||||
|
||||
static inline int
|
||||
attribute_container_no_classdevs(struct attribute_container *atc)
|
||||
{
|
||||
return atc->flags & ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
|
||||
}
|
||||
|
||||
static inline void
|
||||
attribute_container_set_no_classdevs(struct attribute_container *atc)
|
||||
{
|
||||
atc->flags |= ATTRIBUTE_CONTAINER_NO_CLASSDEVS;
|
||||
}
|
||||
|
||||
int attribute_container_register(struct attribute_container *cont);
|
||||
int attribute_container_unregister(struct attribute_container *cont);
|
||||
void attribute_container_create_device(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
void attribute_container_add_device(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
void attribute_container_remove_device(struct device *dev,
|
||||
void (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
void attribute_container_device_trigger(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *,
|
||||
struct class_device *));
|
||||
void attribute_container_trigger(struct device *dev,
|
||||
int (*fn)(struct attribute_container *,
|
||||
struct device *));
|
||||
int attribute_container_add_attrs(struct class_device *classdev);
|
||||
int attribute_container_add_class_device(struct class_device *classdev);
|
||||
int attribute_container_add_class_device_adapter(struct attribute_container *cont,
|
||||
struct device *dev,
|
||||
struct class_device *classdev);
|
||||
void attribute_container_remove_attrs(struct class_device *classdev);
|
||||
void attribute_container_class_device_del(struct class_device *classdev);
|
||||
struct attribute_container *attribute_container_classdev_to_container(struct class_device *);
|
||||
struct class_device *attribute_container_find_class_device(struct attribute_container *, struct device *);
|
||||
struct class_device_attribute **attribute_container_classdev_to_attrs(const struct class_device *classdev);
|
||||
|
||||
#endif
|
||||
524
include/linux/audit.h
Normal file
524
include/linux/audit.h
Normal file
@@ -0,0 +1,524 @@
|
||||
/* audit.h -- Auditing support
|
||||
*
|
||||
* Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Written by Rickard E. (Rik) Faith <faith@redhat.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_AUDIT_H_
|
||||
#define _LINUX_AUDIT_H_
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/elf-em.h>
|
||||
|
||||
/* The netlink messages for the audit system is divided into blocks:
|
||||
* 1000 - 1099 are for commanding the audit system
|
||||
* 1100 - 1199 user space trusted application messages
|
||||
* 1200 - 1299 messages internal to the audit daemon
|
||||
* 1300 - 1399 audit event messages
|
||||
* 1400 - 1499 SE Linux use
|
||||
* 1500 - 1599 kernel LSPP events
|
||||
* 1600 - 1699 kernel crypto events
|
||||
* 1700 - 1799 kernel anomaly records
|
||||
* 1800 - 1999 future kernel use (maybe integrity labels and related events)
|
||||
* 2000 is for otherwise unclassified kernel audit messages (legacy)
|
||||
* 2001 - 2099 unused (kernel)
|
||||
* 2100 - 2199 user space anomaly records
|
||||
* 2200 - 2299 user space actions taken in response to anomalies
|
||||
* 2300 - 2399 user space generated LSPP events
|
||||
* 2400 - 2499 user space crypto events
|
||||
* 2500 - 2999 future user space (maybe integrity labels and related events)
|
||||
*
|
||||
* Messages from 1000-1199 are bi-directional. 1200-1299 & 2100 - 2999 are
|
||||
* exclusively user space. 1300-2099 is kernel --> user space
|
||||
* communication.
|
||||
*/
|
||||
#define AUDIT_GET 1000 /* Get status */
|
||||
#define AUDIT_SET 1001 /* Set status (enable/disable/auditd) */
|
||||
#define AUDIT_LIST 1002 /* List syscall rules -- deprecated */
|
||||
#define AUDIT_ADD 1003 /* Add syscall rule -- deprecated */
|
||||
#define AUDIT_DEL 1004 /* Delete syscall rule -- deprecated */
|
||||
#define AUDIT_USER 1005 /* Message from userspace -- deprecated */
|
||||
#define AUDIT_LOGIN 1006 /* Define the login id and information */
|
||||
#define AUDIT_WATCH_INS 1007 /* Insert file/dir watch entry */
|
||||
#define AUDIT_WATCH_REM 1008 /* Remove file/dir watch entry */
|
||||
#define AUDIT_WATCH_LIST 1009 /* List all file/dir watches */
|
||||
#define AUDIT_SIGNAL_INFO 1010 /* Get info about sender of signal to auditd */
|
||||
#define AUDIT_ADD_RULE 1011 /* Add syscall filtering rule */
|
||||
#define AUDIT_DEL_RULE 1012 /* Delete syscall filtering rule */
|
||||
#define AUDIT_LIST_RULES 1013 /* List syscall filtering rules */
|
||||
|
||||
#define AUDIT_FIRST_USER_MSG 1100 /* Userspace messages mostly uninteresting to kernel */
|
||||
#define AUDIT_USER_AVC 1107 /* We filter this differently */
|
||||
#define AUDIT_LAST_USER_MSG 1199
|
||||
#define AUDIT_FIRST_USER_MSG2 2100 /* More user space messages */
|
||||
#define AUDIT_LAST_USER_MSG2 2999
|
||||
|
||||
#define AUDIT_DAEMON_START 1200 /* Daemon startup record */
|
||||
#define AUDIT_DAEMON_END 1201 /* Daemon normal stop record */
|
||||
#define AUDIT_DAEMON_ABORT 1202 /* Daemon error stop record */
|
||||
#define AUDIT_DAEMON_CONFIG 1203 /* Daemon config change */
|
||||
|
||||
#define AUDIT_SYSCALL 1300 /* Syscall event */
|
||||
/* #define AUDIT_FS_WATCH 1301 * Deprecated */
|
||||
#define AUDIT_PATH 1302 /* Filename path information */
|
||||
#define AUDIT_IPC 1303 /* IPC record */
|
||||
#define AUDIT_SOCKETCALL 1304 /* sys_socketcall arguments */
|
||||
#define AUDIT_CONFIG_CHANGE 1305 /* Audit system configuration change */
|
||||
#define AUDIT_SOCKADDR 1306 /* sockaddr copied as syscall arg */
|
||||
#define AUDIT_CWD 1307 /* Current working directory */
|
||||
#define AUDIT_EXECVE 1309 /* execve arguments */
|
||||
#define AUDIT_IPC_SET_PERM 1311 /* IPC new permissions record type */
|
||||
#define AUDIT_MQ_OPEN 1312 /* POSIX MQ open record type */
|
||||
#define AUDIT_MQ_SENDRECV 1313 /* POSIX MQ send/receive record type */
|
||||
#define AUDIT_MQ_NOTIFY 1314 /* POSIX MQ notify record type */
|
||||
#define AUDIT_MQ_GETSETATTR 1315 /* POSIX MQ get/set attribute record type */
|
||||
#define AUDIT_KERNEL_OTHER 1316 /* For use by 3rd party modules */
|
||||
#define AUDIT_FD_PAIR 1317 /* audit record for pipe/socketpair */
|
||||
|
||||
#define AUDIT_AVC 1400 /* SE Linux avc denial or grant */
|
||||
#define AUDIT_SELINUX_ERR 1401 /* Internal SE Linux Errors */
|
||||
#define AUDIT_AVC_PATH 1402 /* dentry, vfsmount pair from avc */
|
||||
#define AUDIT_MAC_POLICY_LOAD 1403 /* Policy file load */
|
||||
#define AUDIT_MAC_STATUS 1404 /* Changed enforcing,permissive,off */
|
||||
#define AUDIT_MAC_CONFIG_CHANGE 1405 /* Changes to booleans */
|
||||
#define AUDIT_MAC_UNLBL_ALLOW 1406 /* NetLabel: allow unlabeled traffic */
|
||||
#define AUDIT_MAC_CIPSOV4_ADD 1407 /* NetLabel: add CIPSOv4 DOI entry */
|
||||
#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
|
||||
#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
|
||||
#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
|
||||
#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */
|
||||
#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
|
||||
#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
|
||||
#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
|
||||
|
||||
#define AUDIT_FIRST_KERN_ANOM_MSG 1700
|
||||
#define AUDIT_LAST_KERN_ANOM_MSG 1799
|
||||
#define AUDIT_ANOM_PROMISCUOUS 1700 /* Device changed promiscuous mode */
|
||||
|
||||
#define AUDIT_KERNEL 2000 /* Asynchronous audit record. NOT A REQUEST. */
|
||||
|
||||
/* Rule flags */
|
||||
#define AUDIT_FILTER_USER 0x00 /* Apply rule to user-generated messages */
|
||||
#define AUDIT_FILTER_TASK 0x01 /* Apply rule at task creation (not syscall) */
|
||||
#define AUDIT_FILTER_ENTRY 0x02 /* Apply rule at syscall entry */
|
||||
#define AUDIT_FILTER_WATCH 0x03 /* Apply rule to file system watches */
|
||||
#define AUDIT_FILTER_EXIT 0x04 /* Apply rule at syscall exit */
|
||||
#define AUDIT_FILTER_TYPE 0x05 /* Apply rule at audit_log_start */
|
||||
|
||||
#define AUDIT_NR_FILTERS 6
|
||||
|
||||
#define AUDIT_FILTER_PREPEND 0x10 /* Prepend to front of list */
|
||||
|
||||
/* Rule actions */
|
||||
#define AUDIT_NEVER 0 /* Do not build context if rule matches */
|
||||
#define AUDIT_POSSIBLE 1 /* Build context if rule matches */
|
||||
#define AUDIT_ALWAYS 2 /* Generate audit record if rule matches */
|
||||
|
||||
/* Rule structure sizes -- if these change, different AUDIT_ADD and
|
||||
* AUDIT_LIST commands must be implemented. */
|
||||
#define AUDIT_MAX_FIELDS 64
|
||||
#define AUDIT_MAX_KEY_LEN 32
|
||||
#define AUDIT_BITMASK_SIZE 64
|
||||
#define AUDIT_WORD(nr) ((__u32)((nr)/32))
|
||||
#define AUDIT_BIT(nr) (1 << ((nr) - AUDIT_WORD(nr)*32))
|
||||
|
||||
#define AUDIT_SYSCALL_CLASSES 16
|
||||
#define AUDIT_CLASS_DIR_WRITE 0
|
||||
#define AUDIT_CLASS_DIR_WRITE_32 1
|
||||
#define AUDIT_CLASS_CHATTR 2
|
||||
#define AUDIT_CLASS_CHATTR_32 3
|
||||
#define AUDIT_CLASS_READ 4
|
||||
#define AUDIT_CLASS_READ_32 5
|
||||
#define AUDIT_CLASS_WRITE 6
|
||||
#define AUDIT_CLASS_WRITE_32 7
|
||||
|
||||
/* This bitmask is used to validate user input. It represents all bits that
|
||||
* are currently used in an audit field constant understood by the kernel.
|
||||
* If you are adding a new #define AUDIT_<whatever>, please ensure that
|
||||
* AUDIT_UNUSED_BITS is updated if need be. */
|
||||
#define AUDIT_UNUSED_BITS 0x0FFFFC00
|
||||
|
||||
|
||||
/* Rule fields */
|
||||
/* These are useful when checking the
|
||||
* task structure at task creation time
|
||||
* (AUDIT_PER_TASK). */
|
||||
#define AUDIT_PID 0
|
||||
#define AUDIT_UID 1
|
||||
#define AUDIT_EUID 2
|
||||
#define AUDIT_SUID 3
|
||||
#define AUDIT_FSUID 4
|
||||
#define AUDIT_GID 5
|
||||
#define AUDIT_EGID 6
|
||||
#define AUDIT_SGID 7
|
||||
#define AUDIT_FSGID 8
|
||||
#define AUDIT_LOGINUID 9
|
||||
#define AUDIT_PERS 10
|
||||
#define AUDIT_ARCH 11
|
||||
#define AUDIT_MSGTYPE 12
|
||||
#define AUDIT_SUBJ_USER 13 /* security label user */
|
||||
#define AUDIT_SUBJ_ROLE 14 /* security label role */
|
||||
#define AUDIT_SUBJ_TYPE 15 /* security label type */
|
||||
#define AUDIT_SUBJ_SEN 16 /* security label sensitivity label */
|
||||
#define AUDIT_SUBJ_CLR 17 /* security label clearance label */
|
||||
#define AUDIT_PPID 18
|
||||
#define AUDIT_OBJ_USER 19
|
||||
#define AUDIT_OBJ_ROLE 20
|
||||
#define AUDIT_OBJ_TYPE 21
|
||||
#define AUDIT_OBJ_LEV_LOW 22
|
||||
#define AUDIT_OBJ_LEV_HIGH 23
|
||||
|
||||
/* These are ONLY useful when checking
|
||||
* at syscall exit time (AUDIT_AT_EXIT). */
|
||||
#define AUDIT_DEVMAJOR 100
|
||||
#define AUDIT_DEVMINOR 101
|
||||
#define AUDIT_INODE 102
|
||||
#define AUDIT_EXIT 103
|
||||
#define AUDIT_SUCCESS 104 /* exit >= 0; value ignored */
|
||||
#define AUDIT_WATCH 105
|
||||
#define AUDIT_PERM 106
|
||||
|
||||
#define AUDIT_ARG0 200
|
||||
#define AUDIT_ARG1 (AUDIT_ARG0+1)
|
||||
#define AUDIT_ARG2 (AUDIT_ARG0+2)
|
||||
#define AUDIT_ARG3 (AUDIT_ARG0+3)
|
||||
|
||||
#define AUDIT_FILTERKEY 210
|
||||
|
||||
#define AUDIT_NEGATE 0x80000000
|
||||
|
||||
/* These are the supported operators.
|
||||
* 4 2 1
|
||||
* = > <
|
||||
* -------
|
||||
* 0 0 0 0 nonsense
|
||||
* 0 0 1 1 <
|
||||
* 0 1 0 2 >
|
||||
* 0 1 1 3 !=
|
||||
* 1 0 0 4 =
|
||||
* 1 0 1 5 <=
|
||||
* 1 1 0 6 >=
|
||||
* 1 1 1 7 all operators
|
||||
*/
|
||||
#define AUDIT_LESS_THAN 0x10000000
|
||||
#define AUDIT_GREATER_THAN 0x20000000
|
||||
#define AUDIT_NOT_EQUAL 0x30000000
|
||||
#define AUDIT_EQUAL 0x40000000
|
||||
#define AUDIT_LESS_THAN_OR_EQUAL (AUDIT_LESS_THAN|AUDIT_EQUAL)
|
||||
#define AUDIT_GREATER_THAN_OR_EQUAL (AUDIT_GREATER_THAN|AUDIT_EQUAL)
|
||||
#define AUDIT_OPERATORS (AUDIT_EQUAL|AUDIT_NOT_EQUAL)
|
||||
|
||||
/* Status symbols */
|
||||
/* Mask values */
|
||||
#define AUDIT_STATUS_ENABLED 0x0001
|
||||
#define AUDIT_STATUS_FAILURE 0x0002
|
||||
#define AUDIT_STATUS_PID 0x0004
|
||||
#define AUDIT_STATUS_RATE_LIMIT 0x0008
|
||||
#define AUDIT_STATUS_BACKLOG_LIMIT 0x0010
|
||||
/* Failure-to-log actions */
|
||||
#define AUDIT_FAIL_SILENT 0
|
||||
#define AUDIT_FAIL_PRINTK 1
|
||||
#define AUDIT_FAIL_PANIC 2
|
||||
|
||||
/* distinguish syscall tables */
|
||||
#define __AUDIT_ARCH_64BIT 0x80000000
|
||||
#define __AUDIT_ARCH_LE 0x40000000
|
||||
#define AUDIT_ARCH_ALPHA (EM_ALPHA|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_ARM (EM_ARM|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_ARMEB (EM_ARM)
|
||||
#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_FRV (EM_FRV)
|
||||
#define AUDIT_ARCH_H8300 (EM_H8_300)
|
||||
#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_M32R (EM_M32R)
|
||||
#define AUDIT_ARCH_M68K (EM_68K)
|
||||
#define AUDIT_ARCH_MIPS (EM_MIPS)
|
||||
#define AUDIT_ARCH_MIPSEL (EM_MIPS|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_MIPS64 (EM_MIPS|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_MIPSEL64 (EM_MIPS|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_PARISC (EM_PARISC)
|
||||
#define AUDIT_ARCH_PARISC64 (EM_PARISC|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_PPC (EM_PPC)
|
||||
#define AUDIT_ARCH_PPC64 (EM_PPC64|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_S390 (EM_S390)
|
||||
#define AUDIT_ARCH_S390X (EM_S390|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_SH (EM_SH)
|
||||
#define AUDIT_ARCH_SHEL (EM_SH|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_SH64 (EM_SH|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_SHEL64 (EM_SH|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_SPARC (EM_SPARC)
|
||||
#define AUDIT_ARCH_SPARC64 (EM_SPARCV9|__AUDIT_ARCH_64BIT)
|
||||
#define AUDIT_ARCH_V850 (EM_V850|__AUDIT_ARCH_LE)
|
||||
#define AUDIT_ARCH_X86_64 (EM_X86_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
|
||||
|
||||
#define AUDIT_PERM_EXEC 1
|
||||
#define AUDIT_PERM_WRITE 2
|
||||
#define AUDIT_PERM_READ 4
|
||||
#define AUDIT_PERM_ATTR 8
|
||||
|
||||
struct audit_status {
|
||||
__u32 mask; /* Bit mask for valid entries */
|
||||
__u32 enabled; /* 1 = enabled, 0 = disabled */
|
||||
__u32 failure; /* Failure-to-log action */
|
||||
__u32 pid; /* pid of auditd process */
|
||||
__u32 rate_limit; /* messages rate limit (per second) */
|
||||
__u32 backlog_limit; /* waiting messages limit */
|
||||
__u32 lost; /* messages lost */
|
||||
__u32 backlog; /* messages waiting in queue */
|
||||
};
|
||||
|
||||
/* audit_rule_data supports filter rules with both integer and string
|
||||
* fields. It corresponds with AUDIT_ADD_RULE, AUDIT_DEL_RULE and
|
||||
* AUDIT_LIST_RULES requests.
|
||||
*/
|
||||
struct audit_rule_data {
|
||||
__u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
|
||||
__u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
|
||||
__u32 field_count;
|
||||
__u32 mask[AUDIT_BITMASK_SIZE]; /* syscall(s) affected */
|
||||
__u32 fields[AUDIT_MAX_FIELDS];
|
||||
__u32 values[AUDIT_MAX_FIELDS];
|
||||
__u32 fieldflags[AUDIT_MAX_FIELDS];
|
||||
__u32 buflen; /* total length of string fields */
|
||||
char buf[0]; /* string fields buffer */
|
||||
};
|
||||
|
||||
/* audit_rule is supported to maintain backward compatibility with
|
||||
* userspace. It supports integer fields only and corresponds to
|
||||
* AUDIT_ADD, AUDIT_DEL and AUDIT_LIST requests.
|
||||
*/
|
||||
struct audit_rule { /* for AUDIT_LIST, AUDIT_ADD, and AUDIT_DEL */
|
||||
__u32 flags; /* AUDIT_PER_{TASK,CALL}, AUDIT_PREPEND */
|
||||
__u32 action; /* AUDIT_NEVER, AUDIT_POSSIBLE, AUDIT_ALWAYS */
|
||||
__u32 field_count;
|
||||
__u32 mask[AUDIT_BITMASK_SIZE];
|
||||
__u32 fields[AUDIT_MAX_FIELDS];
|
||||
__u32 values[AUDIT_MAX_FIELDS];
|
||||
};
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/sched.h>
|
||||
|
||||
struct audit_sig_info {
|
||||
uid_t uid;
|
||||
pid_t pid;
|
||||
char ctx[0];
|
||||
};
|
||||
|
||||
struct audit_buffer;
|
||||
struct audit_context;
|
||||
struct inode;
|
||||
struct netlink_skb_parms;
|
||||
struct linux_binprm;
|
||||
struct mq_attr;
|
||||
struct mqstat;
|
||||
|
||||
#define AUDITSC_INVALID 0
|
||||
#define AUDITSC_SUCCESS 1
|
||||
#define AUDITSC_FAILURE 2
|
||||
#define AUDITSC_RESULT(x) ( ((long)(x))<0?AUDITSC_FAILURE:AUDITSC_SUCCESS )
|
||||
extern int __init audit_register_class(int class, unsigned *list);
|
||||
extern int audit_classify_syscall(int abi, unsigned syscall);
|
||||
#ifdef CONFIG_AUDITSYSCALL
|
||||
/* These are defined in auditsc.c */
|
||||
/* Public API */
|
||||
extern int audit_alloc(struct task_struct *task);
|
||||
extern void audit_free(struct task_struct *task);
|
||||
extern void audit_syscall_entry(int arch,
|
||||
int major, unsigned long a0, unsigned long a1,
|
||||
unsigned long a2, unsigned long a3);
|
||||
extern void audit_syscall_exit(int failed, long return_code);
|
||||
extern void __audit_getname(const char *name);
|
||||
extern void audit_putname(const char *name);
|
||||
extern void __audit_inode(const char *name, const struct inode *inode);
|
||||
extern void __audit_inode_child(const char *dname, const struct inode *inode,
|
||||
const struct inode *parent);
|
||||
extern void __audit_inode_update(const struct inode *inode);
|
||||
static inline int audit_dummy_context(void)
|
||||
{
|
||||
void *p = current->audit_context;
|
||||
return !p || *(int *)p;
|
||||
}
|
||||
static inline void audit_getname(const char *name)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_getname(name);
|
||||
}
|
||||
static inline void audit_inode(const char *name, const struct inode *inode) {
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_inode(name, inode);
|
||||
}
|
||||
static inline void audit_inode_child(const char *dname,
|
||||
const struct inode *inode,
|
||||
const struct inode *parent) {
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_inode_child(dname, inode, parent);
|
||||
}
|
||||
static inline void audit_inode_update(const struct inode *inode) {
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
__audit_inode_update(inode);
|
||||
}
|
||||
|
||||
/* Private API (for audit.c only) */
|
||||
extern unsigned int audit_serial(void);
|
||||
extern void auditsc_get_stamp(struct audit_context *ctx,
|
||||
struct timespec *t, unsigned int *serial);
|
||||
extern int audit_set_loginuid(struct task_struct *task, uid_t loginuid);
|
||||
extern uid_t audit_get_loginuid(struct audit_context *ctx);
|
||||
extern void audit_log_task_context(struct audit_buffer *ab);
|
||||
extern int __audit_ipc_obj(struct kern_ipc_perm *ipcp);
|
||||
extern int __audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode);
|
||||
extern int audit_bprm(struct linux_binprm *bprm);
|
||||
extern int audit_socketcall(int nargs, unsigned long *args);
|
||||
extern int audit_sockaddr(int len, void *addr);
|
||||
extern int __audit_fd_pair(int fd1, int fd2);
|
||||
extern int audit_avc_path(struct dentry *dentry, struct vfsmount *mnt);
|
||||
extern int audit_set_macxattr(const char *name);
|
||||
extern int __audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr);
|
||||
extern int __audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout);
|
||||
extern int __audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout);
|
||||
extern int __audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification);
|
||||
extern int __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat);
|
||||
|
||||
static inline int audit_ipc_obj(struct kern_ipc_perm *ipcp)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_ipc_obj(ipcp);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_fd_pair(int fd1, int fd2)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_fd_pair(fd1, fd2);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_ipc_set_perm(unsigned long qbytes, uid_t uid, gid_t gid, mode_t mode)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_ipc_set_perm(qbytes, uid, gid, mode);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_mq_open(int oflag, mode_t mode, struct mq_attr __user *u_attr)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_mq_open(oflag, mode, u_attr);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_mq_timedsend(mqd_t mqdes, size_t msg_len, unsigned int msg_prio, const struct timespec __user *u_abs_timeout)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_mq_timedsend(mqdes, msg_len, msg_prio, u_abs_timeout);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_mq_timedreceive(mqd_t mqdes, size_t msg_len, unsigned int __user *u_msg_prio, const struct timespec __user *u_abs_timeout)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_mq_timedreceive(mqdes, msg_len, u_msg_prio, u_abs_timeout);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_mq_notify(mqd_t mqdes, const struct sigevent __user *u_notification)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_mq_notify(mqdes, u_notification);
|
||||
return 0;
|
||||
}
|
||||
static inline int audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat)
|
||||
{
|
||||
if (unlikely(!audit_dummy_context()))
|
||||
return __audit_mq_getsetattr(mqdes, mqstat);
|
||||
return 0;
|
||||
}
|
||||
extern int audit_n_rules;
|
||||
#else
|
||||
#define audit_alloc(t) ({ 0; })
|
||||
#define audit_free(t) do { ; } while (0)
|
||||
#define audit_syscall_entry(ta,a,b,c,d,e) do { ; } while (0)
|
||||
#define audit_syscall_exit(f,r) do { ; } while (0)
|
||||
#define audit_dummy_context() 1
|
||||
#define audit_getname(n) do { ; } while (0)
|
||||
#define audit_putname(n) do { ; } while (0)
|
||||
#define __audit_inode(n,i) do { ; } while (0)
|
||||
#define __audit_inode_child(d,i,p) do { ; } while (0)
|
||||
#define __audit_inode_update(i) do { ; } while (0)
|
||||
#define audit_inode(n,i) do { ; } while (0)
|
||||
#define audit_inode_child(d,i,p) do { ; } while (0)
|
||||
#define audit_inode_update(i) do { ; } while (0)
|
||||
#define auditsc_get_stamp(c,t,s) do { BUG(); } while (0)
|
||||
#define audit_get_loginuid(c) ({ -1; })
|
||||
#define audit_log_task_context(b) do { ; } while (0)
|
||||
#define audit_ipc_obj(i) ({ 0; })
|
||||
#define audit_ipc_set_perm(q,u,g,m) ({ 0; })
|
||||
#define audit_bprm(p) ({ 0; })
|
||||
#define audit_socketcall(n,a) ({ 0; })
|
||||
#define audit_fd_pair(n,a) ({ 0; })
|
||||
#define audit_sockaddr(len, addr) ({ 0; })
|
||||
#define audit_avc_path(dentry, mnt) ({ 0; })
|
||||
#define audit_set_macxattr(n) do { ; } while (0)
|
||||
#define audit_mq_open(o,m,a) ({ 0; })
|
||||
#define audit_mq_timedsend(d,l,p,t) ({ 0; })
|
||||
#define audit_mq_timedreceive(d,l,p,t) ({ 0; })
|
||||
#define audit_mq_notify(d,n) ({ 0; })
|
||||
#define audit_mq_getsetattr(d,s) ({ 0; })
|
||||
#define audit_n_rules 0
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_AUDIT
|
||||
/* These are defined in audit.c */
|
||||
/* Public API */
|
||||
extern void audit_log(struct audit_context *ctx, gfp_t gfp_mask,
|
||||
int type, const char *fmt, ...)
|
||||
__attribute__((format(printf,4,5)));
|
||||
|
||||
extern struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask, int type);
|
||||
extern void audit_log_format(struct audit_buffer *ab,
|
||||
const char *fmt, ...)
|
||||
__attribute__((format(printf,2,3)));
|
||||
extern void audit_log_end(struct audit_buffer *ab);
|
||||
extern void audit_log_hex(struct audit_buffer *ab,
|
||||
const unsigned char *buf,
|
||||
size_t len);
|
||||
extern const char * audit_log_untrustedstring(struct audit_buffer *ab,
|
||||
const char *string);
|
||||
extern const char * audit_log_n_untrustedstring(struct audit_buffer *ab,
|
||||
size_t n,
|
||||
const char *string);
|
||||
extern void audit_log_d_path(struct audit_buffer *ab,
|
||||
const char *prefix,
|
||||
struct dentry *dentry,
|
||||
struct vfsmount *vfsmnt);
|
||||
/* Private API (for audit.c only) */
|
||||
extern int audit_filter_user(struct netlink_skb_parms *cb, int type);
|
||||
extern int audit_filter_type(int type);
|
||||
extern int audit_receive_filter(int type, int pid, int uid, int seq,
|
||||
void *data, size_t datasz, uid_t loginuid, u32 sid);
|
||||
#else
|
||||
#define audit_log(c,g,t,f,...) do { ; } while (0)
|
||||
#define audit_log_start(c,g,t) ({ NULL; })
|
||||
#define audit_log_vformat(b,f,a) do { ; } while (0)
|
||||
#define audit_log_format(b,f,...) do { ; } while (0)
|
||||
#define audit_log_end(b) do { ; } while (0)
|
||||
#define audit_log_hex(a,b,l) do { ; } while (0)
|
||||
#define audit_log_untrustedstring(a,s) do { ; } while (0)
|
||||
#define audit_log_n_untrustedstring(a,n,s) do { ; } while (0)
|
||||
#define audit_log_d_path(b,p,d,v) do { ; } while (0)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
84
include/linux/auto_fs.h
Normal file
84
include/linux/auto_fs.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/* -*- linux-c -*- ------------------------------------------------------- *
|
||||
*
|
||||
* linux/include/linux/auto_fs.h
|
||||
*
|
||||
* Copyright 1997 Transmeta Corporation - All Rights Reserved
|
||||
*
|
||||
* This file is part of the Linux kernel and is made available under
|
||||
* the terms of the GNU General Public License, version 2, or at your
|
||||
* option, any later version, incorporated herein by reference.
|
||||
*
|
||||
* ----------------------------------------------------------------------- */
|
||||
|
||||
|
||||
#ifndef _LINUX_AUTO_FS_H
|
||||
#define _LINUX_AUTO_FS_H
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#include <linux/fs.h>
|
||||
#include <linux/limits.h>
|
||||
#include <asm/types.h>
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
/* This file describes autofs v3 */
|
||||
#define AUTOFS_PROTO_VERSION 3
|
||||
|
||||
/* Range of protocol versions defined */
|
||||
#define AUTOFS_MAX_PROTO_VERSION AUTOFS_PROTO_VERSION
|
||||
#define AUTOFS_MIN_PROTO_VERSION AUTOFS_PROTO_VERSION
|
||||
|
||||
/*
|
||||
* Architectures where both 32- and 64-bit binaries can be executed
|
||||
* on 64-bit kernels need this. This keeps the structure format
|
||||
* uniform, and makes sure the wait_queue_token isn't too big to be
|
||||
* passed back down to the kernel.
|
||||
*
|
||||
* This assumes that on these architectures:
|
||||
* mode 32 bit 64 bit
|
||||
* -------------------------
|
||||
* int 32 bit 32 bit
|
||||
* long 32 bit 64 bit
|
||||
*
|
||||
* If so, 32-bit user-space code should be backwards compatible.
|
||||
*/
|
||||
|
||||
#if defined(__sparc__) || defined(__mips__) || defined(__x86_64__) \
|
||||
|| defined(__powerpc__) || defined(__s390__)
|
||||
typedef unsigned int autofs_wqt_t;
|
||||
#else
|
||||
typedef unsigned long autofs_wqt_t;
|
||||
#endif
|
||||
|
||||
/* Packet types */
|
||||
#define autofs_ptype_missing 0 /* Missing entry (mount request) */
|
||||
#define autofs_ptype_expire 1 /* Expire entry (umount request) */
|
||||
|
||||
struct autofs_packet_hdr {
|
||||
int proto_version; /* Protocol version */
|
||||
int type; /* Type of packet */
|
||||
};
|
||||
|
||||
struct autofs_packet_missing {
|
||||
struct autofs_packet_hdr hdr;
|
||||
autofs_wqt_t wait_queue_token;
|
||||
int len;
|
||||
char name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
/* v3 expire (via ioctl) */
|
||||
struct autofs_packet_expire {
|
||||
struct autofs_packet_hdr hdr;
|
||||
int len;
|
||||
char name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
#define AUTOFS_IOC_READY _IO(0x93,0x60)
|
||||
#define AUTOFS_IOC_FAIL _IO(0x93,0x61)
|
||||
#define AUTOFS_IOC_CATATONIC _IO(0x93,0x62)
|
||||
#define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int)
|
||||
#define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long)
|
||||
#define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire)
|
||||
|
||||
#endif /* _LINUX_AUTO_FS_H */
|
||||
106
include/linux/auto_fs4.h
Normal file
106
include/linux/auto_fs4.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/* -*- c -*-
|
||||
* linux/include/linux/auto_fs4.h
|
||||
*
|
||||
* Copyright 1999-2000 Jeremy Fitzhardinge <jeremy@goop.org>
|
||||
*
|
||||
* This file is part of the Linux kernel and is made available under
|
||||
* the terms of the GNU General Public License, version 2, or at your
|
||||
* option, any later version, incorporated herein by reference.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_AUTO_FS4_H
|
||||
#define _LINUX_AUTO_FS4_H
|
||||
|
||||
/* Include common v3 definitions */
|
||||
#include <linux/auto_fs.h>
|
||||
|
||||
/* autofs v4 definitions */
|
||||
#undef AUTOFS_PROTO_VERSION
|
||||
#undef AUTOFS_MIN_PROTO_VERSION
|
||||
#undef AUTOFS_MAX_PROTO_VERSION
|
||||
|
||||
#define AUTOFS_PROTO_VERSION 5
|
||||
#define AUTOFS_MIN_PROTO_VERSION 3
|
||||
#define AUTOFS_MAX_PROTO_VERSION 5
|
||||
|
||||
#define AUTOFS_PROTO_SUBVERSION 0
|
||||
|
||||
/* Mask for expire behaviour */
|
||||
#define AUTOFS_EXP_IMMEDIATE 1
|
||||
#define AUTOFS_EXP_LEAVES 2
|
||||
|
||||
/* Daemon notification packet types */
|
||||
enum autofs_notify {
|
||||
NFY_NONE,
|
||||
NFY_MOUNT,
|
||||
NFY_EXPIRE
|
||||
};
|
||||
|
||||
/* Kernel protocol version 4 packet types */
|
||||
|
||||
/* Expire entry (umount request) */
|
||||
#define autofs_ptype_expire_multi 2
|
||||
|
||||
/* Kernel protocol version 5 packet types */
|
||||
|
||||
/* Indirect mount missing and expire requests. */
|
||||
#define autofs_ptype_missing_indirect 3
|
||||
#define autofs_ptype_expire_indirect 4
|
||||
|
||||
/* Direct mount missing and expire requests */
|
||||
#define autofs_ptype_missing_direct 5
|
||||
#define autofs_ptype_expire_direct 6
|
||||
|
||||
/* v4 multi expire (via pipe) */
|
||||
struct autofs_packet_expire_multi {
|
||||
struct autofs_packet_hdr hdr;
|
||||
autofs_wqt_t wait_queue_token;
|
||||
int len;
|
||||
char name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
union autofs_packet_union {
|
||||
struct autofs_packet_hdr hdr;
|
||||
struct autofs_packet_missing missing;
|
||||
struct autofs_packet_expire expire;
|
||||
struct autofs_packet_expire_multi expire_multi;
|
||||
};
|
||||
|
||||
/* autofs v5 common packet struct */
|
||||
struct autofs_v5_packet {
|
||||
struct autofs_packet_hdr hdr;
|
||||
autofs_wqt_t wait_queue_token;
|
||||
__u32 dev;
|
||||
__u64 ino;
|
||||
__u32 uid;
|
||||
__u32 gid;
|
||||
__u32 pid;
|
||||
__u32 tgid;
|
||||
__u32 len;
|
||||
char name[NAME_MAX+1];
|
||||
};
|
||||
|
||||
typedef struct autofs_v5_packet autofs_packet_missing_indirect_t;
|
||||
typedef struct autofs_v5_packet autofs_packet_expire_indirect_t;
|
||||
typedef struct autofs_v5_packet autofs_packet_missing_direct_t;
|
||||
typedef struct autofs_v5_packet autofs_packet_expire_direct_t;
|
||||
|
||||
union autofs_v5_packet_union {
|
||||
struct autofs_packet_hdr hdr;
|
||||
struct autofs_v5_packet v5_packet;
|
||||
autofs_packet_missing_indirect_t missing_indirect;
|
||||
autofs_packet_expire_indirect_t expire_indirect;
|
||||
autofs_packet_missing_direct_t missing_direct;
|
||||
autofs_packet_expire_direct_t expire_direct;
|
||||
};
|
||||
|
||||
#define AUTOFS_IOC_EXPIRE_MULTI _IOW(0x93,0x66,int)
|
||||
#define AUTOFS_IOC_EXPIRE_INDIRECT AUTOFS_IOC_EXPIRE_MULTI
|
||||
#define AUTOFS_IOC_EXPIRE_DIRECT AUTOFS_IOC_EXPIRE_MULTI
|
||||
#define AUTOFS_IOC_PROTOSUBVER _IOR(0x93,0x67,int)
|
||||
#define AUTOFS_IOC_ASKREGHOST _IOR(0x93,0x68,int)
|
||||
#define AUTOFS_IOC_TOGGLEREGHOST _IOR(0x93,0x69,int)
|
||||
#define AUTOFS_IOC_ASKUMOUNT _IOR(0x93,0x70,int)
|
||||
|
||||
|
||||
#endif /* _LINUX_AUTO_FS4_H */
|
||||
31
include/linux/auxvec.h
Normal file
31
include/linux/auxvec.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef _LINUX_AUXVEC_H
|
||||
#define _LINUX_AUXVEC_H
|
||||
|
||||
#include <asm/auxvec.h>
|
||||
|
||||
/* Symbolic values for the entries in the auxiliary table
|
||||
put on the initial stack */
|
||||
#define AT_NULL 0 /* end of vector */
|
||||
#define AT_IGNORE 1 /* entry should be ignored */
|
||||
#define AT_EXECFD 2 /* file descriptor of program */
|
||||
#define AT_PHDR 3 /* program headers for program */
|
||||
#define AT_PHENT 4 /* size of program header entry */
|
||||
#define AT_PHNUM 5 /* number of program headers */
|
||||
#define AT_PAGESZ 6 /* system page size */
|
||||
#define AT_BASE 7 /* base address of interpreter */
|
||||
#define AT_FLAGS 8 /* flags */
|
||||
#define AT_ENTRY 9 /* entry point of program */
|
||||
#define AT_NOTELF 10 /* program is not ELF */
|
||||
#define AT_UID 11 /* real uid */
|
||||
#define AT_EUID 12 /* effective uid */
|
||||
#define AT_GID 13 /* real gid */
|
||||
#define AT_EGID 14 /* effective gid */
|
||||
#define AT_PLATFORM 15 /* string identifying CPU for optimizations */
|
||||
#define AT_HWCAP 16 /* arch dependent hints at CPU capabilities */
|
||||
#define AT_CLKTCK 17 /* frequency at which times() increments */
|
||||
|
||||
#define AT_SECURE 23 /* secure mode boolean */
|
||||
|
||||
#define AT_VECTOR_SIZE 44 /* Size of auxiliary table. */
|
||||
|
||||
#endif /* _LINUX_AUXVEC_H */
|
||||
525
include/linux/awe_voice.h
Normal file
525
include/linux/awe_voice.h
Normal file
@@ -0,0 +1,525 @@
|
||||
/*
|
||||
* include/linux/awe_voice.h
|
||||
*
|
||||
* Voice information definitions for the low level driver for the
|
||||
* AWE32/SB32/AWE64 wave table synth.
|
||||
* version 0.4.4; Jan. 4, 2000
|
||||
*
|
||||
* Copyright (C) 1996-2000 Takashi Iwai
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef AWE_VOICE_H
|
||||
#define AWE_VOICE_H
|
||||
|
||||
#ifndef SAMPLE_TYPE_AWE32
|
||||
#define SAMPLE_TYPE_AWE32 0x20
|
||||
#endif
|
||||
|
||||
#define _LINUX_PATCHKEY_H_INDIRECT
|
||||
#include <linux/patchkey.h>
|
||||
#undef _LINUX_PATCHKEY_H_INDIRECT
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* patch information record
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
/* patch interface header: 16 bytes */
|
||||
typedef struct awe_patch_info {
|
||||
short key; /* use AWE_PATCH here */
|
||||
#define AWE_PATCH _PATCHKEY(0x07)
|
||||
|
||||
short device_no; /* synthesizer number */
|
||||
unsigned short sf_id; /* file id (should be zero) */
|
||||
short optarg; /* optional argument */
|
||||
int len; /* data length (without this header) */
|
||||
|
||||
short type; /* patch operation type */
|
||||
#define AWE_LOAD_INFO 0 /* awe_voice_rec */
|
||||
#define AWE_LOAD_DATA 1 /* awe_sample_info */
|
||||
#define AWE_OPEN_PATCH 2 /* awe_open_parm */
|
||||
#define AWE_CLOSE_PATCH 3 /* none */
|
||||
#define AWE_UNLOAD_PATCH 4 /* none */
|
||||
#define AWE_REPLACE_DATA 5 /* awe_sample_info (optarg=#channels)*/
|
||||
#define AWE_MAP_PRESET 6 /* awe_voice_map */
|
||||
/*#define AWE_PROBE_INFO 7*/ /* awe_voice_map (pat only) */
|
||||
#define AWE_PROBE_DATA 8 /* optarg=sample */
|
||||
#define AWE_REMOVE_INFO 9 /* optarg=(bank<<8)|instr */
|
||||
#define AWE_LOAD_CHORUS_FX 0x10 /* awe_chorus_fx_rec (optarg=mode) */
|
||||
#define AWE_LOAD_REVERB_FX 0x11 /* awe_reverb_fx_rec (optarg=mode) */
|
||||
|
||||
short reserved; /* word alignment data */
|
||||
|
||||
/* the actual patch data begins after this */
|
||||
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
|
||||
char data[0];
|
||||
#endif
|
||||
} awe_patch_info;
|
||||
|
||||
/*#define AWE_PATCH_INFO_SIZE 16*/
|
||||
#define AWE_PATCH_INFO_SIZE sizeof(awe_patch_info)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* open patch
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
#define AWE_PATCH_NAME_LEN 32
|
||||
|
||||
typedef struct _awe_open_parm {
|
||||
unsigned short type; /* sample type */
|
||||
#define AWE_PAT_TYPE_MISC 0
|
||||
#define AWE_PAT_TYPE_GM 1
|
||||
#define AWE_PAT_TYPE_GS 2
|
||||
#define AWE_PAT_TYPE_MT32 3
|
||||
#define AWE_PAT_TYPE_XG 4
|
||||
#define AWE_PAT_TYPE_SFX 5
|
||||
#define AWE_PAT_TYPE_GUS 6
|
||||
#define AWE_PAT_TYPE_MAP 7
|
||||
|
||||
#define AWE_PAT_LOCKED 0x100 /* lock the samples */
|
||||
#define AWE_PAT_SHARED 0x200 /* sample is shared */
|
||||
|
||||
short reserved;
|
||||
char name[AWE_PATCH_NAME_LEN];
|
||||
} awe_open_parm;
|
||||
|
||||
/*#define AWE_OPEN_PARM_SIZE 28*/
|
||||
#define AWE_OPEN_PARM_SIZE sizeof(awe_open_parm)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* raw voice information record
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
/* wave table envelope & effect parameters to control EMU8000 */
|
||||
typedef struct _awe_voice_parm {
|
||||
unsigned short moddelay; /* modulation delay (0x8000) */
|
||||
unsigned short modatkhld; /* modulation attack & hold time (0x7f7f) */
|
||||
unsigned short moddcysus; /* modulation decay & sustain (0x7f7f) */
|
||||
unsigned short modrelease; /* modulation release time (0x807f) */
|
||||
short modkeyhold, modkeydecay; /* envelope change per key (not used) */
|
||||
unsigned short voldelay; /* volume delay (0x8000) */
|
||||
unsigned short volatkhld; /* volume attack & hold time (0x7f7f) */
|
||||
unsigned short voldcysus; /* volume decay & sustain (0x7f7f) */
|
||||
unsigned short volrelease; /* volume release time (0x807f) */
|
||||
short volkeyhold, volkeydecay; /* envelope change per key (not used) */
|
||||
unsigned short lfo1delay; /* LFO1 delay (0x8000) */
|
||||
unsigned short lfo2delay; /* LFO2 delay (0x8000) */
|
||||
unsigned short pefe; /* modulation pitch & cutoff (0x0000) */
|
||||
unsigned short fmmod; /* LFO1 pitch & cutoff (0x0000) */
|
||||
unsigned short tremfrq; /* LFO1 volume & freq (0x0000) */
|
||||
unsigned short fm2frq2; /* LFO2 pitch & freq (0x0000) */
|
||||
unsigned char cutoff; /* initial cutoff (0xff) */
|
||||
unsigned char filterQ; /* initial filter Q [0-15] (0x0) */
|
||||
unsigned char chorus; /* chorus send (0x00) */
|
||||
unsigned char reverb; /* reverb send (0x00) */
|
||||
unsigned short reserved[4]; /* not used */
|
||||
} awe_voice_parm;
|
||||
|
||||
typedef struct _awe_voice_parm_block {
|
||||
unsigned short moddelay; /* modulation delay (0x8000) */
|
||||
unsigned char modatk, modhld;
|
||||
unsigned char moddcy, modsus;
|
||||
unsigned char modrel, moddummy;
|
||||
short modkeyhold, modkeydecay; /* envelope change per key (not used) */
|
||||
unsigned short voldelay; /* volume delay (0x8000) */
|
||||
unsigned char volatk, volhld;
|
||||
unsigned char voldcy, volsus;
|
||||
unsigned char volrel, voldummy;
|
||||
short volkeyhold, volkeydecay; /* envelope change per key (not used) */
|
||||
unsigned short lfo1delay; /* LFO1 delay (0x8000) */
|
||||
unsigned short lfo2delay; /* LFO2 delay (0x8000) */
|
||||
unsigned char env1fc, env1pit;
|
||||
unsigned char lfo1fc, lfo1pit;
|
||||
unsigned char lfo1freq, lfo1vol;
|
||||
unsigned char lfo2freq, lfo2pit;
|
||||
unsigned char cutoff; /* initial cutoff (0xff) */
|
||||
unsigned char filterQ; /* initial filter Q [0-15] (0x0) */
|
||||
unsigned char chorus; /* chorus send (0x00) */
|
||||
unsigned char reverb; /* reverb send (0x00) */
|
||||
unsigned short reserved[4]; /* not used */
|
||||
} awe_voice_parm_block;
|
||||
|
||||
#define AWE_VOICE_PARM_SIZE 48
|
||||
|
||||
|
||||
/* wave table parameters: 92 bytes */
|
||||
typedef struct _awe_voice_info {
|
||||
unsigned short sf_id; /* file id (should be zero) */
|
||||
unsigned short sample; /* sample id */
|
||||
int start, end; /* sample offset correction */
|
||||
int loopstart, loopend; /* loop offset correction */
|
||||
short rate_offset; /* sample rate pitch offset */
|
||||
unsigned short mode; /* sample mode */
|
||||
#define AWE_MODE_ROMSOUND 0x8000
|
||||
#define AWE_MODE_STEREO 1
|
||||
#define AWE_MODE_LOOPING 2
|
||||
#define AWE_MODE_NORELEASE 4 /* obsolete */
|
||||
#define AWE_MODE_INIT_PARM 8
|
||||
|
||||
short root; /* midi root key */
|
||||
short tune; /* pitch tuning (in cents) */
|
||||
signed char low, high; /* key note range */
|
||||
signed char vellow, velhigh; /* velocity range */
|
||||
signed char fixkey, fixvel; /* fixed key, velocity */
|
||||
signed char pan, fixpan; /* panning, fixed panning */
|
||||
short exclusiveClass; /* exclusive class (0 = none) */
|
||||
unsigned char amplitude; /* sample volume (127 max) */
|
||||
unsigned char attenuation; /* attenuation (0.375dB) */
|
||||
short scaleTuning; /* pitch scale tuning(%), normally 100 */
|
||||
awe_voice_parm parm; /* voice envelope parameters */
|
||||
short index; /* internal index (set by driver) */
|
||||
} awe_voice_info;
|
||||
|
||||
/*#define AWE_VOICE_INFO_SIZE 92*/
|
||||
#define AWE_VOICE_INFO_SIZE sizeof(awe_voice_info)
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* The info entry of awe_voice_rec is changed from 0 to 1
|
||||
* for some compilers refusing zero size array.
|
||||
* Due to this change, sizeof(awe_voice_rec) becomes different
|
||||
* from older versions.
|
||||
* Use AWE_VOICE_REC_SIZE instead.
|
||||
*/
|
||||
|
||||
/* instrument info header: 4 bytes */
|
||||
typedef struct _awe_voice_rec_hdr {
|
||||
unsigned char bank; /* midi bank number */
|
||||
unsigned char instr; /* midi preset number */
|
||||
char nvoices; /* number of voices */
|
||||
char write_mode; /* write mode; normally 0 */
|
||||
#define AWE_WR_APPEND 0 /* append anyway */
|
||||
#define AWE_WR_EXCLUSIVE 1 /* skip if already exists */
|
||||
#define AWE_WR_REPLACE 2 /* replace if already exists */
|
||||
} awe_voice_rec_hdr;
|
||||
|
||||
/*#define AWE_VOICE_REC_SIZE 4*/
|
||||
#define AWE_VOICE_REC_SIZE sizeof(awe_voice_rec_hdr)
|
||||
|
||||
/* the standard patch structure for one sample */
|
||||
typedef struct _awe_voice_rec_patch {
|
||||
awe_patch_info patch;
|
||||
awe_voice_rec_hdr hdr;
|
||||
awe_voice_info info;
|
||||
} awe_voice_rec_patch;
|
||||
|
||||
|
||||
/* obsolete data type */
|
||||
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
|
||||
#define AWE_INFOARRAY_SIZE 0
|
||||
#else
|
||||
#define AWE_INFOARRAY_SIZE 1
|
||||
#endif
|
||||
|
||||
typedef struct _awe_voice_rec {
|
||||
unsigned char bank; /* midi bank number */
|
||||
unsigned char instr; /* midi preset number */
|
||||
short nvoices; /* number of voices */
|
||||
/* voice information follows here */
|
||||
awe_voice_info info[AWE_INFOARRAY_SIZE];
|
||||
} awe_voice_rec;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* sample wave information
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
/* wave table sample header: 32 bytes */
|
||||
typedef struct awe_sample_info {
|
||||
unsigned short sf_id; /* file id (should be zero) */
|
||||
unsigned short sample; /* sample id */
|
||||
int start, end; /* start & end offset */
|
||||
int loopstart, loopend; /* loop start & end offset */
|
||||
int size; /* size (0 = ROM) */
|
||||
short checksum_flag; /* use check sum = 1 */
|
||||
unsigned short mode_flags; /* mode flags */
|
||||
#define AWE_SAMPLE_8BITS 1 /* wave data is 8bits */
|
||||
#define AWE_SAMPLE_UNSIGNED 2 /* wave data is unsigned */
|
||||
#define AWE_SAMPLE_NO_BLANK 4 /* no blank loop is attached */
|
||||
#define AWE_SAMPLE_SINGLESHOT 8 /* single-shot w/o loop */
|
||||
#define AWE_SAMPLE_BIDIR_LOOP 16 /* bidirectional looping */
|
||||
#define AWE_SAMPLE_STEREO_LEFT 32 /* stereo left sound */
|
||||
#define AWE_SAMPLE_STEREO_RIGHT 64 /* stereo right sound */
|
||||
#define AWE_SAMPLE_REVERSE_LOOP 128 /* reverse looping */
|
||||
unsigned int checksum; /* check sum */
|
||||
#if defined(AWE_COMPAT_030) && AWE_COMPAT_030
|
||||
unsigned short data[0]; /* sample data follows here */
|
||||
#endif
|
||||
} awe_sample_info;
|
||||
|
||||
/*#define AWE_SAMPLE_INFO_SIZE 32*/
|
||||
#define AWE_SAMPLE_INFO_SIZE sizeof(awe_sample_info)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* voice preset mapping
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
typedef struct awe_voice_map {
|
||||
int map_bank, map_instr, map_key; /* key = -1 means all keys */
|
||||
int src_bank, src_instr, src_key;
|
||||
} awe_voice_map;
|
||||
|
||||
#define AWE_VOICE_MAP_SIZE sizeof(awe_voice_map)
|
||||
|
||||
|
||||
/*----------------------------------------------------------------
|
||||
* awe hardware controls
|
||||
*----------------------------------------------------------------*/
|
||||
|
||||
#define _AWE_DEBUG_MODE 0x00
|
||||
#define _AWE_REVERB_MODE 0x01
|
||||
#define _AWE_CHORUS_MODE 0x02
|
||||
#define _AWE_REMOVE_LAST_SAMPLES 0x03
|
||||
#define _AWE_INITIALIZE_CHIP 0x04
|
||||
#define _AWE_SEND_EFFECT 0x05
|
||||
#define _AWE_TERMINATE_CHANNEL 0x06
|
||||
#define _AWE_TERMINATE_ALL 0x07
|
||||
#define _AWE_INITIAL_VOLUME 0x08
|
||||
#define _AWE_INITIAL_ATTEN _AWE_INITIAL_VOLUME
|
||||
#define _AWE_RESET_CHANNEL 0x09
|
||||
#define _AWE_CHANNEL_MODE 0x0a
|
||||
#define _AWE_DRUM_CHANNELS 0x0b
|
||||
#define _AWE_MISC_MODE 0x0c
|
||||
#define _AWE_RELEASE_ALL 0x0d
|
||||
#define _AWE_NOTEOFF_ALL 0x0e
|
||||
#define _AWE_CHN_PRESSURE 0x0f
|
||||
/*#define _AWE_GET_CURRENT_MODE 0x10*/
|
||||
#define _AWE_EQUALIZER 0x11
|
||||
/*#define _AWE_GET_MISC_MODE 0x12*/
|
||||
/*#define _AWE_GET_FONTINFO 0x13*/
|
||||
|
||||
#define _AWE_MODE_FLAG 0x80
|
||||
#define _AWE_COOKED_FLAG 0x40 /* not supported */
|
||||
#define _AWE_MODE_VALUE_MASK 0x3F
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
#define _AWE_SET_CMD(p,dev,voice,cmd,p1,p2) \
|
||||
{((char*)(p))[0] = SEQ_PRIVATE;\
|
||||
((char*)(p))[1] = dev;\
|
||||
((char*)(p))[2] = _AWE_MODE_FLAG|(cmd);\
|
||||
((char*)(p))[3] = voice;\
|
||||
((unsigned short*)(p))[2] = p1;\
|
||||
((unsigned short*)(p))[3] = p2;}
|
||||
|
||||
/* buffered access */
|
||||
#define _AWE_CMD(dev, voice, cmd, p1, p2) \
|
||||
{_SEQ_NEEDBUF(8);\
|
||||
_AWE_SET_CMD(_seqbuf + _seqbufptr, dev, voice, cmd, p1, p2);\
|
||||
_SEQ_ADVBUF(8);}
|
||||
|
||||
/* direct access */
|
||||
#define _AWE_CMD_NOW(seqfd,dev,voice,cmd,p1,p2) \
|
||||
{struct seq_event_rec tmp;\
|
||||
_AWE_SET_CMD(&tmp, dev, voice, cmd, p1, p2);\
|
||||
ioctl(seqfd, SNDCTL_SEQ_OUTOFBAND, &tmp);}
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* set debugging mode */
|
||||
#define AWE_DEBUG_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_DEBUG_MODE, p1, 0)
|
||||
/* set reverb mode; from 0 to 7 */
|
||||
#define AWE_REVERB_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_REVERB_MODE, p1, 0)
|
||||
/* set chorus mode; from 0 to 7 */
|
||||
#define AWE_CHORUS_MODE(dev,p1) _AWE_CMD(dev, 0, _AWE_CHORUS_MODE, p1, 0)
|
||||
|
||||
/* reset channel */
|
||||
#define AWE_RESET_CHANNEL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 0, 0)
|
||||
#define AWE_RESET_CONTROL(dev,ch) _AWE_CMD(dev, ch, _AWE_RESET_CHANNEL, 1, 0)
|
||||
|
||||
/* send an effect to all layers */
|
||||
#define AWE_SEND_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,type,value)
|
||||
#define AWE_ADD_EFFECT(dev,voice,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x80),value)
|
||||
#define AWE_UNSET_EFFECT(dev,voice,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((type)|0x40),0)
|
||||
/* send an effect to a layer */
|
||||
#define AWE_SEND_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)),value)
|
||||
#define AWE_ADD_LAYER_EFFECT(dev,voice,layer,type,value) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x80),value)
|
||||
#define AWE_UNSET_LAYER_EFFECT(dev,voice,layer,type) _AWE_CMD(dev,voice,_AWE_SEND_EFFECT,((layer+1)<<8|(type)|0x40),0)
|
||||
|
||||
/* terminate sound on the channel/voice */
|
||||
#define AWE_TERMINATE_CHANNEL(dev,voice) _AWE_CMD(dev,voice,_AWE_TERMINATE_CHANNEL,0,0)
|
||||
/* terminate all sounds */
|
||||
#define AWE_TERMINATE_ALL(dev) _AWE_CMD(dev, 0, _AWE_TERMINATE_ALL, 0, 0)
|
||||
/* release all sounds (w/o sustain effect) */
|
||||
#define AWE_RELEASE_ALL(dev) _AWE_CMD(dev, 0, _AWE_RELEASE_ALL, 0, 0)
|
||||
/* note off all sounds (w sustain effect) */
|
||||
#define AWE_NOTEOFF_ALL(dev) _AWE_CMD(dev, 0, _AWE_NOTEOFF_ALL, 0, 0)
|
||||
|
||||
/* set initial attenuation */
|
||||
#define AWE_INITIAL_VOLUME(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 0)
|
||||
#define AWE_INITIAL_ATTEN AWE_INITIAL_VOLUME
|
||||
/* relative attenuation */
|
||||
#define AWE_SET_ATTEN(dev,atten) _AWE_CMD(dev, 0, _AWE_INITIAL_VOLUME, atten, 1)
|
||||
|
||||
/* set channel playing mode; mode=0/1/2 */
|
||||
#define AWE_SET_CHANNEL_MODE(dev,mode) _AWE_CMD(dev, 0, _AWE_CHANNEL_MODE, mode, 0)
|
||||
#define AWE_PLAY_INDIRECT 0 /* indirect voice mode (default) */
|
||||
#define AWE_PLAY_MULTI 1 /* multi note voice mode */
|
||||
#define AWE_PLAY_DIRECT 2 /* direct single voice mode */
|
||||
#define AWE_PLAY_MULTI2 3 /* sequencer2 mode; used internally */
|
||||
|
||||
/* set drum channel mask; channels is 32bit long value */
|
||||
#define AWE_DRUM_CHANNELS(dev,channels) _AWE_CMD(dev, 0, _AWE_DRUM_CHANNELS, ((channels) & 0xffff), ((channels) >> 16))
|
||||
|
||||
/* set bass and treble control; values are from 0 to 11 */
|
||||
#define AWE_EQUALIZER(dev,bass,treble) _AWE_CMD(dev, 0, _AWE_EQUALIZER, bass, treble)
|
||||
|
||||
/* remove last loaded samples */
|
||||
#define AWE_REMOVE_LAST_SAMPLES(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_REMOVE_LAST_SAMPLES, 0, 0)
|
||||
/* initialize emu8000 chip */
|
||||
#define AWE_INITIALIZE_CHIP(seqfd,dev) _AWE_CMD_NOW(seqfd, dev, 0, _AWE_INITIALIZE_CHIP, 0, 0)
|
||||
|
||||
/* set miscellaneous modes; meta command */
|
||||
#define AWE_MISC_MODE(dev,mode,value) _AWE_CMD(dev, 0, _AWE_MISC_MODE, mode, value)
|
||||
/* exclusive sound off; 1=off */
|
||||
#define AWE_EXCLUSIVE_SOUND(dev,mode) AWE_MISC_MODE(dev,AWE_MD_EXCLUSIVE_SOUND,mode)
|
||||
/* default GUS bank number */
|
||||
#define AWE_SET_GUS_BANK(dev,bank) AWE_MISC_MODE(dev,AWE_MD_GUS_BANK,bank)
|
||||
/* change panning position in realtime; 0=don't 1=do */
|
||||
#define AWE_REALTIME_PAN(dev,mode) AWE_MISC_MODE(dev,AWE_MD_REALTIME_PAN,mode)
|
||||
|
||||
/* extended pressure controls; not portable with other sound drivers */
|
||||
#define AWE_KEY_PRESSURE(dev,ch,note,vel) SEQ_START_NOTE(dev,ch,(note)+128,vel)
|
||||
#define AWE_CHN_PRESSURE(dev,ch,vel) _AWE_CMD(dev,ch,_AWE_CHN_PRESSURE,vel,0)
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* reverb mode parameters */
|
||||
#define AWE_REVERB_ROOM1 0
|
||||
#define AWE_REVERB_ROOM2 1
|
||||
#define AWE_REVERB_ROOM3 2
|
||||
#define AWE_REVERB_HALL1 3
|
||||
#define AWE_REVERB_HALL2 4
|
||||
#define AWE_REVERB_PLATE 5
|
||||
#define AWE_REVERB_DELAY 6
|
||||
#define AWE_REVERB_PANNINGDELAY 7
|
||||
#define AWE_REVERB_PREDEFINED 8
|
||||
/* user can define reverb modes up to 32 */
|
||||
#define AWE_REVERB_NUMBERS 32
|
||||
|
||||
typedef struct awe_reverb_fx_rec {
|
||||
unsigned short parms[28];
|
||||
} awe_reverb_fx_rec;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* chorus mode parameters */
|
||||
#define AWE_CHORUS_1 0
|
||||
#define AWE_CHORUS_2 1
|
||||
#define AWE_CHORUS_3 2
|
||||
#define AWE_CHORUS_4 3
|
||||
#define AWE_CHORUS_FEEDBACK 4
|
||||
#define AWE_CHORUS_FLANGER 5
|
||||
#define AWE_CHORUS_SHORTDELAY 6
|
||||
#define AWE_CHORUS_SHORTDELAY2 7
|
||||
#define AWE_CHORUS_PREDEFINED 8
|
||||
/* user can define chorus modes up to 32 */
|
||||
#define AWE_CHORUS_NUMBERS 32
|
||||
|
||||
typedef struct awe_chorus_fx_rec {
|
||||
unsigned short feedback; /* feedback level (0xE600-0xE6FF) */
|
||||
unsigned short delay_offset; /* delay (0-0x0DA3) [1/44100 sec] */
|
||||
unsigned short lfo_depth; /* LFO depth (0xBC00-0xBCFF) */
|
||||
unsigned int delay; /* right delay (0-0xFFFFFFFF) [1/256/44100 sec] */
|
||||
unsigned int lfo_freq; /* LFO freq LFO freq (0-0xFFFFFFFF) */
|
||||
} awe_chorus_fx_rec;
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* misc mode types */
|
||||
enum {
|
||||
/* 0*/ AWE_MD_EXCLUSIVE_OFF, /* obsolete */
|
||||
/* 1*/ AWE_MD_EXCLUSIVE_ON, /* obsolete */
|
||||
/* 2*/ AWE_MD_VERSION, /* read only */
|
||||
/* 3*/ AWE_MD_EXCLUSIVE_SOUND, /* 0/1: exclusive note on (default=1) */
|
||||
/* 4*/ AWE_MD_REALTIME_PAN, /* 0/1: do realtime pan change (default=1) */
|
||||
/* 5*/ AWE_MD_GUS_BANK, /* bank number for GUS patches (default=0) */
|
||||
/* 6*/ AWE_MD_KEEP_EFFECT, /* 0/1: keep effect values, (default=0) */
|
||||
/* 7*/ AWE_MD_ZERO_ATTEN, /* attenuation of max volume (default=32) */
|
||||
/* 8*/ AWE_MD_CHN_PRIOR, /* 0/1: set MIDI channel priority mode (default=1) */
|
||||
/* 9*/ AWE_MD_MOD_SENSE, /* integer: modwheel sensitivity (def=18) */
|
||||
/*10*/ AWE_MD_DEF_PRESET, /* integer: default preset number (def=0) */
|
||||
/*11*/ AWE_MD_DEF_BANK, /* integer: default bank number (def=0) */
|
||||
/*12*/ AWE_MD_DEF_DRUM, /* integer: default drumset number (def=0) */
|
||||
/*13*/ AWE_MD_TOGGLE_DRUM_BANK, /* 0/1: toggle drum flag with bank# (def=0) */
|
||||
/*14*/ AWE_MD_NEW_VOLUME_CALC, /* 0/1: volume calculation mode (def=1) */
|
||||
/*15*/ AWE_MD_CHORUS_MODE, /* integer: chorus mode (def=2) */
|
||||
/*16*/ AWE_MD_REVERB_MODE, /* integer: chorus mode (def=4) */
|
||||
/*17*/ AWE_MD_BASS_LEVEL, /* integer: bass level (def=5) */
|
||||
/*18*/ AWE_MD_TREBLE_LEVEL, /* integer: treble level (def=9) */
|
||||
/*19*/ AWE_MD_DEBUG_MODE, /* integer: debug level (def=0) */
|
||||
/*20*/ AWE_MD_PAN_EXCHANGE, /* 0/1: exchange panning direction (def=0) */
|
||||
AWE_MD_END,
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
/* effect parameters */
|
||||
enum {
|
||||
|
||||
/* modulation envelope parameters */
|
||||
/* 0*/ AWE_FX_ENV1_DELAY, /* WORD: ENVVAL */
|
||||
/* 1*/ AWE_FX_ENV1_ATTACK, /* BYTE: up ATKHLD */
|
||||
/* 2*/ AWE_FX_ENV1_HOLD, /* BYTE: lw ATKHLD */
|
||||
/* 3*/ AWE_FX_ENV1_DECAY, /* BYTE: lw DCYSUS */
|
||||
/* 4*/ AWE_FX_ENV1_RELEASE, /* BYTE: lw DCYSUS */
|
||||
/* 5*/ AWE_FX_ENV1_SUSTAIN, /* BYTE: up DCYSUS */
|
||||
/* 6*/ AWE_FX_ENV1_PITCH, /* BYTE: up PEFE */
|
||||
/* 7*/ AWE_FX_ENV1_CUTOFF, /* BYTE: lw PEFE */
|
||||
|
||||
/* volume envelope parameters */
|
||||
/* 8*/ AWE_FX_ENV2_DELAY, /* WORD: ENVVOL */
|
||||
/* 9*/ AWE_FX_ENV2_ATTACK, /* BYTE: up ATKHLDV */
|
||||
/*10*/ AWE_FX_ENV2_HOLD, /* BYTE: lw ATKHLDV */
|
||||
/*11*/ AWE_FX_ENV2_DECAY, /* BYTE: lw DCYSUSV */
|
||||
/*12*/ AWE_FX_ENV2_RELEASE, /* BYTE: lw DCYSUSV */
|
||||
/*13*/ AWE_FX_ENV2_SUSTAIN, /* BYTE: up DCYSUSV */
|
||||
|
||||
/* LFO1 (tremolo & vibrato) parameters */
|
||||
/*14*/ AWE_FX_LFO1_DELAY, /* WORD: LFO1VAL */
|
||||
/*15*/ AWE_FX_LFO1_FREQ, /* BYTE: lo TREMFRQ */
|
||||
/*16*/ AWE_FX_LFO1_VOLUME, /* BYTE: up TREMFRQ */
|
||||
/*17*/ AWE_FX_LFO1_PITCH, /* BYTE: up FMMOD */
|
||||
/*18*/ AWE_FX_LFO1_CUTOFF, /* BYTE: lo FMMOD */
|
||||
|
||||
/* LFO2 (vibrato) parameters */
|
||||
/*19*/ AWE_FX_LFO2_DELAY, /* WORD: LFO2VAL */
|
||||
/*20*/ AWE_FX_LFO2_FREQ, /* BYTE: lo FM2FRQ2 */
|
||||
/*21*/ AWE_FX_LFO2_PITCH, /* BYTE: up FM2FRQ2 */
|
||||
|
||||
/* Other overall effect parameters */
|
||||
/*22*/ AWE_FX_INIT_PITCH, /* SHORT: pitch offset */
|
||||
/*23*/ AWE_FX_CHORUS, /* BYTE: chorus effects send (0-255) */
|
||||
/*24*/ AWE_FX_REVERB, /* BYTE: reverb effects send (0-255) */
|
||||
/*25*/ AWE_FX_CUTOFF, /* BYTE: up IFATN */
|
||||
/*26*/ AWE_FX_FILTERQ, /* BYTE: up CCCA */
|
||||
|
||||
/* Sample / loop offset changes */
|
||||
/*27*/ AWE_FX_SAMPLE_START, /* SHORT: offset */
|
||||
/*28*/ AWE_FX_LOOP_START, /* SHORT: offset */
|
||||
/*29*/ AWE_FX_LOOP_END, /* SHORT: offset */
|
||||
/*30*/ AWE_FX_COARSE_SAMPLE_START, /* SHORT: upper word offset */
|
||||
/*31*/ AWE_FX_COARSE_LOOP_START, /* SHORT: upper word offset */
|
||||
/*32*/ AWE_FX_COARSE_LOOP_END, /* SHORT: upper word offset */
|
||||
/*33*/ AWE_FX_ATTEN, /* BYTE: lo IFATN */
|
||||
|
||||
AWE_FX_END,
|
||||
};
|
||||
|
||||
#endif /* AWE_VOICE_H */
|
||||
116
include/linux/ax25.h
Normal file
116
include/linux/ax25.h
Normal file
@@ -0,0 +1,116 @@
|
||||
/*
|
||||
* These are the public elements of the Linux kernel AX.25 code. A similar
|
||||
* file netrom.h exists for the NET/ROM protocol.
|
||||
*/
|
||||
|
||||
#ifndef AX25_KERNEL_H
|
||||
#define AX25_KERNEL_H
|
||||
|
||||
#include <linux/socket.h>
|
||||
|
||||
#define AX25_MTU 256
|
||||
#define AX25_MAX_DIGIS 8
|
||||
|
||||
#define AX25_WINDOW 1
|
||||
#define AX25_T1 2
|
||||
#define AX25_N2 3
|
||||
#define AX25_T3 4
|
||||
#define AX25_T2 5
|
||||
#define AX25_BACKOFF 6
|
||||
#define AX25_EXTSEQ 7
|
||||
#define AX25_PIDINCL 8
|
||||
#define AX25_IDLE 9
|
||||
#define AX25_PACLEN 10
|
||||
#define AX25_IAMDIGI 12
|
||||
|
||||
#define AX25_KILL 99
|
||||
|
||||
#define SIOCAX25GETUID (SIOCPROTOPRIVATE+0)
|
||||
#define SIOCAX25ADDUID (SIOCPROTOPRIVATE+1)
|
||||
#define SIOCAX25DELUID (SIOCPROTOPRIVATE+2)
|
||||
#define SIOCAX25NOUID (SIOCPROTOPRIVATE+3)
|
||||
#define SIOCAX25OPTRT (SIOCPROTOPRIVATE+7)
|
||||
#define SIOCAX25CTLCON (SIOCPROTOPRIVATE+8)
|
||||
#define SIOCAX25GETINFOOLD (SIOCPROTOPRIVATE+9)
|
||||
#define SIOCAX25ADDFWD (SIOCPROTOPRIVATE+10)
|
||||
#define SIOCAX25DELFWD (SIOCPROTOPRIVATE+11)
|
||||
#define SIOCAX25DEVCTL (SIOCPROTOPRIVATE+12)
|
||||
#define SIOCAX25GETINFO (SIOCPROTOPRIVATE+13)
|
||||
|
||||
#define AX25_SET_RT_IPMODE 2
|
||||
|
||||
#define AX25_NOUID_DEFAULT 0
|
||||
#define AX25_NOUID_BLOCK 1
|
||||
|
||||
typedef struct {
|
||||
char ax25_call[7]; /* 6 call + SSID (shifted ascii!) */
|
||||
} ax25_address;
|
||||
|
||||
struct sockaddr_ax25 {
|
||||
sa_family_t sax25_family;
|
||||
ax25_address sax25_call;
|
||||
int sax25_ndigis;
|
||||
/* Digipeater ax25_address sets follow */
|
||||
};
|
||||
|
||||
#define sax25_uid sax25_ndigis
|
||||
|
||||
struct full_sockaddr_ax25 {
|
||||
struct sockaddr_ax25 fsa_ax25;
|
||||
ax25_address fsa_digipeater[AX25_MAX_DIGIS];
|
||||
};
|
||||
|
||||
struct ax25_routes_struct {
|
||||
ax25_address port_addr;
|
||||
ax25_address dest_addr;
|
||||
unsigned char digi_count;
|
||||
ax25_address digi_addr[AX25_MAX_DIGIS];
|
||||
};
|
||||
|
||||
struct ax25_route_opt_struct {
|
||||
ax25_address port_addr;
|
||||
ax25_address dest_addr;
|
||||
int cmd;
|
||||
int arg;
|
||||
};
|
||||
|
||||
struct ax25_ctl_struct {
|
||||
ax25_address port_addr;
|
||||
ax25_address source_addr;
|
||||
ax25_address dest_addr;
|
||||
unsigned int cmd;
|
||||
unsigned long arg;
|
||||
unsigned char digi_count;
|
||||
ax25_address digi_addr[AX25_MAX_DIGIS];
|
||||
};
|
||||
|
||||
/* this will go away. Please do not export to user land */
|
||||
struct ax25_info_struct_deprecated {
|
||||
unsigned int n2, n2count;
|
||||
unsigned int t1, t1timer;
|
||||
unsigned int t2, t2timer;
|
||||
unsigned int t3, t3timer;
|
||||
unsigned int idle, idletimer;
|
||||
unsigned int state;
|
||||
unsigned int rcv_q, snd_q;
|
||||
};
|
||||
|
||||
struct ax25_info_struct {
|
||||
unsigned int n2, n2count;
|
||||
unsigned int t1, t1timer;
|
||||
unsigned int t2, t2timer;
|
||||
unsigned int t3, t3timer;
|
||||
unsigned int idle, idletimer;
|
||||
unsigned int state;
|
||||
unsigned int rcv_q, snd_q;
|
||||
unsigned int vs, vr, va, vs_max;
|
||||
unsigned int paclen;
|
||||
unsigned int window;
|
||||
};
|
||||
|
||||
struct ax25_fwd_struct {
|
||||
ax25_address port_from;
|
||||
ax25_address port_to;
|
||||
};
|
||||
|
||||
#endif
|
||||
73
include/linux/b1lli.h
Normal file
73
include/linux/b1lli.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/* $Id: b1lli.h,v 1.1.1.1 2007/06/12 07:27:16 eyryu Exp $
|
||||
*
|
||||
* ISDN lowlevel-module for AVM B1-card.
|
||||
*
|
||||
* Copyright 1996 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* This software may be used and distributed according to the terms
|
||||
* of the GNU General Public License, incorporated herein by reference.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _B1LLI_H_
|
||||
#define _B1LLI_H_
|
||||
/*
|
||||
* struct for loading t4 file
|
||||
*/
|
||||
typedef struct avmb1_t4file {
|
||||
int len;
|
||||
unsigned char *data;
|
||||
} avmb1_t4file;
|
||||
|
||||
typedef struct avmb1_loaddef {
|
||||
int contr;
|
||||
avmb1_t4file t4file;
|
||||
} avmb1_loaddef;
|
||||
|
||||
typedef struct avmb1_loadandconfigdef {
|
||||
int contr;
|
||||
avmb1_t4file t4file;
|
||||
avmb1_t4file t4config;
|
||||
} avmb1_loadandconfigdef;
|
||||
|
||||
typedef struct avmb1_resetdef {
|
||||
int contr;
|
||||
} avmb1_resetdef;
|
||||
|
||||
typedef struct avmb1_getdef {
|
||||
int contr;
|
||||
int cardtype;
|
||||
int cardstate;
|
||||
} avmb1_getdef;
|
||||
|
||||
/*
|
||||
* struct for adding new cards
|
||||
*/
|
||||
typedef struct avmb1_carddef {
|
||||
int port;
|
||||
int irq;
|
||||
} avmb1_carddef;
|
||||
|
||||
#define AVM_CARDTYPE_B1 0
|
||||
#define AVM_CARDTYPE_T1 1
|
||||
#define AVM_CARDTYPE_M1 2
|
||||
#define AVM_CARDTYPE_M2 3
|
||||
|
||||
typedef struct avmb1_extcarddef {
|
||||
int port;
|
||||
int irq;
|
||||
int cardtype;
|
||||
int cardnr; /* for HEMA/T1 */
|
||||
} avmb1_extcarddef;
|
||||
|
||||
#define AVMB1_LOAD 0 /* load image to card */
|
||||
#define AVMB1_ADDCARD 1 /* add a new card - OBSOLETE */
|
||||
#define AVMB1_RESETCARD 2 /* reset a card */
|
||||
#define AVMB1_LOAD_AND_CONFIG 3 /* load image and config to card */
|
||||
#define AVMB1_ADDCARD_WITH_TYPE 4 /* add a new card, with cardtype */
|
||||
#define AVMB1_GET_CARDINFO 5 /* get cardtype */
|
||||
#define AVMB1_REMOVECARD 6 /* remove a card - OBSOLETE */
|
||||
|
||||
#define AVMB1_REGISTERCARD_IS_OBSOLETE
|
||||
|
||||
#endif /* _B1LLI_H_ */
|
||||
21
include/linux/b1pcmcia.h
Normal file
21
include/linux/b1pcmcia.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* $Id: b1pcmcia.h,v 1.1.1.1 2007/06/12 07:27:16 eyryu Exp $
|
||||
*
|
||||
* Exported functions of module b1pcmcia to be called by
|
||||
* avm_cs card services module.
|
||||
*
|
||||
* Copyright 1999 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* This software may be used and distributed according to the terms
|
||||
* of the GNU General Public License, incorporated herein by reference.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _B1PCMCIA_H_
|
||||
#define _B1PCMCIA_H_
|
||||
|
||||
int b1pcmcia_addcard_b1(unsigned int port, unsigned irq);
|
||||
int b1pcmcia_addcard_m1(unsigned int port, unsigned irq);
|
||||
int b1pcmcia_addcard_m2(unsigned int port, unsigned irq);
|
||||
int b1pcmcia_delcard(unsigned int port, unsigned irq);
|
||||
|
||||
#endif /* _B1PCMCIA_H_ */
|
||||
112
include/linux/backing-dev.h
Normal file
112
include/linux/backing-dev.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* include/linux/backing-dev.h
|
||||
*
|
||||
* low-level device information and state which is propagated up through
|
||||
* to high-level code.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BACKING_DEV_H
|
||||
#define _LINUX_BACKING_DEV_H
|
||||
|
||||
#include <asm/atomic.h>
|
||||
|
||||
struct page;
|
||||
|
||||
/*
|
||||
* Bits in backing_dev_info.state
|
||||
*/
|
||||
enum bdi_state {
|
||||
BDI_pdflush, /* A pdflush thread is working this device */
|
||||
BDI_write_congested, /* The write queue is getting full */
|
||||
BDI_read_congested, /* The read queue is getting full */
|
||||
BDI_unused, /* Available bits start here */
|
||||
};
|
||||
|
||||
typedef int (congested_fn)(void *, int);
|
||||
|
||||
struct backing_dev_info {
|
||||
unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */
|
||||
unsigned long state; /* Always use atomic bitops on this */
|
||||
unsigned int capabilities; /* Device capabilities */
|
||||
congested_fn *congested_fn; /* Function pointer if device is md/dm */
|
||||
void *congested_data; /* Pointer to aux data for congested func */
|
||||
void (*unplug_io_fn)(struct backing_dev_info *, struct page *);
|
||||
void *unplug_io_data;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Flags in backing_dev_info::capability
|
||||
* - The first two flags control whether dirty pages will contribute to the
|
||||
* VM's accounting and whether writepages() should be called for dirty pages
|
||||
* (something that would not, for example, be appropriate for ramfs)
|
||||
* - These flags let !MMU mmap() govern direct device mapping vs immediate
|
||||
* copying more easily for MAP_PRIVATE, especially for ROM filesystems
|
||||
*/
|
||||
#define BDI_CAP_NO_ACCT_DIRTY 0x00000001 /* Dirty pages shouldn't contribute to accounting */
|
||||
#define BDI_CAP_NO_WRITEBACK 0x00000002 /* Don't write pages back */
|
||||
#define BDI_CAP_MAP_COPY 0x00000004 /* Copy can be mapped (MAP_PRIVATE) */
|
||||
#define BDI_CAP_MAP_DIRECT 0x00000008 /* Can be mapped directly (MAP_SHARED) */
|
||||
#define BDI_CAP_READ_MAP 0x00000010 /* Can be mapped for reading */
|
||||
#define BDI_CAP_WRITE_MAP 0x00000020 /* Can be mapped for writing */
|
||||
#define BDI_CAP_EXEC_MAP 0x00000040 /* Can be mapped for execution */
|
||||
#define BDI_CAP_VMFLAGS \
|
||||
(BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP)
|
||||
|
||||
#if defined(VM_MAYREAD) && \
|
||||
(BDI_CAP_READ_MAP != VM_MAYREAD || \
|
||||
BDI_CAP_WRITE_MAP != VM_MAYWRITE || \
|
||||
BDI_CAP_EXEC_MAP != VM_MAYEXEC)
|
||||
#error please change backing_dev_info::capabilities flags
|
||||
#endif
|
||||
|
||||
extern struct backing_dev_info default_backing_dev_info;
|
||||
void default_unplug_io_fn(struct backing_dev_info *bdi, struct page *page);
|
||||
|
||||
int writeback_acquire(struct backing_dev_info *bdi);
|
||||
int writeback_in_progress(struct backing_dev_info *bdi);
|
||||
void writeback_release(struct backing_dev_info *bdi);
|
||||
|
||||
static inline int bdi_congested(struct backing_dev_info *bdi, int bdi_bits)
|
||||
{
|
||||
if (bdi->congested_fn)
|
||||
return bdi->congested_fn(bdi->congested_data, bdi_bits);
|
||||
return (bdi->state & bdi_bits);
|
||||
}
|
||||
|
||||
static inline int bdi_read_congested(struct backing_dev_info *bdi)
|
||||
{
|
||||
return bdi_congested(bdi, 1 << BDI_read_congested);
|
||||
}
|
||||
|
||||
static inline int bdi_write_congested(struct backing_dev_info *bdi)
|
||||
{
|
||||
return bdi_congested(bdi, 1 << BDI_write_congested);
|
||||
}
|
||||
|
||||
static inline int bdi_rw_congested(struct backing_dev_info *bdi)
|
||||
{
|
||||
return bdi_congested(bdi, (1 << BDI_read_congested)|
|
||||
(1 << BDI_write_congested));
|
||||
}
|
||||
|
||||
void clear_bdi_congested(struct backing_dev_info *bdi, int rw);
|
||||
void set_bdi_congested(struct backing_dev_info *bdi, int rw);
|
||||
long congestion_wait(int rw, long timeout);
|
||||
long congestion_wait_interruptible(int rw, long timeout);
|
||||
void congestion_end(int rw);
|
||||
|
||||
#define bdi_cap_writeback_dirty(bdi) \
|
||||
(!((bdi)->capabilities & BDI_CAP_NO_WRITEBACK))
|
||||
|
||||
#define bdi_cap_account_dirty(bdi) \
|
||||
(!((bdi)->capabilities & BDI_CAP_NO_ACCT_DIRTY))
|
||||
|
||||
#define mapping_cap_writeback_dirty(mapping) \
|
||||
bdi_cap_writeback_dirty((mapping)->backing_dev_info)
|
||||
|
||||
#define mapping_cap_account_dirty(mapping) \
|
||||
bdi_cap_account_dirty((mapping)->backing_dev_info)
|
||||
|
||||
|
||||
#endif /* _LINUX_BACKING_DEV_H */
|
||||
90
include/linux/backlight.h
Normal file
90
include/linux/backlight.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Backlight Lowlevel Control Abstraction
|
||||
*
|
||||
* Copyright (C) 2003,2004 Hewlett-Packard Company
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BACKLIGHT_H
|
||||
#define _LINUX_BACKLIGHT_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
/* Notes on locking:
|
||||
*
|
||||
* backlight_device->ops_lock is an internal backlight lock protecting the
|
||||
* ops pointer and no code outside the core should need to touch it.
|
||||
*
|
||||
* Access to update_status() is serialised by the update_lock mutex since
|
||||
* most drivers seem to need this and historically get it wrong.
|
||||
*
|
||||
* Most drivers don't need locking on their get_brightness() method.
|
||||
* If yours does, you need to implement it in the driver. You can use the
|
||||
* update_lock mutex if appropriate.
|
||||
*
|
||||
* Any other use of the locks below is probably wrong.
|
||||
*/
|
||||
|
||||
struct backlight_device;
|
||||
struct fb_info;
|
||||
|
||||
struct backlight_ops {
|
||||
/* Notify the backlight driver some property has changed */
|
||||
int (*update_status)(struct backlight_device *);
|
||||
/* Return the current backlight brightness (accounting for power,
|
||||
fb_blank etc.) */
|
||||
int (*get_brightness)(struct backlight_device *);
|
||||
/* Check if given framebuffer device is the one bound to this backlight;
|
||||
return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
|
||||
int (*check_fb)(struct fb_info *);
|
||||
};
|
||||
|
||||
/* This structure defines all the properties of a backlight */
|
||||
struct backlight_properties {
|
||||
/* Current User requested brightness (0 - max_brightness) */
|
||||
int brightness;
|
||||
/* Maximal value for brightness (read-only) */
|
||||
int max_brightness;
|
||||
/* Current FB Power mode (0: full on, 1..3: power saving
|
||||
modes; 4: full off), see FB_BLANK_XXX */
|
||||
int power;
|
||||
/* FB Blanking active? (values as for power) */
|
||||
int fb_blank;
|
||||
};
|
||||
|
||||
struct backlight_device {
|
||||
/* Backlight properties */
|
||||
struct backlight_properties props;
|
||||
|
||||
/* Serialise access to update_status method */
|
||||
struct mutex update_lock;
|
||||
|
||||
/* This protects the 'ops' field. If 'ops' is NULL, the driver that
|
||||
registered this device has been unloaded, and if class_get_devdata()
|
||||
points to something in the body of that driver, it is also invalid. */
|
||||
struct mutex ops_lock;
|
||||
struct backlight_ops *ops;
|
||||
|
||||
/* The framebuffer notifier block */
|
||||
struct notifier_block fb_notif;
|
||||
/* The class device structure */
|
||||
struct class_device class_dev;
|
||||
};
|
||||
|
||||
static inline void backlight_update_status(struct backlight_device *bd)
|
||||
{
|
||||
mutex_lock(&bd->update_lock);
|
||||
if (bd->ops && bd->ops->update_status)
|
||||
bd->ops->update_status(bd);
|
||||
mutex_unlock(&bd->update_lock);
|
||||
}
|
||||
|
||||
extern struct backlight_device *backlight_device_register(const char *name,
|
||||
struct device *dev, void *devdata, struct backlight_ops *ops);
|
||||
extern void backlight_device_unregister(struct backlight_device *bd);
|
||||
|
||||
#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)
|
||||
|
||||
#endif
|
||||
39
include/linux/baycom.h
Normal file
39
include/linux/baycom.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* The Linux BAYCOM driver for the Baycom serial 1200 baud modem
|
||||
* and the parallel 9600 baud modem
|
||||
* (C) 1997-1998 by Thomas Sailer, HB9JNX/AE4WA
|
||||
*/
|
||||
|
||||
#ifndef _BAYCOM_H
|
||||
#define _BAYCOM_H
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/*
|
||||
* structs for the IOCTL commands
|
||||
*/
|
||||
|
||||
struct baycom_debug_data {
|
||||
unsigned long debug1;
|
||||
unsigned long debug2;
|
||||
long debug3;
|
||||
};
|
||||
|
||||
struct baycom_ioctl {
|
||||
int cmd;
|
||||
union {
|
||||
struct baycom_debug_data dbg;
|
||||
} data;
|
||||
};
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* ioctl values change for baycom
|
||||
*/
|
||||
#define BAYCOMCTL_GETDEBUG 0x92
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
||||
#endif /* _BAYCOM_H */
|
||||
|
||||
/* --------------------------------------------------------------------- */
|
||||
20
include/linux/bcd.h
Normal file
20
include/linux/bcd.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/* Permission is hereby granted to copy, modify and redistribute this code
|
||||
* in terms of the GNU Library General Public License, Version 2 or later,
|
||||
* at your option.
|
||||
*/
|
||||
|
||||
/* macros to translate to/from binary and binary-coded decimal (frequently
|
||||
* found in RTC chips).
|
||||
*/
|
||||
|
||||
#ifndef _BCD_H
|
||||
#define _BCD_H
|
||||
|
||||
#define BCD2BIN(val) (((val) & 0x0f) + ((val)>>4)*10)
|
||||
#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
|
||||
|
||||
/* backwards compat */
|
||||
#define BCD_TO_BIN(val) ((val)=BCD2BIN(val))
|
||||
#define BIN_TO_BCD(val) ((val)=BIN2BCD(val))
|
||||
|
||||
#endif /* _BCD_H */
|
||||
80
include/linux/bfs_fs.h
Normal file
80
include/linux/bfs_fs.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/*
|
||||
* include/linux/bfs_fs.h - BFS data structures on disk.
|
||||
* Copyright (C) 1999 Tigran Aivazian <tigran@veritas.com>
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BFS_FS_H
|
||||
#define _LINUX_BFS_FS_H
|
||||
|
||||
#define BFS_BSIZE_BITS 9
|
||||
#define BFS_BSIZE (1<<BFS_BSIZE_BITS)
|
||||
|
||||
#define BFS_MAGIC 0x1BADFACE
|
||||
#define BFS_ROOT_INO 2
|
||||
#define BFS_INODES_PER_BLOCK 8
|
||||
|
||||
/* SVR4 vnode type values (bfs_inode->i_vtype) */
|
||||
#define BFS_VDIR 2L
|
||||
#define BFS_VREG 1L
|
||||
|
||||
|
||||
/* BFS inode layout on disk */
|
||||
struct bfs_inode {
|
||||
__le16 i_ino;
|
||||
__u16 i_unused;
|
||||
__le32 i_sblock;
|
||||
__le32 i_eblock;
|
||||
__le32 i_eoffset;
|
||||
__le32 i_vtype;
|
||||
__le32 i_mode;
|
||||
__le32 i_uid;
|
||||
__le32 i_gid;
|
||||
__le32 i_nlink;
|
||||
__le32 i_atime;
|
||||
__le32 i_mtime;
|
||||
__le32 i_ctime;
|
||||
__u32 i_padding[4];
|
||||
};
|
||||
|
||||
#define BFS_NAMELEN 14
|
||||
#define BFS_DIRENT_SIZE 16
|
||||
#define BFS_DIRS_PER_BLOCK 32
|
||||
|
||||
struct bfs_dirent {
|
||||
__le16 ino;
|
||||
char name[BFS_NAMELEN];
|
||||
};
|
||||
|
||||
/* BFS superblock layout on disk */
|
||||
struct bfs_super_block {
|
||||
__le32 s_magic;
|
||||
__le32 s_start;
|
||||
__le32 s_end;
|
||||
__le32 s_from;
|
||||
__le32 s_to;
|
||||
__s32 s_bfrom;
|
||||
__s32 s_bto;
|
||||
char s_fsname[6];
|
||||
char s_volume[6];
|
||||
__u32 s_padding[118];
|
||||
};
|
||||
|
||||
|
||||
#define BFS_OFF2INO(offset) \
|
||||
((((offset) - BFS_BSIZE) / sizeof(struct bfs_inode)) + BFS_ROOT_INO)
|
||||
|
||||
#define BFS_INO2OFF(ino) \
|
||||
((__u32)(((ino) - BFS_ROOT_INO) * sizeof(struct bfs_inode)) + BFS_BSIZE)
|
||||
#define BFS_NZFILESIZE(ip) \
|
||||
((le32_to_cpu((ip)->i_eoffset) + 1) - le32_to_cpu((ip)->i_sblock) * BFS_BSIZE)
|
||||
|
||||
#define BFS_FILESIZE(ip) \
|
||||
((ip)->i_sblock == 0 ? 0 : BFS_NZFILESIZE(ip))
|
||||
|
||||
#define BFS_FILEBLOCKS(ip) \
|
||||
((ip)->i_sblock == 0 ? 0 : (le32_to_cpu((ip)->i_eblock) + 1) - le32_to_cpu((ip)->i_sblock))
|
||||
#define BFS_UNCLEAN(bfs_sb, sb) \
|
||||
((le32_to_cpu(bfs_sb->s_from) != -1) && (le32_to_cpu(bfs_sb->s_to) != -1) && !(sb->s_flags & MS_RDONLY))
|
||||
|
||||
|
||||
#endif /* _LINUX_BFS_FS_H */
|
||||
92
include/linux/binfmts.h
Normal file
92
include/linux/binfmts.h
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef _LINUX_BINFMTS_H
|
||||
#define _LINUX_BINFMTS_H
|
||||
|
||||
#include <linux/capability.h>
|
||||
|
||||
struct pt_regs;
|
||||
|
||||
/*
|
||||
* MAX_ARG_PAGES defines the number of pages allocated for arguments
|
||||
* and envelope for the new program. 32 should suffice, this gives
|
||||
* a maximum env+arg of 128kB w/4KB pages!
|
||||
*/
|
||||
#define MAX_ARG_PAGES 32
|
||||
|
||||
/* sizeof(linux_binprm->buf) */
|
||||
#define BINPRM_BUF_SIZE 128
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/*
|
||||
* This structure is used to hold the arguments that are used when loading binaries.
|
||||
*/
|
||||
struct linux_binprm{
|
||||
char buf[BINPRM_BUF_SIZE];
|
||||
struct page *page[MAX_ARG_PAGES];
|
||||
struct mm_struct *mm;
|
||||
unsigned long p; /* current top of mem */
|
||||
int sh_bang;
|
||||
struct file * file;
|
||||
int e_uid, e_gid;
|
||||
kernel_cap_t cap_inheritable, cap_permitted, cap_effective;
|
||||
void *security;
|
||||
int argc, envc;
|
||||
char * filename; /* Name of binary as seen by procps */
|
||||
char * interp; /* Name of the binary really executed. Most
|
||||
of the time same as filename, but could be
|
||||
different for binfmt_{misc,script} */
|
||||
unsigned interp_flags;
|
||||
unsigned interp_data;
|
||||
unsigned long loader, exec;
|
||||
};
|
||||
|
||||
#define BINPRM_FLAGS_ENFORCE_NONDUMP_BIT 0
|
||||
#define BINPRM_FLAGS_ENFORCE_NONDUMP (1 << BINPRM_FLAGS_ENFORCE_NONDUMP_BIT)
|
||||
|
||||
/* fd of the binary should be passed to the interpreter */
|
||||
#define BINPRM_FLAGS_EXECFD_BIT 1
|
||||
#define BINPRM_FLAGS_EXECFD (1 << BINPRM_FLAGS_EXECFD_BIT)
|
||||
|
||||
|
||||
/*
|
||||
* This structure defines the functions that are used to load the binary formats that
|
||||
* linux accepts.
|
||||
*/
|
||||
struct linux_binfmt {
|
||||
struct linux_binfmt * next;
|
||||
struct module *module;
|
||||
int (*load_binary)(struct linux_binprm *, struct pt_regs * regs);
|
||||
int (*load_shlib)(struct file *);
|
||||
int (*core_dump)(long signr, struct pt_regs * regs, struct file * file);
|
||||
unsigned long min_coredump; /* minimal dump size */
|
||||
int hasvdso;
|
||||
};
|
||||
|
||||
extern int register_binfmt(struct linux_binfmt *);
|
||||
extern int unregister_binfmt(struct linux_binfmt *);
|
||||
|
||||
extern int prepare_binprm(struct linux_binprm *);
|
||||
extern void remove_arg_zero(struct linux_binprm *);
|
||||
extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
|
||||
extern int flush_old_exec(struct linux_binprm * bprm);
|
||||
|
||||
extern int suid_dumpable;
|
||||
#define SUID_DUMP_DISABLE 0 /* No setuid dumping */
|
||||
#define SUID_DUMP_USER 1 /* Dump as user of process */
|
||||
#define SUID_DUMP_ROOT 2 /* Dump as root */
|
||||
|
||||
/* Stack area protections */
|
||||
#define EXSTACK_DEFAULT 0 /* Whatever the arch defaults to */
|
||||
#define EXSTACK_DISABLE_X 1 /* Disable executable stacks */
|
||||
#define EXSTACK_ENABLE_X 2 /* Enable executable stacks */
|
||||
|
||||
extern int setup_arg_pages(struct linux_binprm * bprm,
|
||||
unsigned long stack_top,
|
||||
int executable_stack);
|
||||
extern int copy_strings_kernel(int argc,char ** argv,struct linux_binprm *bprm);
|
||||
extern void compute_creds(struct linux_binprm *binprm);
|
||||
extern int do_coredump(long signr, int exit_code, struct pt_regs * regs);
|
||||
extern int set_binfmt(struct linux_binfmt *new);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
#endif /* _LINUX_BINFMTS_H */
|
||||
364
include/linux/bio.h
Normal file
364
include/linux/bio.h
Normal file
@@ -0,0 +1,364 @@
|
||||
/*
|
||||
* 2.5 block I/O model
|
||||
*
|
||||
* Copyright (C) 2001 Jens Axboe <axboe@suse.de>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public Licens
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-
|
||||
*/
|
||||
#ifndef __LINUX_BIO_H
|
||||
#define __LINUX_BIO_H
|
||||
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/ioprio.h>
|
||||
|
||||
/* Platforms may set this to teach the BIO layer about IOMMU hardware. */
|
||||
#include <asm/io.h>
|
||||
|
||||
#if defined(BIO_VMERGE_MAX_SIZE) && defined(BIO_VMERGE_BOUNDARY)
|
||||
#define BIOVEC_VIRT_START_SIZE(x) (bvec_to_phys(x) & (BIO_VMERGE_BOUNDARY - 1))
|
||||
#define BIOVEC_VIRT_OVERSIZE(x) ((x) > BIO_VMERGE_MAX_SIZE)
|
||||
#else
|
||||
#define BIOVEC_VIRT_START_SIZE(x) 0
|
||||
#define BIOVEC_VIRT_OVERSIZE(x) 0
|
||||
#endif
|
||||
|
||||
#ifndef BIO_VMERGE_BOUNDARY
|
||||
#define BIO_VMERGE_BOUNDARY 0
|
||||
#endif
|
||||
|
||||
#define BIO_DEBUG
|
||||
|
||||
#ifdef BIO_DEBUG
|
||||
#define BIO_BUG_ON BUG_ON
|
||||
#else
|
||||
#define BIO_BUG_ON
|
||||
#endif
|
||||
|
||||
#define BIO_MAX_PAGES 256
|
||||
#define BIO_MAX_SIZE (BIO_MAX_PAGES << PAGE_CACHE_SHIFT)
|
||||
#define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9)
|
||||
|
||||
/*
|
||||
* was unsigned short, but we might as well be ready for > 64kB I/O pages
|
||||
*/
|
||||
struct bio_vec {
|
||||
struct page *bv_page;
|
||||
unsigned int bv_len;
|
||||
unsigned int bv_offset;
|
||||
};
|
||||
|
||||
struct bio_set;
|
||||
struct bio;
|
||||
typedef int (bio_end_io_t) (struct bio *, unsigned int, int);
|
||||
typedef void (bio_destructor_t) (struct bio *);
|
||||
|
||||
/*
|
||||
* main unit of I/O for the block layer and lower layers (ie drivers and
|
||||
* stacking drivers)
|
||||
*/
|
||||
struct bio {
|
||||
sector_t bi_sector; /* device address in 512 byte
|
||||
sectors */
|
||||
struct bio *bi_next; /* request queue link */
|
||||
struct block_device *bi_bdev;
|
||||
unsigned long bi_flags; /* status, command, etc */
|
||||
unsigned long bi_rw; /* bottom bits READ/WRITE,
|
||||
* top bits priority
|
||||
*/
|
||||
|
||||
unsigned short bi_vcnt; /* how many bio_vec's */
|
||||
unsigned short bi_idx; /* current index into bvl_vec */
|
||||
|
||||
/* Number of segments in this BIO after
|
||||
* physical address coalescing is performed.
|
||||
*/
|
||||
unsigned short bi_phys_segments;
|
||||
|
||||
/* Number of segments after physical and DMA remapping
|
||||
* hardware coalescing is performed.
|
||||
*/
|
||||
unsigned short bi_hw_segments;
|
||||
|
||||
unsigned int bi_size; /* residual I/O count */
|
||||
|
||||
/*
|
||||
* To keep track of the max hw size, we account for the
|
||||
* sizes of the first and last virtually mergeable segments
|
||||
* in this bio
|
||||
*/
|
||||
unsigned int bi_hw_front_size;
|
||||
unsigned int bi_hw_back_size;
|
||||
|
||||
unsigned int bi_max_vecs; /* max bvl_vecs we can hold */
|
||||
|
||||
struct bio_vec *bi_io_vec; /* the actual vec list */
|
||||
|
||||
bio_end_io_t *bi_end_io;
|
||||
atomic_t bi_cnt; /* pin count */
|
||||
|
||||
void *bi_private;
|
||||
|
||||
bio_destructor_t *bi_destructor; /* destructor */
|
||||
};
|
||||
|
||||
/*
|
||||
* bio flags
|
||||
*/
|
||||
#define BIO_UPTODATE 0 /* ok after I/O completion */
|
||||
#define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */
|
||||
#define BIO_EOF 2 /* out-out-bounds error */
|
||||
#define BIO_SEG_VALID 3 /* nr_hw_seg valid */
|
||||
#define BIO_CLONED 4 /* doesn't own data */
|
||||
#define BIO_BOUNCED 5 /* bio is a bounce bio */
|
||||
#define BIO_USER_MAPPED 6 /* contains user pages */
|
||||
#define BIO_EOPNOTSUPP 7 /* not supported */
|
||||
#define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag)))
|
||||
|
||||
/*
|
||||
* top 4 bits of bio flags indicate the pool this bio came from
|
||||
*/
|
||||
#define BIO_POOL_BITS (4)
|
||||
#define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS)
|
||||
#define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET)
|
||||
#define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET)
|
||||
|
||||
/*
|
||||
* bio bi_rw flags
|
||||
*
|
||||
* bit 0 -- read (not set) or write (set)
|
||||
* bit 1 -- rw-ahead when set
|
||||
* bit 2 -- barrier
|
||||
* bit 3 -- fail fast, don't want low level driver retries
|
||||
* bit 4 -- synchronous I/O hint: the block layer will unplug immediately
|
||||
*/
|
||||
#define BIO_RW 0
|
||||
#define BIO_RW_AHEAD 1
|
||||
#define BIO_RW_BARRIER 2
|
||||
#define BIO_RW_FAILFAST 3
|
||||
#define BIO_RW_SYNC 4
|
||||
#define BIO_RW_META 5
|
||||
|
||||
/*
|
||||
* upper 16 bits of bi_rw define the io priority of this bio
|
||||
*/
|
||||
#define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS)
|
||||
#define bio_prio(bio) ((bio)->bi_rw >> BIO_PRIO_SHIFT)
|
||||
#define bio_prio_valid(bio) ioprio_valid(bio_prio(bio))
|
||||
|
||||
#define bio_set_prio(bio, prio) do { \
|
||||
WARN_ON(prio >= (1 << IOPRIO_BITS)); \
|
||||
(bio)->bi_rw &= ((1UL << BIO_PRIO_SHIFT) - 1); \
|
||||
(bio)->bi_rw |= ((unsigned long) (prio) << BIO_PRIO_SHIFT); \
|
||||
} while (0)
|
||||
|
||||
/*
|
||||
* various member access, note that bio_data should of course not be used
|
||||
* on highmem page vectors
|
||||
*/
|
||||
#define bio_iovec_idx(bio, idx) (&((bio)->bi_io_vec[(idx)]))
|
||||
#define bio_iovec(bio) bio_iovec_idx((bio), (bio)->bi_idx)
|
||||
#define bio_page(bio) bio_iovec((bio))->bv_page
|
||||
#define bio_offset(bio) bio_iovec((bio))->bv_offset
|
||||
#define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx)
|
||||
#define bio_sectors(bio) ((bio)->bi_size >> 9)
|
||||
#define bio_cur_sectors(bio) (bio_iovec(bio)->bv_len >> 9)
|
||||
#define bio_data(bio) (page_address(bio_page((bio))) + bio_offset((bio)))
|
||||
#define bio_barrier(bio) ((bio)->bi_rw & (1 << BIO_RW_BARRIER))
|
||||
#define bio_sync(bio) ((bio)->bi_rw & (1 << BIO_RW_SYNC))
|
||||
#define bio_failfast(bio) ((bio)->bi_rw & (1 << BIO_RW_FAILFAST))
|
||||
#define bio_rw_ahead(bio) ((bio)->bi_rw & (1 << BIO_RW_AHEAD))
|
||||
#define bio_rw_meta(bio) ((bio)->bi_rw & (1 << BIO_RW_META))
|
||||
|
||||
/*
|
||||
* will die
|
||||
*/
|
||||
#define bio_to_phys(bio) (page_to_phys(bio_page((bio))) + (unsigned long) bio_offset((bio)))
|
||||
#define bvec_to_phys(bv) (page_to_phys((bv)->bv_page) + (unsigned long) (bv)->bv_offset)
|
||||
|
||||
/*
|
||||
* queues that have highmem support enabled may still need to revert to
|
||||
* PIO transfers occasionally and thus map high pages temporarily. For
|
||||
* permanent PIO fall back, user is probably better off disabling highmem
|
||||
* I/O completely on that queue (see ide-dma for example)
|
||||
*/
|
||||
#define __bio_kmap_atomic(bio, idx, kmtype) \
|
||||
(kmap_atomic(bio_iovec_idx((bio), (idx))->bv_page, kmtype) + \
|
||||
bio_iovec_idx((bio), (idx))->bv_offset)
|
||||
|
||||
#define __bio_kunmap_atomic(addr, kmtype) kunmap_atomic(addr, kmtype)
|
||||
|
||||
/*
|
||||
* merge helpers etc
|
||||
*/
|
||||
|
||||
#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
|
||||
#define __BVEC_START(bio) bio_iovec_idx((bio), (bio)->bi_idx)
|
||||
|
||||
/*
|
||||
* allow arch override, for eg virtualized architectures (put in asm/io.h)
|
||||
*/
|
||||
#ifndef BIOVEC_PHYS_MERGEABLE
|
||||
#define BIOVEC_PHYS_MERGEABLE(vec1, vec2) \
|
||||
((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
|
||||
#endif
|
||||
|
||||
#define BIOVEC_VIRT_MERGEABLE(vec1, vec2) \
|
||||
((((bvec_to_phys((vec1)) + (vec1)->bv_len) | bvec_to_phys((vec2))) & (BIO_VMERGE_BOUNDARY - 1)) == 0)
|
||||
#define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
|
||||
(((addr1) | (mask)) == (((addr2) - 1) | (mask)))
|
||||
#define BIOVEC_SEG_BOUNDARY(q, b1, b2) \
|
||||
__BIO_SEG_BOUNDARY(bvec_to_phys((b1)), bvec_to_phys((b2)) + (b2)->bv_len, (q)->seg_boundary_mask)
|
||||
#define BIO_SEG_BOUNDARY(q, b1, b2) \
|
||||
BIOVEC_SEG_BOUNDARY((q), __BVEC_END((b1)), __BVEC_START((b2)))
|
||||
|
||||
#define bio_io_error(bio, bytes) bio_endio((bio), (bytes), -EIO)
|
||||
|
||||
/*
|
||||
* drivers should not use the __ version unless they _really_ want to
|
||||
* run through the entire bio and not just pending pieces
|
||||
*/
|
||||
#define __bio_for_each_segment(bvl, bio, i, start_idx) \
|
||||
for (bvl = bio_iovec_idx((bio), (start_idx)), i = (start_idx); \
|
||||
i < (bio)->bi_vcnt; \
|
||||
bvl++, i++)
|
||||
|
||||
#define bio_for_each_segment(bvl, bio, i) \
|
||||
__bio_for_each_segment(bvl, bio, i, (bio)->bi_idx)
|
||||
|
||||
/*
|
||||
* get a reference to a bio, so it won't disappear. the intended use is
|
||||
* something like:
|
||||
*
|
||||
* bio_get(bio);
|
||||
* submit_bio(rw, bio);
|
||||
* if (bio->bi_flags ...)
|
||||
* do_something
|
||||
* bio_put(bio);
|
||||
*
|
||||
* without the bio_get(), it could potentially complete I/O before submit_bio
|
||||
* returns. and then bio would be freed memory when if (bio->bi_flags ...)
|
||||
* runs
|
||||
*/
|
||||
#define bio_get(bio) atomic_inc(&(bio)->bi_cnt)
|
||||
|
||||
|
||||
/*
|
||||
* A bio_pair is used when we need to split a bio.
|
||||
* This can only happen for a bio that refers to just one
|
||||
* page of data, and in the unusual situation when the
|
||||
* page crosses a chunk/device boundary
|
||||
*
|
||||
* The address of the master bio is stored in bio1.bi_private
|
||||
* The address of the pool the pair was allocated from is stored
|
||||
* in bio2.bi_private
|
||||
*/
|
||||
struct bio_pair {
|
||||
struct bio bio1, bio2;
|
||||
struct bio_vec bv1, bv2;
|
||||
atomic_t cnt;
|
||||
int error;
|
||||
};
|
||||
extern struct bio_pair *bio_split(struct bio *bi, mempool_t *pool,
|
||||
int first_sectors);
|
||||
extern mempool_t *bio_split_pool;
|
||||
extern void bio_pair_release(struct bio_pair *dbio);
|
||||
|
||||
extern struct bio_set *bioset_create(int, int, int);
|
||||
extern void bioset_free(struct bio_set *);
|
||||
|
||||
extern struct bio *bio_alloc(gfp_t, int);
|
||||
extern struct bio *bio_alloc_bioset(gfp_t, int, struct bio_set *);
|
||||
extern void bio_put(struct bio *);
|
||||
extern void bio_free(struct bio *, struct bio_set *);
|
||||
|
||||
extern void bio_endio(struct bio *, unsigned int, int);
|
||||
struct request_queue;
|
||||
extern int bio_phys_segments(struct request_queue *, struct bio *);
|
||||
extern int bio_hw_segments(struct request_queue *, struct bio *);
|
||||
|
||||
extern void __bio_clone(struct bio *, struct bio *);
|
||||
extern struct bio *bio_clone(struct bio *, gfp_t);
|
||||
|
||||
extern void bio_init(struct bio *);
|
||||
|
||||
extern int bio_add_page(struct bio *, struct page *, unsigned int,unsigned int);
|
||||
extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *,
|
||||
unsigned int, unsigned int);
|
||||
extern int bio_get_nr_vecs(struct block_device *);
|
||||
extern struct bio *bio_map_user(struct request_queue *, struct block_device *,
|
||||
unsigned long, unsigned int, int);
|
||||
struct sg_iovec;
|
||||
extern struct bio *bio_map_user_iov(struct request_queue *,
|
||||
struct block_device *,
|
||||
struct sg_iovec *, int, int);
|
||||
extern void bio_unmap_user(struct bio *);
|
||||
extern struct bio *bio_map_kern(struct request_queue *, void *, unsigned int,
|
||||
gfp_t);
|
||||
extern void bio_set_pages_dirty(struct bio *bio);
|
||||
extern void bio_check_pages_dirty(struct bio *bio);
|
||||
extern void bio_release_pages(struct bio *bio);
|
||||
extern struct bio *bio_copy_user(struct request_queue *, unsigned long, unsigned int, int);
|
||||
extern int bio_uncopy_user(struct bio *);
|
||||
void zero_fill_bio(struct bio *bio);
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
/*
|
||||
* remember to add offset! and never ever reenable interrupts between a
|
||||
* bvec_kmap_irq and bvec_kunmap_irq!!
|
||||
*
|
||||
* This function MUST be inlined - it plays with the CPU interrupt flags.
|
||||
*/
|
||||
static inline char *bvec_kmap_irq(struct bio_vec *bvec, unsigned long *flags)
|
||||
{
|
||||
unsigned long addr;
|
||||
|
||||
/*
|
||||
* might not be a highmem page, but the preempt/irq count
|
||||
* balancing is a lot nicer this way
|
||||
*/
|
||||
local_irq_save(*flags);
|
||||
addr = (unsigned long) kmap_atomic(bvec->bv_page, KM_BIO_SRC_IRQ);
|
||||
|
||||
BUG_ON(addr & ~PAGE_MASK);
|
||||
|
||||
return (char *) addr + bvec->bv_offset;
|
||||
}
|
||||
|
||||
static inline void bvec_kunmap_irq(char *buffer, unsigned long *flags)
|
||||
{
|
||||
unsigned long ptr = (unsigned long) buffer & PAGE_MASK;
|
||||
|
||||
kunmap_atomic((void *) ptr, KM_BIO_SRC_IRQ);
|
||||
local_irq_restore(*flags);
|
||||
}
|
||||
|
||||
#else
|
||||
#define bvec_kmap_irq(bvec, flags) (page_address((bvec)->bv_page) + (bvec)->bv_offset)
|
||||
#define bvec_kunmap_irq(buf, flags) do { *(flags) = 0; } while (0)
|
||||
#endif
|
||||
|
||||
static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
|
||||
unsigned long *flags)
|
||||
{
|
||||
return bvec_kmap_irq(bio_iovec_idx(bio, idx), flags);
|
||||
}
|
||||
#define __bio_kunmap_irq(buf, flags) bvec_kunmap_irq(buf, flags)
|
||||
|
||||
#define bio_kmap_irq(bio, flags) \
|
||||
__bio_kmap_irq((bio), (bio)->bi_idx, (flags))
|
||||
#define bio_kunmap_irq(buf,flags) __bio_kunmap_irq(buf, flags)
|
||||
|
||||
#endif /* __LINUX_BIO_H */
|
||||
77
include/linux/bit_spinlock.h
Normal file
77
include/linux/bit_spinlock.h
Normal file
@@ -0,0 +1,77 @@
|
||||
#ifndef __LINUX_BIT_SPINLOCK_H
|
||||
#define __LINUX_BIT_SPINLOCK_H
|
||||
|
||||
/*
|
||||
* bit-based spin_lock()
|
||||
*
|
||||
* Don't use this unless you really need to: spin_lock() and spin_unlock()
|
||||
* are significantly faster.
|
||||
*/
|
||||
static inline void bit_spin_lock(int bitnum, unsigned long *addr)
|
||||
{
|
||||
/*
|
||||
* Assuming the lock is uncontended, this never enters
|
||||
* the body of the outer loop. If it is contended, then
|
||||
* within the inner loop a non-atomic test is used to
|
||||
* busywait with less bus contention for a good time to
|
||||
* attempt to acquire the lock bit.
|
||||
*/
|
||||
preempt_disable();
|
||||
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
||||
while (test_and_set_bit(bitnum, addr)) {
|
||||
while (test_bit(bitnum, addr)) {
|
||||
preempt_enable();
|
||||
cpu_relax();
|
||||
preempt_disable();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
__acquire(bitlock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if it was acquired
|
||||
*/
|
||||
static inline int bit_spin_trylock(int bitnum, unsigned long *addr)
|
||||
{
|
||||
preempt_disable();
|
||||
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
||||
if (test_and_set_bit(bitnum, addr)) {
|
||||
preempt_enable();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
__acquire(bitlock);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* bit-based spin_unlock()
|
||||
*/
|
||||
static inline void bit_spin_unlock(int bitnum, unsigned long *addr)
|
||||
{
|
||||
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
||||
BUG_ON(!test_bit(bitnum, addr));
|
||||
smp_mb__before_clear_bit();
|
||||
clear_bit(bitnum, addr);
|
||||
#endif
|
||||
preempt_enable();
|
||||
__release(bitlock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return true if the lock is held.
|
||||
*/
|
||||
static inline int bit_spin_is_locked(int bitnum, unsigned long *addr)
|
||||
{
|
||||
#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
|
||||
return test_bit(bitnum, addr);
|
||||
#elif defined CONFIG_PREEMPT
|
||||
return preempt_count();
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* __LINUX_BIT_SPINLOCK_H */
|
||||
|
||||
284
include/linux/bitmap.h
Normal file
284
include/linux/bitmap.h
Normal file
@@ -0,0 +1,284 @@
|
||||
#ifndef __LINUX_BITMAP_H
|
||||
#define __LINUX_BITMAP_H
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/bitops.h>
|
||||
#include <linux/string.h>
|
||||
|
||||
/*
|
||||
* bitmaps provide bit arrays that consume one or more unsigned
|
||||
* longs. The bitmap interface and available operations are listed
|
||||
* here, in bitmap.h
|
||||
*
|
||||
* Function implementations generic to all architectures are in
|
||||
* lib/bitmap.c. Functions implementations that are architecture
|
||||
* specific are in various include/asm-<arch>/bitops.h headers
|
||||
* and other arch/<arch> specific files.
|
||||
*
|
||||
* See lib/bitmap.c for more details.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The available bitmap operations and their rough meaning in the
|
||||
* case that the bitmap is a single unsigned long are thus:
|
||||
*
|
||||
* Note that nbits should be always a compile time evaluable constant.
|
||||
* Otherwise many inlines will generate horrible code.
|
||||
*
|
||||
* bitmap_zero(dst, nbits) *dst = 0UL
|
||||
* bitmap_fill(dst, nbits) *dst = ~0UL
|
||||
* bitmap_copy(dst, src, nbits) *dst = *src
|
||||
* bitmap_and(dst, src1, src2, nbits) *dst = *src1 & *src2
|
||||
* bitmap_or(dst, src1, src2, nbits) *dst = *src1 | *src2
|
||||
* bitmap_xor(dst, src1, src2, nbits) *dst = *src1 ^ *src2
|
||||
* bitmap_andnot(dst, src1, src2, nbits) *dst = *src1 & ~(*src2)
|
||||
* bitmap_complement(dst, src, nbits) *dst = ~(*src)
|
||||
* bitmap_equal(src1, src2, nbits) Are *src1 and *src2 equal?
|
||||
* bitmap_intersects(src1, src2, nbits) Do *src1 and *src2 overlap?
|
||||
* bitmap_subset(src1, src2, nbits) Is *src1 a subset of *src2?
|
||||
* bitmap_empty(src, nbits) Are all bits zero in *src?
|
||||
* bitmap_full(src, nbits) Are all bits set in *src?
|
||||
* bitmap_weight(src, nbits) Hamming Weight: number set bits
|
||||
* bitmap_shift_right(dst, src, n, nbits) *dst = *src >> n
|
||||
* bitmap_shift_left(dst, src, n, nbits) *dst = *src << n
|
||||
* bitmap_remap(dst, src, old, new, nbits) *dst = map(old, new)(src)
|
||||
* bitmap_bitremap(oldbit, old, new, nbits) newbit = map(old, new)(oldbit)
|
||||
* bitmap_scnprintf(buf, len, src, nbits) Print bitmap src to buf
|
||||
* bitmap_parse(buf, buflen, dst, nbits) Parse bitmap dst from kernel buf
|
||||
* bitmap_parse_user(ubuf, ulen, dst, nbits) Parse bitmap dst from user buf
|
||||
* bitmap_scnlistprintf(buf, len, src, nbits) Print bitmap src as list to buf
|
||||
* bitmap_parselist(buf, dst, nbits) Parse bitmap dst from list
|
||||
* bitmap_find_free_region(bitmap, bits, order) Find and allocate bit region
|
||||
* bitmap_release_region(bitmap, pos, order) Free specified bit region
|
||||
* bitmap_allocate_region(bitmap, pos, order) Allocate specified bit region
|
||||
*/
|
||||
|
||||
/*
|
||||
* Also the following operations in asm/bitops.h apply to bitmaps.
|
||||
*
|
||||
* set_bit(bit, addr) *addr |= bit
|
||||
* clear_bit(bit, addr) *addr &= ~bit
|
||||
* change_bit(bit, addr) *addr ^= bit
|
||||
* test_bit(bit, addr) Is bit set in *addr?
|
||||
* test_and_set_bit(bit, addr) Set bit and return old value
|
||||
* test_and_clear_bit(bit, addr) Clear bit and return old value
|
||||
* test_and_change_bit(bit, addr) Change bit and return old value
|
||||
* find_first_zero_bit(addr, nbits) Position first zero bit in *addr
|
||||
* find_first_bit(addr, nbits) Position first set bit in *addr
|
||||
* find_next_zero_bit(addr, nbits, bit) Position next zero bit in *addr >= bit
|
||||
* find_next_bit(addr, nbits, bit) Position next set bit in *addr >= bit
|
||||
*/
|
||||
|
||||
/*
|
||||
* The DECLARE_BITMAP(name,bits) macro, in linux/types.h, can be used
|
||||
* to declare an array named 'name' of just enough unsigned longs to
|
||||
* contain all bit positions from 0 to 'bits' - 1.
|
||||
*/
|
||||
|
||||
/*
|
||||
* lib/bitmap.c provides these functions:
|
||||
*/
|
||||
|
||||
extern int __bitmap_empty(const unsigned long *bitmap, int bits);
|
||||
extern int __bitmap_full(const unsigned long *bitmap, int bits);
|
||||
extern int __bitmap_equal(const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern void __bitmap_complement(unsigned long *dst, const unsigned long *src,
|
||||
int bits);
|
||||
extern void __bitmap_shift_right(unsigned long *dst,
|
||||
const unsigned long *src, int shift, int bits);
|
||||
extern void __bitmap_shift_left(unsigned long *dst,
|
||||
const unsigned long *src, int shift, int bits);
|
||||
extern void __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern void __bitmap_xor(unsigned long *dst, const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern void __bitmap_andnot(unsigned long *dst, const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern int __bitmap_intersects(const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern int __bitmap_subset(const unsigned long *bitmap1,
|
||||
const unsigned long *bitmap2, int bits);
|
||||
extern int __bitmap_weight(const unsigned long *bitmap, int bits);
|
||||
|
||||
extern int bitmap_scnprintf(char *buf, unsigned int len,
|
||||
const unsigned long *src, int nbits);
|
||||
extern int __bitmap_parse(const char *buf, unsigned int buflen, int is_user,
|
||||
unsigned long *dst, int nbits);
|
||||
extern int bitmap_parse_user(const char __user *ubuf, unsigned int ulen,
|
||||
unsigned long *dst, int nbits);
|
||||
extern int bitmap_scnlistprintf(char *buf, unsigned int len,
|
||||
const unsigned long *src, int nbits);
|
||||
extern int bitmap_parselist(const char *buf, unsigned long *maskp,
|
||||
int nmaskbits);
|
||||
extern void bitmap_remap(unsigned long *dst, const unsigned long *src,
|
||||
const unsigned long *old, const unsigned long *new, int bits);
|
||||
extern int bitmap_bitremap(int oldbit,
|
||||
const unsigned long *old, const unsigned long *new, int bits);
|
||||
extern int bitmap_find_free_region(unsigned long *bitmap, int bits, int order);
|
||||
extern void bitmap_release_region(unsigned long *bitmap, int pos, int order);
|
||||
extern int bitmap_allocate_region(unsigned long *bitmap, int pos, int order);
|
||||
|
||||
#define BITMAP_LAST_WORD_MASK(nbits) \
|
||||
( \
|
||||
((nbits) % BITS_PER_LONG) ? \
|
||||
(1UL<<((nbits) % BITS_PER_LONG))-1 : ~0UL \
|
||||
)
|
||||
|
||||
static inline void bitmap_zero(unsigned long *dst, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = 0UL;
|
||||
else {
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memset(dst, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bitmap_fill(unsigned long *dst, int nbits)
|
||||
{
|
||||
size_t nlongs = BITS_TO_LONGS(nbits);
|
||||
if (nlongs > 1) {
|
||||
int len = (nlongs - 1) * sizeof(unsigned long);
|
||||
memset(dst, 0xff, len);
|
||||
}
|
||||
dst[nlongs - 1] = BITMAP_LAST_WORD_MASK(nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,
|
||||
int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src;
|
||||
else {
|
||||
int len = BITS_TO_LONGS(nbits) * sizeof(unsigned long);
|
||||
memcpy(dst, src, len);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void bitmap_and(unsigned long *dst, const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src1 & *src2;
|
||||
else
|
||||
__bitmap_and(dst, src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_or(unsigned long *dst, const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src1 | *src2;
|
||||
else
|
||||
__bitmap_or(dst, src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_xor(unsigned long *dst, const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src1 ^ *src2;
|
||||
else
|
||||
__bitmap_xor(dst, src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_andnot(unsigned long *dst, const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src1 & ~(*src2);
|
||||
else
|
||||
__bitmap_andnot(dst, src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_complement(unsigned long *dst, const unsigned long *src,
|
||||
int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = ~(*src) & BITMAP_LAST_WORD_MASK(nbits);
|
||||
else
|
||||
__bitmap_complement(dst, src, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_equal(const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return ! ((*src1 ^ *src2) & BITMAP_LAST_WORD_MASK(nbits));
|
||||
else
|
||||
return __bitmap_equal(src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_intersects(const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return ((*src1 & *src2) & BITMAP_LAST_WORD_MASK(nbits)) != 0;
|
||||
else
|
||||
return __bitmap_intersects(src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_subset(const unsigned long *src1,
|
||||
const unsigned long *src2, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return ! ((*src1 & ~(*src2)) & BITMAP_LAST_WORD_MASK(nbits));
|
||||
else
|
||||
return __bitmap_subset(src1, src2, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_empty(const unsigned long *src, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return ! (*src & BITMAP_LAST_WORD_MASK(nbits));
|
||||
else
|
||||
return __bitmap_empty(src, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_full(const unsigned long *src, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return ! (~(*src) & BITMAP_LAST_WORD_MASK(nbits));
|
||||
else
|
||||
return __bitmap_full(src, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_weight(const unsigned long *src, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
return hweight_long(*src & BITMAP_LAST_WORD_MASK(nbits));
|
||||
return __bitmap_weight(src, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_shift_right(unsigned long *dst,
|
||||
const unsigned long *src, int n, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = *src >> n;
|
||||
else
|
||||
__bitmap_shift_right(dst, src, n, nbits);
|
||||
}
|
||||
|
||||
static inline void bitmap_shift_left(unsigned long *dst,
|
||||
const unsigned long *src, int n, int nbits)
|
||||
{
|
||||
if (nbits <= BITS_PER_LONG)
|
||||
*dst = (*src << n) & BITMAP_LAST_WORD_MASK(nbits);
|
||||
else
|
||||
__bitmap_shift_left(dst, src, n, nbits);
|
||||
}
|
||||
|
||||
static inline int bitmap_parse(const char *buf, unsigned int buflen,
|
||||
unsigned long *maskp, int nmaskbits)
|
||||
{
|
||||
return __bitmap_parse(buf, buflen, 0, maskp, nmaskbits);
|
||||
}
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#endif /* __LINUX_BITMAP_H */
|
||||
61
include/linux/bitops.h
Normal file
61
include/linux/bitops.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#ifndef _LINUX_BITOPS_H
|
||||
#define _LINUX_BITOPS_H
|
||||
#include <asm/types.h>
|
||||
|
||||
/*
|
||||
* Include this here because some architectures need generic_ffs/fls in
|
||||
* scope
|
||||
*/
|
||||
#include <asm/bitops.h>
|
||||
|
||||
static __inline__ int get_bitmask_order(unsigned int count)
|
||||
{
|
||||
int order;
|
||||
|
||||
order = fls(count);
|
||||
return order; /* We could be slightly more clever with -1 here... */
|
||||
}
|
||||
|
||||
static __inline__ int get_count_order(unsigned int count)
|
||||
{
|
||||
int order;
|
||||
|
||||
order = fls(count) - 1;
|
||||
if (count & (count - 1))
|
||||
order++;
|
||||
return order;
|
||||
}
|
||||
|
||||
static inline unsigned long hweight_long(unsigned long w)
|
||||
{
|
||||
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
|
||||
}
|
||||
|
||||
/**
|
||||
* rol32 - rotate a 32-bit value left
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u32 rol32(__u32 word, unsigned int shift)
|
||||
{
|
||||
return (word << shift) | (word >> (32 - shift));
|
||||
}
|
||||
|
||||
/**
|
||||
* ror32 - rotate a 32-bit value right
|
||||
* @word: value to rotate
|
||||
* @shift: bits to roll
|
||||
*/
|
||||
static inline __u32 ror32(__u32 word, unsigned int shift)
|
||||
{
|
||||
return (word >> shift) | (word << (32 - shift));
|
||||
}
|
||||
|
||||
static inline unsigned fls_long(unsigned long l)
|
||||
{
|
||||
if (sizeof(l) == 4)
|
||||
return fls(l);
|
||||
return fls64(l);
|
||||
}
|
||||
|
||||
#endif
|
||||
15
include/linux/bitrev.h
Normal file
15
include/linux/bitrev.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _LINUX_BITREV_H
|
||||
#define _LINUX_BITREV_H
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
extern u8 const byte_rev_table[256];
|
||||
|
||||
static inline u8 bitrev8(u8 byte)
|
||||
{
|
||||
return byte_rev_table[byte];
|
||||
}
|
||||
|
||||
extern u32 bitrev32(u32 in);
|
||||
|
||||
#endif /* _LINUX_BITREV_H */
|
||||
886
include/linux/blkdev.h
Normal file
886
include/linux/blkdev.h
Normal file
@@ -0,0 +1,886 @@
|
||||
#ifndef _LINUX_BLKDEV_H
|
||||
#define _LINUX_BLKDEV_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/major.h>
|
||||
#include <linux/genhd.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/backing-dev.h>
|
||||
#include <linux/wait.h>
|
||||
#include <linux/mempool.h>
|
||||
#include <linux/bio.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/stringify.h>
|
||||
|
||||
#include <asm/scatterlist.h>
|
||||
|
||||
#ifdef CONFIG_LBD
|
||||
# include <asm/div64.h>
|
||||
# define sector_div(a, b) do_div(a, b)
|
||||
#else
|
||||
# define sector_div(n, b)( \
|
||||
{ \
|
||||
int _res; \
|
||||
_res = (n) % (b); \
|
||||
(n) /= (b); \
|
||||
_res; \
|
||||
} \
|
||||
)
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
|
||||
struct scsi_ioctl_command;
|
||||
|
||||
struct request_queue;
|
||||
typedef struct request_queue request_queue_t;
|
||||
struct elevator_queue;
|
||||
typedef struct elevator_queue elevator_t;
|
||||
struct request_pm_state;
|
||||
struct blk_trace;
|
||||
|
||||
#define BLKDEV_MIN_RQ 4
|
||||
#define BLKDEV_MAX_RQ 128 /* Default maximum */
|
||||
|
||||
/*
|
||||
* This is the per-process anticipatory I/O scheduler state.
|
||||
*/
|
||||
struct as_io_context {
|
||||
spinlock_t lock;
|
||||
|
||||
void (*dtor)(struct as_io_context *aic); /* destructor */
|
||||
void (*exit)(struct as_io_context *aic); /* called on task exit */
|
||||
|
||||
unsigned long state;
|
||||
atomic_t nr_queued; /* queued reads & sync writes */
|
||||
atomic_t nr_dispatched; /* number of requests gone to the drivers */
|
||||
|
||||
/* IO History tracking */
|
||||
/* Thinktime */
|
||||
unsigned long last_end_request;
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
/* Layout pattern */
|
||||
unsigned int seek_samples;
|
||||
sector_t last_request_pos;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
};
|
||||
|
||||
struct cfq_queue;
|
||||
struct cfq_io_context {
|
||||
struct rb_node rb_node;
|
||||
void *key;
|
||||
|
||||
struct cfq_queue *cfqq[2];
|
||||
|
||||
struct io_context *ioc;
|
||||
|
||||
unsigned long last_end_request;
|
||||
sector_t last_request_pos;
|
||||
|
||||
unsigned long ttime_total;
|
||||
unsigned long ttime_samples;
|
||||
unsigned long ttime_mean;
|
||||
|
||||
unsigned int seek_samples;
|
||||
u64 seek_total;
|
||||
sector_t seek_mean;
|
||||
|
||||
struct list_head queue_list;
|
||||
|
||||
void (*dtor)(struct io_context *); /* destructor */
|
||||
void (*exit)(struct io_context *); /* called on task exit */
|
||||
};
|
||||
|
||||
/*
|
||||
* This is the per-process I/O subsystem state. It is refcounted and
|
||||
* kmalloc'ed. Currently all fields are modified in process io context
|
||||
* (apart from the atomic refcount), so require no locking.
|
||||
*/
|
||||
struct io_context {
|
||||
atomic_t refcount;
|
||||
struct task_struct *task;
|
||||
|
||||
unsigned int ioprio_changed;
|
||||
|
||||
/*
|
||||
* For request batching
|
||||
*/
|
||||
unsigned long last_waited; /* Time last woken after wait for request */
|
||||
int nr_batch_requests; /* Number of requests left in the batch */
|
||||
|
||||
struct as_io_context *aic;
|
||||
struct rb_root cic_root;
|
||||
};
|
||||
|
||||
void put_io_context(struct io_context *ioc);
|
||||
void exit_io_context(void);
|
||||
struct io_context *get_io_context(gfp_t gfp_flags, int node);
|
||||
void copy_io_context(struct io_context **pdst, struct io_context **psrc);
|
||||
void swap_io_context(struct io_context **ioc1, struct io_context **ioc2);
|
||||
|
||||
struct request;
|
||||
typedef void (rq_end_io_fn)(struct request *, int);
|
||||
|
||||
struct request_list {
|
||||
int count[2];
|
||||
int starved[2];
|
||||
int elvpriv;
|
||||
mempool_t *rq_pool;
|
||||
wait_queue_head_t wait[2];
|
||||
};
|
||||
|
||||
/*
|
||||
* request command types
|
||||
*/
|
||||
enum rq_cmd_type_bits {
|
||||
REQ_TYPE_FS = 1, /* fs request */
|
||||
REQ_TYPE_BLOCK_PC, /* scsi command */
|
||||
REQ_TYPE_SENSE, /* sense request */
|
||||
REQ_TYPE_PM_SUSPEND, /* suspend request */
|
||||
REQ_TYPE_PM_RESUME, /* resume request */
|
||||
REQ_TYPE_PM_SHUTDOWN, /* shutdown request */
|
||||
REQ_TYPE_FLUSH, /* flush request */
|
||||
REQ_TYPE_SPECIAL, /* driver defined type */
|
||||
REQ_TYPE_LINUX_BLOCK, /* generic block layer message */
|
||||
/*
|
||||
* for ATA/ATAPI devices. this really doesn't belong here, ide should
|
||||
* use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver
|
||||
* private REQ_LB opcodes to differentiate what type of request this is
|
||||
*/
|
||||
REQ_TYPE_ATA_CMD,
|
||||
REQ_TYPE_ATA_TASK,
|
||||
REQ_TYPE_ATA_TASKFILE,
|
||||
REQ_TYPE_ATA_PC,
|
||||
};
|
||||
|
||||
/*
|
||||
* For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being
|
||||
* sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a
|
||||
* SCSI cdb.
|
||||
*
|
||||
* 0x00 -> 0x3f are driver private, to be used for whatever purpose they need,
|
||||
* typically to differentiate REQ_TYPE_SPECIAL requests.
|
||||
*
|
||||
*/
|
||||
enum {
|
||||
/*
|
||||
* just examples for now
|
||||
*/
|
||||
REQ_LB_OP_EJECT = 0x40, /* eject request */
|
||||
REQ_LB_OP_FLUSH = 0x41, /* flush device */
|
||||
};
|
||||
|
||||
/*
|
||||
* request type modified bits. first three bits match BIO_RW* bits, important
|
||||
*/
|
||||
enum rq_flag_bits {
|
||||
__REQ_RW, /* not set, read. set, write */
|
||||
__REQ_FAILFAST, /* no low level driver retries */
|
||||
__REQ_SORTED, /* elevator knows about this request */
|
||||
__REQ_SOFTBARRIER, /* may not be passed by ioscheduler */
|
||||
__REQ_HARDBARRIER, /* may not be passed by drive either */
|
||||
__REQ_FUA, /* forced unit access */
|
||||
__REQ_NOMERGE, /* don't touch this for merging */
|
||||
__REQ_STARTED, /* drive already may have started this one */
|
||||
__REQ_DONTPREP, /* don't call prep for this one */
|
||||
__REQ_QUEUED, /* uses queueing */
|
||||
__REQ_ELVPRIV, /* elevator private data attached */
|
||||
__REQ_FAILED, /* set if the request failed */
|
||||
__REQ_QUIET, /* don't worry about errors */
|
||||
__REQ_PREEMPT, /* set for "ide_preempt" requests */
|
||||
__REQ_ORDERED_COLOR, /* is before or after barrier */
|
||||
__REQ_RW_SYNC, /* request is sync (O_DIRECT) */
|
||||
__REQ_ALLOCED, /* request came from our alloc pool */
|
||||
__REQ_RW_META, /* metadata io request */
|
||||
__REQ_NR_BITS, /* stops here */
|
||||
};
|
||||
|
||||
#define REQ_RW (1 << __REQ_RW)
|
||||
#define REQ_FAILFAST (1 << __REQ_FAILFAST)
|
||||
#define REQ_SORTED (1 << __REQ_SORTED)
|
||||
#define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER)
|
||||
#define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER)
|
||||
#define REQ_FUA (1 << __REQ_FUA)
|
||||
#define REQ_NOMERGE (1 << __REQ_NOMERGE)
|
||||
#define REQ_STARTED (1 << __REQ_STARTED)
|
||||
#define REQ_DONTPREP (1 << __REQ_DONTPREP)
|
||||
#define REQ_QUEUED (1 << __REQ_QUEUED)
|
||||
#define REQ_ELVPRIV (1 << __REQ_ELVPRIV)
|
||||
#define REQ_FAILED (1 << __REQ_FAILED)
|
||||
#define REQ_QUIET (1 << __REQ_QUIET)
|
||||
#define REQ_PREEMPT (1 << __REQ_PREEMPT)
|
||||
#define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR)
|
||||
#define REQ_RW_SYNC (1 << __REQ_RW_SYNC)
|
||||
#define REQ_ALLOCED (1 << __REQ_ALLOCED)
|
||||
#define REQ_RW_META (1 << __REQ_RW_META)
|
||||
|
||||
#define BLK_MAX_CDB 16
|
||||
|
||||
/*
|
||||
* try to put the fields that are referenced together in the same cacheline
|
||||
*/
|
||||
struct request {
|
||||
struct list_head queuelist;
|
||||
struct list_head donelist;
|
||||
|
||||
request_queue_t *q;
|
||||
|
||||
unsigned int cmd_flags;
|
||||
enum rq_cmd_type_bits cmd_type;
|
||||
|
||||
/* Maintain bio traversal state for part by part I/O submission.
|
||||
* hard_* are block layer internals, no driver should touch them!
|
||||
*/
|
||||
|
||||
sector_t sector; /* next sector to submit */
|
||||
sector_t hard_sector; /* next sector to complete */
|
||||
unsigned long nr_sectors; /* no. of sectors left to submit */
|
||||
unsigned long hard_nr_sectors; /* no. of sectors left to complete */
|
||||
/* no. of sectors left to submit in the current segment */
|
||||
unsigned int current_nr_sectors;
|
||||
|
||||
/* no. of sectors left to complete in the current segment */
|
||||
unsigned int hard_cur_sectors;
|
||||
|
||||
struct bio *bio;
|
||||
struct bio *biotail;
|
||||
|
||||
struct hlist_node hash; /* merge hash */
|
||||
/*
|
||||
* The rb_node is only used inside the io scheduler, requests
|
||||
* are pruned when moved to the dispatch queue. So let the
|
||||
* completion_data share space with the rb_node.
|
||||
*/
|
||||
union {
|
||||
struct rb_node rb_node; /* sort/lookup */
|
||||
void *completion_data;
|
||||
};
|
||||
|
||||
/*
|
||||
* two pointers are available for the IO schedulers, if they need
|
||||
* more they have to dynamically allocate it.
|
||||
*/
|
||||
void *elevator_private;
|
||||
void *elevator_private2;
|
||||
|
||||
struct gendisk *rq_disk;
|
||||
unsigned long start_time;
|
||||
|
||||
/* Number of scatter-gather DMA addr+len pairs after
|
||||
* physical address coalescing is performed.
|
||||
*/
|
||||
unsigned short nr_phys_segments;
|
||||
|
||||
/* Number of scatter-gather addr+len pairs after
|
||||
* physical and DMA remapping hardware coalescing is performed.
|
||||
* This is the number of scatter-gather entries the driver
|
||||
* will actually have to deal with after DMA mapping is done.
|
||||
*/
|
||||
unsigned short nr_hw_segments;
|
||||
|
||||
unsigned short ioprio;
|
||||
|
||||
void *special;
|
||||
char *buffer;
|
||||
|
||||
int tag;
|
||||
int errors;
|
||||
|
||||
int ref_count;
|
||||
|
||||
/*
|
||||
* when request is used as a packet command carrier
|
||||
*/
|
||||
unsigned int cmd_len;
|
||||
unsigned char cmd[BLK_MAX_CDB];
|
||||
|
||||
unsigned int data_len;
|
||||
unsigned int sense_len;
|
||||
void *data;
|
||||
void *sense;
|
||||
|
||||
unsigned int timeout;
|
||||
int retries;
|
||||
|
||||
/*
|
||||
* completion callback.
|
||||
*/
|
||||
rq_end_io_fn *end_io;
|
||||
void *end_io_data;
|
||||
};
|
||||
|
||||
/*
|
||||
* State information carried for REQ_TYPE_PM_SUSPEND and REQ_TYPE_PM_RESUME
|
||||
* requests. Some step values could eventually be made generic.
|
||||
*/
|
||||
struct request_pm_state
|
||||
{
|
||||
/* PM state machine step value, currently driver specific */
|
||||
int pm_step;
|
||||
/* requested PM state value (S1, S2, S3, S4, ...) */
|
||||
u32 pm_state;
|
||||
void* data; /* for driver use */
|
||||
};
|
||||
|
||||
#include <linux/elevator.h>
|
||||
|
||||
typedef void (request_fn_proc) (request_queue_t *q);
|
||||
typedef int (make_request_fn) (request_queue_t *q, struct bio *bio);
|
||||
typedef int (prep_rq_fn) (request_queue_t *, struct request *);
|
||||
typedef void (unplug_fn) (request_queue_t *);
|
||||
|
||||
struct bio_vec;
|
||||
typedef int (merge_bvec_fn) (request_queue_t *, struct bio *, struct bio_vec *);
|
||||
typedef int (issue_flush_fn) (request_queue_t *, struct gendisk *, sector_t *);
|
||||
typedef void (prepare_flush_fn) (request_queue_t *, struct request *);
|
||||
typedef void (softirq_done_fn)(struct request *);
|
||||
|
||||
enum blk_queue_state {
|
||||
Queue_down,
|
||||
Queue_up,
|
||||
};
|
||||
|
||||
struct blk_queue_tag {
|
||||
struct request **tag_index; /* map of busy tags */
|
||||
unsigned long *tag_map; /* bit map of free/busy tags */
|
||||
struct list_head busy_list; /* fifo list of busy tags */
|
||||
int busy; /* current depth */
|
||||
int max_depth; /* what we will send to device */
|
||||
int real_max_depth; /* what the array can hold */
|
||||
atomic_t refcnt; /* map can be shared */
|
||||
};
|
||||
|
||||
struct request_queue
|
||||
{
|
||||
/*
|
||||
* Together with queue_head for cacheline sharing
|
||||
*/
|
||||
struct list_head queue_head;
|
||||
struct request *last_merge;
|
||||
elevator_t *elevator;
|
||||
|
||||
/*
|
||||
* the queue request freelist, one for reads and one for writes
|
||||
*/
|
||||
struct request_list rq;
|
||||
|
||||
request_fn_proc *request_fn;
|
||||
make_request_fn *make_request_fn;
|
||||
prep_rq_fn *prep_rq_fn;
|
||||
unplug_fn *unplug_fn;
|
||||
merge_bvec_fn *merge_bvec_fn;
|
||||
issue_flush_fn *issue_flush_fn;
|
||||
prepare_flush_fn *prepare_flush_fn;
|
||||
softirq_done_fn *softirq_done_fn;
|
||||
|
||||
/*
|
||||
* Dispatch queue sorting
|
||||
*/
|
||||
sector_t end_sector;
|
||||
struct request *boundary_rq;
|
||||
|
||||
/*
|
||||
* Auto-unplugging state
|
||||
*/
|
||||
struct timer_list unplug_timer;
|
||||
int unplug_thresh; /* After this many requests */
|
||||
unsigned long unplug_delay; /* After this many jiffies */
|
||||
struct work_struct unplug_work;
|
||||
|
||||
struct backing_dev_info backing_dev_info;
|
||||
|
||||
/*
|
||||
* The queue owner gets to use this for whatever they like.
|
||||
* ll_rw_blk doesn't touch it.
|
||||
*/
|
||||
void *queuedata;
|
||||
|
||||
/*
|
||||
* queue needs bounce pages for pages above this limit
|
||||
*/
|
||||
unsigned long bounce_pfn;
|
||||
gfp_t bounce_gfp;
|
||||
|
||||
/*
|
||||
* various queue flags, see QUEUE_* below
|
||||
*/
|
||||
unsigned long queue_flags;
|
||||
|
||||
/*
|
||||
* protects queue structures from reentrancy. ->__queue_lock should
|
||||
* _never_ be used directly, it is queue private. always use
|
||||
* ->queue_lock.
|
||||
*/
|
||||
spinlock_t __queue_lock;
|
||||
spinlock_t *queue_lock;
|
||||
|
||||
/*
|
||||
* queue kobject
|
||||
*/
|
||||
struct kobject kobj;
|
||||
|
||||
/*
|
||||
* queue settings
|
||||
*/
|
||||
unsigned long nr_requests; /* Max # of requests */
|
||||
unsigned int nr_congestion_on;
|
||||
unsigned int nr_congestion_off;
|
||||
unsigned int nr_batching;
|
||||
|
||||
unsigned int max_sectors;
|
||||
unsigned int max_hw_sectors;
|
||||
unsigned short max_phys_segments;
|
||||
unsigned short max_hw_segments;
|
||||
unsigned short hardsect_size;
|
||||
unsigned int max_segment_size;
|
||||
|
||||
unsigned long seg_boundary_mask;
|
||||
unsigned int dma_alignment;
|
||||
|
||||
struct blk_queue_tag *queue_tags;
|
||||
|
||||
unsigned int nr_sorted;
|
||||
unsigned int in_flight;
|
||||
|
||||
/*
|
||||
* sg stuff
|
||||
*/
|
||||
unsigned int sg_timeout;
|
||||
unsigned int sg_reserved_size;
|
||||
int node;
|
||||
#ifdef CONFIG_BLK_DEV_IO_TRACE
|
||||
struct blk_trace *blk_trace;
|
||||
#endif
|
||||
/*
|
||||
* reserved for flush operations
|
||||
*/
|
||||
unsigned int ordered, next_ordered, ordseq;
|
||||
int orderr, ordcolor;
|
||||
struct request pre_flush_rq, bar_rq, post_flush_rq;
|
||||
struct request *orig_bar_rq;
|
||||
unsigned int bi_size;
|
||||
|
||||
struct mutex sysfs_lock;
|
||||
};
|
||||
|
||||
#define QUEUE_FLAG_CLUSTER 0 /* cluster several segments into 1 */
|
||||
#define QUEUE_FLAG_QUEUED 1 /* uses generic tag queueing */
|
||||
#define QUEUE_FLAG_STOPPED 2 /* queue is stopped */
|
||||
#define QUEUE_FLAG_READFULL 3 /* write queue has been filled */
|
||||
#define QUEUE_FLAG_WRITEFULL 4 /* read queue has been filled */
|
||||
#define QUEUE_FLAG_DEAD 5 /* queue being torn down */
|
||||
#define QUEUE_FLAG_REENTER 6 /* Re-entrancy avoidance */
|
||||
#define QUEUE_FLAG_PLUGGED 7 /* queue is plugged */
|
||||
#define QUEUE_FLAG_ELVSWITCH 8 /* don't use elevator, just do FIFO */
|
||||
|
||||
enum {
|
||||
/*
|
||||
* Hardbarrier is supported with one of the following methods.
|
||||
*
|
||||
* NONE : hardbarrier unsupported
|
||||
* DRAIN : ordering by draining is enough
|
||||
* DRAIN_FLUSH : ordering by draining w/ pre and post flushes
|
||||
* DRAIN_FUA : ordering by draining w/ pre flush and FUA write
|
||||
* TAG : ordering by tag is enough
|
||||
* TAG_FLUSH : ordering by tag w/ pre and post flushes
|
||||
* TAG_FUA : ordering by tag w/ pre flush and FUA write
|
||||
*/
|
||||
QUEUE_ORDERED_NONE = 0x00,
|
||||
QUEUE_ORDERED_DRAIN = 0x01,
|
||||
QUEUE_ORDERED_TAG = 0x02,
|
||||
|
||||
QUEUE_ORDERED_PREFLUSH = 0x10,
|
||||
QUEUE_ORDERED_POSTFLUSH = 0x20,
|
||||
QUEUE_ORDERED_FUA = 0x40,
|
||||
|
||||
QUEUE_ORDERED_DRAIN_FLUSH = QUEUE_ORDERED_DRAIN |
|
||||
QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
|
||||
QUEUE_ORDERED_DRAIN_FUA = QUEUE_ORDERED_DRAIN |
|
||||
QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
|
||||
QUEUE_ORDERED_TAG_FLUSH = QUEUE_ORDERED_TAG |
|
||||
QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_POSTFLUSH,
|
||||
QUEUE_ORDERED_TAG_FUA = QUEUE_ORDERED_TAG |
|
||||
QUEUE_ORDERED_PREFLUSH | QUEUE_ORDERED_FUA,
|
||||
|
||||
/*
|
||||
* Ordered operation sequence
|
||||
*/
|
||||
QUEUE_ORDSEQ_STARTED = 0x01, /* flushing in progress */
|
||||
QUEUE_ORDSEQ_DRAIN = 0x02, /* waiting for the queue to be drained */
|
||||
QUEUE_ORDSEQ_PREFLUSH = 0x04, /* pre-flushing in progress */
|
||||
QUEUE_ORDSEQ_BAR = 0x08, /* original barrier req in progress */
|
||||
QUEUE_ORDSEQ_POSTFLUSH = 0x10, /* post-flushing in progress */
|
||||
QUEUE_ORDSEQ_DONE = 0x20,
|
||||
};
|
||||
|
||||
#define blk_queue_plugged(q) test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
|
||||
#define blk_queue_tagged(q) test_bit(QUEUE_FLAG_QUEUED, &(q)->queue_flags)
|
||||
#define blk_queue_stopped(q) test_bit(QUEUE_FLAG_STOPPED, &(q)->queue_flags)
|
||||
#define blk_queue_flushing(q) ((q)->ordseq)
|
||||
|
||||
#define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS)
|
||||
#define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC)
|
||||
#define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL)
|
||||
#define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE)
|
||||
|
||||
#define blk_noretry_request(rq) ((rq)->cmd_flags & REQ_FAILFAST)
|
||||
#define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED)
|
||||
|
||||
#define blk_account_rq(rq) (blk_rq_started(rq) && blk_fs_request(rq))
|
||||
|
||||
#define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND)
|
||||
#define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME)
|
||||
#define blk_pm_request(rq) \
|
||||
(blk_pm_suspend_request(rq) || blk_pm_resume_request(rq))
|
||||
|
||||
#define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED)
|
||||
#define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER)
|
||||
#define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA)
|
||||
|
||||
#define list_entry_rq(ptr) list_entry((ptr), struct request, queuelist)
|
||||
|
||||
#define rq_data_dir(rq) ((rq)->cmd_flags & 1)
|
||||
|
||||
/*
|
||||
* We regard a request as sync, if it's a READ or a SYNC write.
|
||||
*/
|
||||
#define rq_is_sync(rq) (rq_data_dir((rq)) == READ || (rq)->cmd_flags & REQ_RW_SYNC)
|
||||
#define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META)
|
||||
|
||||
static inline int blk_queue_full(struct request_queue *q, int rw)
|
||||
{
|
||||
if (rw == READ)
|
||||
return test_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
|
||||
return test_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
|
||||
}
|
||||
|
||||
static inline void blk_set_queue_full(struct request_queue *q, int rw)
|
||||
{
|
||||
if (rw == READ)
|
||||
set_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
|
||||
else
|
||||
set_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
|
||||
}
|
||||
|
||||
static inline void blk_clear_queue_full(struct request_queue *q, int rw)
|
||||
{
|
||||
if (rw == READ)
|
||||
clear_bit(QUEUE_FLAG_READFULL, &q->queue_flags);
|
||||
else
|
||||
clear_bit(QUEUE_FLAG_WRITEFULL, &q->queue_flags);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* mergeable request must not have _NOMERGE or _BARRIER bit set, nor may
|
||||
* it already be started by driver.
|
||||
*/
|
||||
#define RQ_NOMERGE_FLAGS \
|
||||
(REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER)
|
||||
#define rq_mergeable(rq) \
|
||||
(!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && blk_fs_request((rq)))
|
||||
|
||||
/*
|
||||
* q->prep_rq_fn return values
|
||||
*/
|
||||
#define BLKPREP_OK 0 /* serve it */
|
||||
#define BLKPREP_KILL 1 /* fatal error, kill */
|
||||
#define BLKPREP_DEFER 2 /* leave on queue */
|
||||
|
||||
extern unsigned long blk_max_low_pfn, blk_max_pfn;
|
||||
|
||||
/*
|
||||
* standard bounce addresses:
|
||||
*
|
||||
* BLK_BOUNCE_HIGH : bounce all highmem pages
|
||||
* BLK_BOUNCE_ANY : don't bounce anything
|
||||
* BLK_BOUNCE_ISA : bounce pages above ISA DMA boundary
|
||||
*/
|
||||
#define BLK_BOUNCE_HIGH ((u64)blk_max_low_pfn << PAGE_SHIFT)
|
||||
#define BLK_BOUNCE_ANY ((u64)blk_max_pfn << PAGE_SHIFT)
|
||||
#define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD)
|
||||
|
||||
#ifdef CONFIG_MMU
|
||||
extern int init_emergency_isa_pool(void);
|
||||
extern void blk_queue_bounce(request_queue_t *q, struct bio **bio);
|
||||
#else
|
||||
static inline int init_emergency_isa_pool(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
|
||||
{
|
||||
}
|
||||
#endif /* CONFIG_MMU */
|
||||
|
||||
#define rq_for_each_bio(_bio, rq) \
|
||||
if ((rq->bio)) \
|
||||
for (_bio = (rq)->bio; _bio; _bio = _bio->bi_next)
|
||||
|
||||
extern int blk_register_queue(struct gendisk *disk);
|
||||
extern void blk_unregister_queue(struct gendisk *disk);
|
||||
extern void register_disk(struct gendisk *dev);
|
||||
extern void generic_make_request(struct bio *bio);
|
||||
extern void blk_put_request(struct request *);
|
||||
extern void __blk_put_request(request_queue_t *, struct request *);
|
||||
extern void blk_end_sync_rq(struct request *rq, int error);
|
||||
extern struct request *blk_get_request(request_queue_t *, int, gfp_t);
|
||||
extern void blk_insert_request(request_queue_t *, struct request *, int, void *);
|
||||
extern void blk_requeue_request(request_queue_t *, struct request *);
|
||||
extern void blk_plug_device(request_queue_t *);
|
||||
extern int blk_remove_plug(request_queue_t *);
|
||||
extern void blk_recount_segments(request_queue_t *, struct bio *);
|
||||
extern int scsi_cmd_ioctl(struct file *, struct gendisk *, unsigned int, void __user *);
|
||||
extern int sg_scsi_ioctl(struct file *, struct request_queue *,
|
||||
struct gendisk *, struct scsi_ioctl_command __user *);
|
||||
|
||||
/*
|
||||
* Temporary export, until SCSI gets fixed up.
|
||||
*/
|
||||
extern int ll_back_merge_fn(request_queue_t *, struct request *, struct bio *);
|
||||
|
||||
/*
|
||||
* A queue has just exitted congestion. Note this in the global counter of
|
||||
* congested queues, and wake up anyone who was waiting for requests to be
|
||||
* put back.
|
||||
*/
|
||||
static inline void blk_clear_queue_congested(request_queue_t *q, int rw)
|
||||
{
|
||||
clear_bdi_congested(&q->backing_dev_info, rw);
|
||||
}
|
||||
|
||||
/*
|
||||
* A queue has just entered congestion. Flag that in the queue's VM-visible
|
||||
* state flags and increment the global gounter of congested queues.
|
||||
*/
|
||||
static inline void blk_set_queue_congested(request_queue_t *q, int rw)
|
||||
{
|
||||
set_bdi_congested(&q->backing_dev_info, rw);
|
||||
}
|
||||
|
||||
extern void blk_start_queue(request_queue_t *q);
|
||||
extern void blk_stop_queue(request_queue_t *q);
|
||||
extern void blk_sync_queue(struct request_queue *q);
|
||||
extern void __blk_stop_queue(request_queue_t *q);
|
||||
extern void blk_run_queue(request_queue_t *);
|
||||
extern void blk_start_queueing(request_queue_t *);
|
||||
extern int blk_rq_map_user(request_queue_t *, struct request *, void __user *, unsigned long);
|
||||
extern int blk_rq_unmap_user(struct bio *);
|
||||
extern int blk_rq_map_kern(request_queue_t *, struct request *, void *, unsigned int, gfp_t);
|
||||
extern int blk_rq_map_user_iov(request_queue_t *, struct request *,
|
||||
struct sg_iovec *, int, unsigned int);
|
||||
extern int blk_execute_rq(request_queue_t *, struct gendisk *,
|
||||
struct request *, int);
|
||||
extern void blk_execute_rq_nowait(request_queue_t *, struct gendisk *,
|
||||
struct request *, int, rq_end_io_fn *);
|
||||
|
||||
static inline request_queue_t *bdev_get_queue(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_disk->queue;
|
||||
}
|
||||
|
||||
static inline void blk_run_backing_dev(struct backing_dev_info *bdi,
|
||||
struct page *page)
|
||||
{
|
||||
if (bdi && bdi->unplug_io_fn)
|
||||
bdi->unplug_io_fn(bdi, page);
|
||||
}
|
||||
|
||||
static inline void blk_run_address_space(struct address_space *mapping)
|
||||
{
|
||||
if (mapping)
|
||||
blk_run_backing_dev(mapping->backing_dev_info, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* end_request() and friends. Must be called with the request queue spinlock
|
||||
* acquired. All functions called within end_request() _must_be_ atomic.
|
||||
*
|
||||
* Several drivers define their own end_request and call
|
||||
* end_that_request_first() and end_that_request_last()
|
||||
* for parts of the original function. This prevents
|
||||
* code duplication in drivers.
|
||||
*/
|
||||
extern int end_that_request_first(struct request *, int, int);
|
||||
extern int end_that_request_chunk(struct request *, int, int);
|
||||
extern void end_that_request_last(struct request *, int);
|
||||
extern void end_request(struct request *req, int uptodate);
|
||||
extern void blk_complete_request(struct request *);
|
||||
|
||||
/*
|
||||
* end_that_request_first/chunk() takes an uptodate argument. we account
|
||||
* any value <= as an io error. 0 means -EIO for compatability reasons,
|
||||
* any other < 0 value is the direct error type. An uptodate value of
|
||||
* 1 indicates successful io completion
|
||||
*/
|
||||
#define end_io_error(uptodate) (unlikely((uptodate) <= 0))
|
||||
|
||||
static inline void blkdev_dequeue_request(struct request *req)
|
||||
{
|
||||
elv_dequeue_request(req->q, req);
|
||||
}
|
||||
|
||||
/*
|
||||
* Access functions for manipulating queue properties
|
||||
*/
|
||||
extern request_queue_t *blk_init_queue_node(request_fn_proc *rfn,
|
||||
spinlock_t *lock, int node_id);
|
||||
extern request_queue_t *blk_init_queue(request_fn_proc *, spinlock_t *);
|
||||
extern void blk_cleanup_queue(request_queue_t *);
|
||||
extern void blk_queue_make_request(request_queue_t *, make_request_fn *);
|
||||
extern void blk_queue_bounce_limit(request_queue_t *, u64);
|
||||
extern void blk_queue_max_sectors(request_queue_t *, unsigned int);
|
||||
extern void blk_queue_max_phys_segments(request_queue_t *, unsigned short);
|
||||
extern void blk_queue_max_hw_segments(request_queue_t *, unsigned short);
|
||||
extern void blk_queue_max_segment_size(request_queue_t *, unsigned int);
|
||||
extern void blk_queue_hardsect_size(request_queue_t *, unsigned short);
|
||||
extern void blk_queue_stack_limits(request_queue_t *t, request_queue_t *b);
|
||||
extern void blk_queue_segment_boundary(request_queue_t *, unsigned long);
|
||||
extern void blk_queue_prep_rq(request_queue_t *, prep_rq_fn *pfn);
|
||||
extern void blk_queue_merge_bvec(request_queue_t *, merge_bvec_fn *);
|
||||
extern void blk_queue_dma_alignment(request_queue_t *, int);
|
||||
extern void blk_queue_softirq_done(request_queue_t *, softirq_done_fn *);
|
||||
extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev);
|
||||
extern int blk_queue_ordered(request_queue_t *, unsigned, prepare_flush_fn *);
|
||||
extern void blk_queue_issue_flush_fn(request_queue_t *, issue_flush_fn *);
|
||||
extern int blk_do_ordered(request_queue_t *, struct request **);
|
||||
extern unsigned blk_ordered_cur_seq(request_queue_t *);
|
||||
extern unsigned blk_ordered_req_seq(struct request *);
|
||||
extern void blk_ordered_complete_seq(request_queue_t *, unsigned, int);
|
||||
|
||||
extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
|
||||
extern void blk_dump_rq_flags(struct request *, char *);
|
||||
extern void generic_unplug_device(request_queue_t *);
|
||||
extern void __generic_unplug_device(request_queue_t *);
|
||||
extern long nr_blockdev_pages(void);
|
||||
|
||||
int blk_get_queue(request_queue_t *);
|
||||
request_queue_t *blk_alloc_queue(gfp_t);
|
||||
request_queue_t *blk_alloc_queue_node(gfp_t, int);
|
||||
extern void blk_put_queue(request_queue_t *);
|
||||
|
||||
/*
|
||||
* tag stuff
|
||||
*/
|
||||
#define blk_queue_tag_depth(q) ((q)->queue_tags->busy)
|
||||
#define blk_queue_tag_queue(q) ((q)->queue_tags->busy < (q)->queue_tags->max_depth)
|
||||
#define blk_rq_tagged(rq) ((rq)->cmd_flags & REQ_QUEUED)
|
||||
extern int blk_queue_start_tag(request_queue_t *, struct request *);
|
||||
extern struct request *blk_queue_find_tag(request_queue_t *, int);
|
||||
extern void blk_queue_end_tag(request_queue_t *, struct request *);
|
||||
extern int blk_queue_init_tags(request_queue_t *, int, struct blk_queue_tag *);
|
||||
extern void blk_queue_free_tags(request_queue_t *);
|
||||
extern int blk_queue_resize_tags(request_queue_t *, int);
|
||||
extern void blk_queue_invalidate_tags(request_queue_t *);
|
||||
extern struct blk_queue_tag *blk_init_tags(int);
|
||||
extern void blk_free_tags(struct blk_queue_tag *);
|
||||
|
||||
static inline struct request *blk_map_queue_find_tag(struct blk_queue_tag *bqt,
|
||||
int tag)
|
||||
{
|
||||
if (unlikely(bqt == NULL || tag >= bqt->real_max_depth))
|
||||
return NULL;
|
||||
return bqt->tag_index[tag];
|
||||
}
|
||||
|
||||
extern void blk_rq_bio_prep(request_queue_t *, struct request *, struct bio *);
|
||||
extern int blkdev_issue_flush(struct block_device *, sector_t *);
|
||||
|
||||
#define MAX_PHYS_SEGMENTS 128
|
||||
#define MAX_HW_SEGMENTS 128
|
||||
#define SAFE_MAX_SECTORS 255
|
||||
#define BLK_DEF_MAX_SECTORS 1024
|
||||
|
||||
#define MAX_SEGMENT_SIZE 65536
|
||||
|
||||
#define blkdev_entry_to_request(entry) list_entry((entry), struct request, queuelist)
|
||||
|
||||
static inline int queue_hardsect_size(request_queue_t *q)
|
||||
{
|
||||
int retval = 512;
|
||||
|
||||
if (q && q->hardsect_size)
|
||||
retval = q->hardsect_size;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static inline int bdev_hardsect_size(struct block_device *bdev)
|
||||
{
|
||||
return queue_hardsect_size(bdev_get_queue(bdev));
|
||||
}
|
||||
|
||||
static inline int queue_dma_alignment(request_queue_t *q)
|
||||
{
|
||||
int retval = 511;
|
||||
|
||||
if (q && q->dma_alignment)
|
||||
retval = q->dma_alignment;
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* assumes size > 256 */
|
||||
static inline unsigned int blksize_bits(unsigned int size)
|
||||
{
|
||||
unsigned int bits = 8;
|
||||
do {
|
||||
bits++;
|
||||
size >>= 1;
|
||||
} while (size > 256);
|
||||
return bits;
|
||||
}
|
||||
|
||||
static inline unsigned int block_size(struct block_device *bdev)
|
||||
{
|
||||
return bdev->bd_block_size;
|
||||
}
|
||||
|
||||
typedef struct {struct page *v;} Sector;
|
||||
|
||||
unsigned char *read_dev_sector(struct block_device *, sector_t, Sector *);
|
||||
|
||||
static inline void put_dev_sector(Sector p)
|
||||
{
|
||||
page_cache_release(p.v);
|
||||
}
|
||||
|
||||
struct work_struct;
|
||||
int kblockd_schedule_work(struct work_struct *work);
|
||||
void kblockd_flush(void);
|
||||
|
||||
#define MODULE_ALIAS_BLOCKDEV(major,minor) \
|
||||
MODULE_ALIAS("block-major-" __stringify(major) "-" __stringify(minor))
|
||||
#define MODULE_ALIAS_BLOCKDEV_MAJOR(major) \
|
||||
MODULE_ALIAS("block-major-" __stringify(major) "-*")
|
||||
|
||||
|
||||
#else /* CONFIG_BLOCK */
|
||||
/*
|
||||
* stubs for when the block layer is configured out
|
||||
*/
|
||||
#define buffer_heads_over_limit 0
|
||||
|
||||
static inline long blk_congestion_wait(int rw, long timeout)
|
||||
{
|
||||
return io_schedule_timeout(timeout);
|
||||
}
|
||||
|
||||
static inline long nr_blockdev_pages(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void exit_io_context(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
|
||||
#endif
|
||||
58
include/linux/blkpg.h
Normal file
58
include/linux/blkpg.h
Normal file
@@ -0,0 +1,58 @@
|
||||
#ifndef _LINUX_BLKPG_H
|
||||
#define _LINUX_BLKPG_H
|
||||
|
||||
/*
|
||||
* Partition table and disk geometry handling
|
||||
*
|
||||
* A single ioctl with lots of subfunctions:
|
||||
*
|
||||
* Device number stuff:
|
||||
* get_whole_disk() (given the device number of a partition,
|
||||
* find the device number of the encompassing disk)
|
||||
* get_all_partitions() (given the device number of a disk, return the
|
||||
* device numbers of all its known partitions)
|
||||
*
|
||||
* Partition stuff:
|
||||
* add_partition()
|
||||
* delete_partition()
|
||||
* test_partition_in_use() (also for test_disk_in_use)
|
||||
*
|
||||
* Geometry stuff:
|
||||
* get_geometry()
|
||||
* set_geometry()
|
||||
* get_bios_drivedata()
|
||||
*
|
||||
* For today, only the partition stuff - aeb, 990515
|
||||
*/
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define BLKPG _IO(0x12,105)
|
||||
|
||||
/* The argument structure */
|
||||
struct blkpg_ioctl_arg {
|
||||
int op;
|
||||
int flags;
|
||||
int datalen;
|
||||
void __user *data;
|
||||
};
|
||||
|
||||
/* The subfunctions (for the op field) */
|
||||
#define BLKPG_ADD_PARTITION 1
|
||||
#define BLKPG_DEL_PARTITION 2
|
||||
|
||||
/* Sizes of name fields. Unused at present. */
|
||||
#define BLKPG_DEVNAMELTH 64
|
||||
#define BLKPG_VOLNAMELTH 64
|
||||
|
||||
/* The data structure for ADD_PARTITION and DEL_PARTITION */
|
||||
struct blkpg_partition {
|
||||
long long start; /* starting offset in bytes */
|
||||
long long length; /* length in bytes */
|
||||
int pno; /* partition number */
|
||||
char devname[BLKPG_DEVNAMELTH]; /* partition name, like sda5 or c0d1p2,
|
||||
to be used in kernel messages */
|
||||
char volname[BLKPG_VOLNAMELTH]; /* volume label */
|
||||
};
|
||||
|
||||
#endif /* _LINUX_BLKPG_H */
|
||||
290
include/linux/blktrace_api.h
Normal file
290
include/linux/blktrace_api.h
Normal file
@@ -0,0 +1,290 @@
|
||||
#ifndef BLKTRACE_H
|
||||
#define BLKTRACE_H
|
||||
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/relay.h>
|
||||
|
||||
/*
|
||||
* Trace categories
|
||||
*/
|
||||
enum blktrace_cat {
|
||||
BLK_TC_READ = 1 << 0, /* reads */
|
||||
BLK_TC_WRITE = 1 << 1, /* writes */
|
||||
BLK_TC_BARRIER = 1 << 2, /* barrier */
|
||||
BLK_TC_SYNC = 1 << 3, /* sync IO */
|
||||
BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
|
||||
BLK_TC_REQUEUE = 1 << 5, /* requeueing */
|
||||
BLK_TC_ISSUE = 1 << 6, /* issue */
|
||||
BLK_TC_COMPLETE = 1 << 7, /* completions */
|
||||
BLK_TC_FS = 1 << 8, /* fs requests */
|
||||
BLK_TC_PC = 1 << 9, /* pc requests */
|
||||
BLK_TC_NOTIFY = 1 << 10, /* special message */
|
||||
BLK_TC_AHEAD = 1 << 11, /* readahead */
|
||||
BLK_TC_META = 1 << 12, /* metadata */
|
||||
|
||||
BLK_TC_END = 1 << 15, /* only 16-bits, reminder */
|
||||
};
|
||||
|
||||
#define BLK_TC_SHIFT (16)
|
||||
#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
|
||||
|
||||
/*
|
||||
* Basic trace actions
|
||||
*/
|
||||
enum blktrace_act {
|
||||
__BLK_TA_QUEUE = 1, /* queued */
|
||||
__BLK_TA_BACKMERGE, /* back merged to existing rq */
|
||||
__BLK_TA_FRONTMERGE, /* front merge to existing rq */
|
||||
__BLK_TA_GETRQ, /* allocated new request */
|
||||
__BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
|
||||
__BLK_TA_REQUEUE, /* request requeued */
|
||||
__BLK_TA_ISSUE, /* sent to driver */
|
||||
__BLK_TA_COMPLETE, /* completed by driver */
|
||||
__BLK_TA_PLUG, /* queue was plugged */
|
||||
__BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
|
||||
__BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
|
||||
__BLK_TA_INSERT, /* insert request */
|
||||
__BLK_TA_SPLIT, /* bio was split */
|
||||
__BLK_TA_BOUNCE, /* bio was bounced */
|
||||
__BLK_TA_REMAP, /* bio was remapped */
|
||||
};
|
||||
|
||||
/*
|
||||
* Notify events.
|
||||
*/
|
||||
enum blktrace_notify {
|
||||
__BLK_TN_PROCESS = 0, /* establish pid/name mapping */
|
||||
__BLK_TN_TIMESTAMP, /* include system clock */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Trace actions in full. Additionally, read or write is masked
|
||||
*/
|
||||
#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
|
||||
#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
|
||||
#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
|
||||
#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
|
||||
#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
|
||||
#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
|
||||
|
||||
#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
|
||||
#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
|
||||
|
||||
#define BLK_IO_TRACE_MAGIC 0x65617400
|
||||
#define BLK_IO_TRACE_VERSION 0x07
|
||||
|
||||
/*
|
||||
* The trace itself
|
||||
*/
|
||||
struct blk_io_trace {
|
||||
u32 magic; /* MAGIC << 8 | version */
|
||||
u32 sequence; /* event number */
|
||||
u64 time; /* in microseconds */
|
||||
u64 sector; /* disk offset */
|
||||
u32 bytes; /* transfer length */
|
||||
u32 action; /* what happened */
|
||||
u32 pid; /* who did it */
|
||||
u32 device; /* device number */
|
||||
u32 cpu; /* on what cpu did it happen */
|
||||
u16 error; /* completion error */
|
||||
u16 pdu_len; /* length of data after this trace */
|
||||
};
|
||||
|
||||
/*
|
||||
* The remap event
|
||||
*/
|
||||
struct blk_io_trace_remap {
|
||||
__be32 device;
|
||||
u32 __pad;
|
||||
__be64 sector;
|
||||
};
|
||||
|
||||
enum {
|
||||
Blktrace_setup = 1,
|
||||
Blktrace_running,
|
||||
Blktrace_stopped,
|
||||
};
|
||||
|
||||
struct blk_trace {
|
||||
int trace_state;
|
||||
struct rchan *rchan;
|
||||
unsigned long *sequence;
|
||||
u16 act_mask;
|
||||
u64 start_lba;
|
||||
u64 end_lba;
|
||||
u32 pid;
|
||||
u32 dev;
|
||||
struct dentry *dir;
|
||||
struct dentry *dropped_file;
|
||||
atomic_t dropped;
|
||||
};
|
||||
|
||||
/*
|
||||
* User setup structure passed with BLKTRACESTART
|
||||
*/
|
||||
struct blk_user_trace_setup {
|
||||
char name[BDEVNAME_SIZE]; /* output */
|
||||
u16 act_mask; /* input */
|
||||
u32 buf_size; /* input */
|
||||
u32 buf_nr; /* input */
|
||||
u64 start_lba;
|
||||
u64 end_lba;
|
||||
u32 pid;
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BLK_DEV_IO_TRACE)
|
||||
extern int blk_trace_ioctl(struct block_device *, unsigned, char __user *);
|
||||
extern void blk_trace_shutdown(request_queue_t *);
|
||||
extern void __blk_add_trace(struct blk_trace *, sector_t, int, int, u32, int, int, void *);
|
||||
|
||||
/**
|
||||
* blk_add_trace_rq - Add a trace for a request oriented action
|
||||
* @q: queue the io is for
|
||||
* @rq: the source request
|
||||
* @what: the action
|
||||
*
|
||||
* Description:
|
||||
* Records an action against a request. Will log the bio offset + size.
|
||||
*
|
||||
**/
|
||||
static inline void blk_add_trace_rq(struct request_queue *q, struct request *rq,
|
||||
u32 what)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
int rw = rq->cmd_flags & 0x03;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
if (blk_pc_request(rq)) {
|
||||
what |= BLK_TC_ACT(BLK_TC_PC);
|
||||
__blk_add_trace(bt, 0, rq->data_len, rw, what, rq->errors, sizeof(rq->cmd), rq->cmd);
|
||||
} else {
|
||||
what |= BLK_TC_ACT(BLK_TC_FS);
|
||||
__blk_add_trace(bt, rq->hard_sector, rq->hard_nr_sectors << 9, rw, what, rq->errors, 0, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_bio - Add a trace for a bio oriented action
|
||||
* @q: queue the io is for
|
||||
* @bio: the source bio
|
||||
* @what: the action
|
||||
*
|
||||
* Description:
|
||||
* Records an action against a bio. Will log the bio offset + size.
|
||||
*
|
||||
**/
|
||||
static inline void blk_add_trace_bio(struct request_queue *q, struct bio *bio,
|
||||
u32 what)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
__blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), 0, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_generic - Add a trace for a generic action
|
||||
* @q: queue the io is for
|
||||
* @bio: the source bio
|
||||
* @rw: the data direction
|
||||
* @what: the action
|
||||
*
|
||||
* Description:
|
||||
* Records a simple trace
|
||||
*
|
||||
**/
|
||||
static inline void blk_add_trace_generic(struct request_queue *q,
|
||||
struct bio *bio, int rw, u32 what)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
if (bio)
|
||||
blk_add_trace_bio(q, bio, what);
|
||||
else
|
||||
__blk_add_trace(bt, 0, 0, rw, what, 0, 0, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_pdu_int - Add a trace for a bio with an integer payload
|
||||
* @q: queue the io is for
|
||||
* @what: the action
|
||||
* @bio: the source bio
|
||||
* @pdu: the integer payload
|
||||
*
|
||||
* Description:
|
||||
* Adds a trace with some integer payload. This might be an unplug
|
||||
* option given as the action, with the depth at unplug time given
|
||||
* as the payload
|
||||
*
|
||||
**/
|
||||
static inline void blk_add_trace_pdu_int(struct request_queue *q, u32 what,
|
||||
struct bio *bio, unsigned int pdu)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
__be64 rpdu = cpu_to_be64(pdu);
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
if (bio)
|
||||
__blk_add_trace(bt, bio->bi_sector, bio->bi_size, bio->bi_rw, what, !bio_flagged(bio, BIO_UPTODATE), sizeof(rpdu), &rpdu);
|
||||
else
|
||||
__blk_add_trace(bt, 0, 0, 0, what, 0, sizeof(rpdu), &rpdu);
|
||||
}
|
||||
|
||||
/**
|
||||
* blk_add_trace_remap - Add a trace for a remap operation
|
||||
* @q: queue the io is for
|
||||
* @bio: the source bio
|
||||
* @dev: target device
|
||||
* @from: source sector
|
||||
* @to: target sector
|
||||
*
|
||||
* Description:
|
||||
* Device mapper or raid target sometimes need to split a bio because
|
||||
* it spans a stripe (or similar). Add a trace for that action.
|
||||
*
|
||||
**/
|
||||
static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
|
||||
dev_t dev, sector_t from, sector_t to)
|
||||
{
|
||||
struct blk_trace *bt = q->blk_trace;
|
||||
struct blk_io_trace_remap r;
|
||||
|
||||
if (likely(!bt))
|
||||
return;
|
||||
|
||||
r.device = cpu_to_be32(dev);
|
||||
r.sector = cpu_to_be64(to);
|
||||
|
||||
__blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
|
||||
}
|
||||
|
||||
#else /* !CONFIG_BLK_DEV_IO_TRACE */
|
||||
#define blk_trace_ioctl(bdev, cmd, arg) (-ENOTTY)
|
||||
#define blk_trace_shutdown(q) do { } while (0)
|
||||
#define blk_add_trace_rq(q, rq, what) do { } while (0)
|
||||
#define blk_add_trace_bio(q, rq, what) do { } while (0)
|
||||
#define blk_add_trace_generic(q, rq, rw, what) do { } while (0)
|
||||
#define blk_add_trace_pdu_int(q, what, bio, pdu) do { } while (0)
|
||||
#define blk_add_trace_remap(q, bio, dev, f, t) do {} while (0)
|
||||
#endif /* CONFIG_BLK_DEV_IO_TRACE */
|
||||
|
||||
#endif
|
||||
59
include/linux/blockgroup_lock.h
Normal file
59
include/linux/blockgroup_lock.h
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef _LINUX_BLOCKGROUP_LOCK_H
|
||||
#define _LINUX_BLOCKGROUP_LOCK_H
|
||||
/*
|
||||
* Per-blockgroup locking for ext2 and ext3.
|
||||
*
|
||||
* Simple hashed spinlocking.
|
||||
*/
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/cache.h>
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
|
||||
/*
|
||||
* We want a power-of-two. Is there a better way than this?
|
||||
*/
|
||||
|
||||
#if NR_CPUS >= 32
|
||||
#define NR_BG_LOCKS 128
|
||||
#elif NR_CPUS >= 16
|
||||
#define NR_BG_LOCKS 64
|
||||
#elif NR_CPUS >= 8
|
||||
#define NR_BG_LOCKS 32
|
||||
#elif NR_CPUS >= 4
|
||||
#define NR_BG_LOCKS 16
|
||||
#elif NR_CPUS >= 2
|
||||
#define NR_BG_LOCKS 8
|
||||
#else
|
||||
#define NR_BG_LOCKS 4
|
||||
#endif
|
||||
|
||||
#else /* CONFIG_SMP */
|
||||
#define NR_BG_LOCKS 1
|
||||
#endif /* CONFIG_SMP */
|
||||
|
||||
struct bgl_lock {
|
||||
spinlock_t lock;
|
||||
} ____cacheline_aligned_in_smp;
|
||||
|
||||
struct blockgroup_lock {
|
||||
struct bgl_lock locks[NR_BG_LOCKS];
|
||||
};
|
||||
|
||||
static inline void bgl_lock_init(struct blockgroup_lock *bgl)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < NR_BG_LOCKS; i++)
|
||||
spin_lock_init(&bgl->locks[i].lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* The accessor is a macro so we can embed a blockgroup_lock into different
|
||||
* superblock types
|
||||
*/
|
||||
#define sb_bgl_lock(sb, block_group) \
|
||||
(&(sb)->s_blockgroup_lock.locks[(block_group) & (NR_BG_LOCKS-1)].lock)
|
||||
|
||||
#endif
|
||||
136
include/linux/bootmem.h
Normal file
136
include/linux/bootmem.h
Normal file
@@ -0,0 +1,136 @@
|
||||
/*
|
||||
* Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
|
||||
*/
|
||||
#ifndef _LINUX_BOOTMEM_H
|
||||
#define _LINUX_BOOTMEM_H
|
||||
|
||||
#include <linux/mmzone.h>
|
||||
#include <asm/dma.h>
|
||||
|
||||
/*
|
||||
* simple boot-time physical memory area allocator.
|
||||
*/
|
||||
|
||||
extern unsigned long max_low_pfn;
|
||||
extern unsigned long min_low_pfn;
|
||||
|
||||
/*
|
||||
* highest page
|
||||
*/
|
||||
extern unsigned long max_pfn;
|
||||
|
||||
#ifdef CONFIG_CRASH_DUMP
|
||||
extern unsigned long saved_max_pfn;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* node_bootmem_map is a map pointer - the bits represent all physical
|
||||
* memory pages (including holes) on the node.
|
||||
*/
|
||||
typedef struct bootmem_data {
|
||||
unsigned long node_boot_start;
|
||||
unsigned long node_low_pfn;
|
||||
void *node_bootmem_map;
|
||||
unsigned long last_offset;
|
||||
unsigned long last_pos;
|
||||
unsigned long last_success; /* Previous allocation point. To speed
|
||||
* up searching */
|
||||
struct list_head list;
|
||||
} bootmem_data_t;
|
||||
|
||||
extern unsigned long bootmem_bootmap_pages(unsigned long);
|
||||
extern unsigned long init_bootmem(unsigned long addr, unsigned long memend);
|
||||
extern void free_bootmem(unsigned long addr, unsigned long size);
|
||||
extern void *__alloc_bootmem(unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal);
|
||||
extern void *__alloc_bootmem_nopanic(unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal);
|
||||
extern void *__alloc_bootmem_low(unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal);
|
||||
extern void *__alloc_bootmem_low_node(pg_data_t *pgdat,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal);
|
||||
extern void *__alloc_bootmem_core(struct bootmem_data *bdata,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal,
|
||||
unsigned long limit);
|
||||
extern void *alloc_bootmem_high_node(pg_data_t *pgdat, unsigned long size);
|
||||
|
||||
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
|
||||
extern void reserve_bootmem(unsigned long addr, unsigned long size);
|
||||
#define alloc_bootmem(x) \
|
||||
__alloc_bootmem(x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
|
||||
#define alloc_bootmem_low(x) \
|
||||
__alloc_bootmem_low(x, SMP_CACHE_BYTES, 0)
|
||||
#define alloc_bootmem_pages(x) \
|
||||
__alloc_bootmem(x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
|
||||
#define alloc_bootmem_low_pages(x) \
|
||||
__alloc_bootmem_low(x, PAGE_SIZE, 0)
|
||||
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
|
||||
|
||||
extern unsigned long free_all_bootmem(void);
|
||||
extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
|
||||
extern void *__alloc_bootmem_node(pg_data_t *pgdat,
|
||||
unsigned long size,
|
||||
unsigned long align,
|
||||
unsigned long goal);
|
||||
extern unsigned long init_bootmem_node(pg_data_t *pgdat,
|
||||
unsigned long freepfn,
|
||||
unsigned long startpfn,
|
||||
unsigned long endpfn);
|
||||
extern void reserve_bootmem_node(pg_data_t *pgdat,
|
||||
unsigned long physaddr,
|
||||
unsigned long size);
|
||||
extern void free_bootmem_node(pg_data_t *pgdat,
|
||||
unsigned long addr,
|
||||
unsigned long size);
|
||||
|
||||
#ifndef CONFIG_HAVE_ARCH_BOOTMEM_NODE
|
||||
#define alloc_bootmem_node(pgdat, x) \
|
||||
__alloc_bootmem_node(pgdat, x, SMP_CACHE_BYTES, __pa(MAX_DMA_ADDRESS))
|
||||
#define alloc_bootmem_pages_node(pgdat, x) \
|
||||
__alloc_bootmem_node(pgdat, x, PAGE_SIZE, __pa(MAX_DMA_ADDRESS))
|
||||
#define alloc_bootmem_low_pages_node(pgdat, x) \
|
||||
__alloc_bootmem_low_node(pgdat, x, PAGE_SIZE, 0)
|
||||
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
|
||||
|
||||
#ifdef CONFIG_HAVE_ARCH_ALLOC_REMAP
|
||||
extern void *alloc_remap(int nid, unsigned long size);
|
||||
#else
|
||||
static inline void *alloc_remap(int nid, unsigned long size)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_HAVE_ARCH_ALLOC_REMAP */
|
||||
|
||||
extern unsigned long __meminitdata nr_kernel_pages;
|
||||
extern unsigned long __meminitdata nr_all_pages;
|
||||
|
||||
extern void *alloc_large_system_hash(const char *tablename,
|
||||
unsigned long bucketsize,
|
||||
unsigned long numentries,
|
||||
int scale,
|
||||
int flags,
|
||||
unsigned int *_hash_shift,
|
||||
unsigned int *_hash_mask,
|
||||
unsigned long limit);
|
||||
|
||||
#define HASH_EARLY 0x00000001 /* Allocating during early boot? */
|
||||
|
||||
/* Only NUMA needs hash distribution.
|
||||
* IA64 is known to have sufficient vmalloc space.
|
||||
*/
|
||||
#if defined(CONFIG_NUMA) && defined(CONFIG_IA64)
|
||||
#define HASHDIST_DEFAULT 1
|
||||
#else
|
||||
#define HASHDIST_DEFAULT 0
|
||||
#endif
|
||||
extern int hashdist; /* Distribute hashes across NUMA nodes? */
|
||||
|
||||
|
||||
#endif /* _LINUX_BOOTMEM_H */
|
||||
10
include/linux/bottom_half.h
Normal file
10
include/linux/bottom_half.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef _LINUX_BH_H
|
||||
#define _LINUX_BH_H
|
||||
|
||||
extern void local_bh_disable(void);
|
||||
extern void __local_bh_enable(void);
|
||||
extern void _local_bh_enable(void);
|
||||
extern void local_bh_enable(void);
|
||||
extern void local_bh_enable_ip(unsigned long ip);
|
||||
|
||||
#endif /* _LINUX_BH_H */
|
||||
41
include/linux/bpqether.h
Normal file
41
include/linux/bpqether.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef __BPQETHER_H
|
||||
#define __BPQETHER_H
|
||||
|
||||
/*
|
||||
* Defines for the BPQETHER pseudo device driver
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_IF_ETHER_H
|
||||
#include <linux/if_ether.h>
|
||||
#endif
|
||||
|
||||
#define SIOCSBPQETHOPT (SIOCDEVPRIVATE+0) /* reserved */
|
||||
#define SIOCSBPQETHADDR (SIOCDEVPRIVATE+1)
|
||||
|
||||
struct bpq_ethaddr {
|
||||
unsigned char destination[ETH_ALEN];
|
||||
unsigned char accept[ETH_ALEN];
|
||||
};
|
||||
|
||||
/*
|
||||
* For SIOCSBPQETHOPT - this is compatible with PI2/PacketTwin card drivers,
|
||||
* currently not implemented, though. If someone wants to hook a radio
|
||||
* to his Ethernet card he may find this useful. ;-)
|
||||
*/
|
||||
|
||||
#define SIOCGBPQETHPARAM 0x5000 /* get Level 1 parameters */
|
||||
#define SIOCSBPQETHPARAM 0x5001 /* set */
|
||||
|
||||
struct bpq_req {
|
||||
int cmd;
|
||||
int speed; /* unused */
|
||||
int clockmode; /* unused */
|
||||
int txdelay;
|
||||
unsigned char persist; /* unused */
|
||||
int slotime; /* unused */
|
||||
int squeldelay;
|
||||
int dmachan; /* unused */
|
||||
int irq; /* unused */
|
||||
};
|
||||
|
||||
#endif
|
||||
326
include/linux/buffer_head.h
Normal file
326
include/linux/buffer_head.h
Normal file
@@ -0,0 +1,326 @@
|
||||
/*
|
||||
* include/linux/buffer_head.h
|
||||
*
|
||||
* Everything to do with buffer_heads.
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_BUFFER_HEAD_H
|
||||
#define _LINUX_BUFFER_HEAD_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/linkage.h>
|
||||
#include <linux/pagemap.h>
|
||||
#include <linux/wait.h>
|
||||
#include <asm/atomic.h>
|
||||
|
||||
#ifdef CONFIG_BLOCK
|
||||
|
||||
enum bh_state_bits {
|
||||
BH_Uptodate, /* Contains valid data */
|
||||
BH_Dirty, /* Is dirty */
|
||||
BH_Lock, /* Is locked */
|
||||
BH_Req, /* Has been submitted for I/O */
|
||||
BH_Uptodate_Lock,/* Used by the first bh in a page, to serialise
|
||||
* IO completion of other buffers in the page
|
||||
*/
|
||||
|
||||
BH_Mapped, /* Has a disk mapping */
|
||||
BH_New, /* Disk mapping was newly created by get_block */
|
||||
BH_Async_Read, /* Is under end_buffer_async_read I/O */
|
||||
BH_Async_Write, /* Is under end_buffer_async_write I/O */
|
||||
BH_Delay, /* Buffer is not yet allocated on disk */
|
||||
BH_Boundary, /* Block is followed by a discontiguity */
|
||||
BH_Write_EIO, /* I/O error on write */
|
||||
BH_Ordered, /* ordered write */
|
||||
BH_Eopnotsupp, /* operation not supported (barrier) */
|
||||
BH_Unwritten, /* Buffer is allocated on disk but not written */
|
||||
|
||||
BH_PrivateStart,/* not a state bit, but the first bit available
|
||||
* for private allocation by other entities
|
||||
*/
|
||||
};
|
||||
|
||||
#define MAX_BUF_PER_PAGE (PAGE_CACHE_SIZE / 512)
|
||||
|
||||
struct page;
|
||||
struct buffer_head;
|
||||
struct address_space;
|
||||
typedef void (bh_end_io_t)(struct buffer_head *bh, int uptodate);
|
||||
|
||||
/*
|
||||
* Historically, a buffer_head was used to map a single block
|
||||
* within a page, and of course as the unit of I/O through the
|
||||
* filesystem and block layers. Nowadays the basic I/O unit
|
||||
* is the bio, and buffer_heads are used for extracting block
|
||||
* mappings (via a get_block_t call), for tracking state within
|
||||
* a page (via a page_mapping) and for wrapping bio submission
|
||||
* for backward compatibility reasons (e.g. submit_bh).
|
||||
*/
|
||||
struct buffer_head {
|
||||
unsigned long b_state; /* buffer state bitmap (see above) */
|
||||
struct buffer_head *b_this_page;/* circular list of page's buffers */
|
||||
struct page *b_page; /* the page this bh is mapped to */
|
||||
|
||||
sector_t b_blocknr; /* start block number */
|
||||
size_t b_size; /* size of mapping */
|
||||
char *b_data; /* pointer to data within the page */
|
||||
|
||||
struct block_device *b_bdev;
|
||||
bh_end_io_t *b_end_io; /* I/O completion */
|
||||
void *b_private; /* reserved for b_end_io */
|
||||
struct list_head b_assoc_buffers; /* associated with another mapping */
|
||||
struct address_space *b_assoc_map; /* mapping this buffer is
|
||||
associated with */
|
||||
atomic_t b_count; /* users using this buffer_head */
|
||||
};
|
||||
|
||||
/*
|
||||
* macro tricks to expand the set_buffer_foo(), clear_buffer_foo()
|
||||
* and buffer_foo() functions.
|
||||
*/
|
||||
#define BUFFER_FNS(bit, name) \
|
||||
static inline void set_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
set_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
static inline void clear_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
clear_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
static inline int buffer_##name(const struct buffer_head *bh) \
|
||||
{ \
|
||||
return test_bit(BH_##bit, &(bh)->b_state); \
|
||||
}
|
||||
|
||||
/*
|
||||
* test_set_buffer_foo() and test_clear_buffer_foo()
|
||||
*/
|
||||
#define TAS_BUFFER_FNS(bit, name) \
|
||||
static inline int test_set_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
return test_and_set_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
static inline int test_clear_buffer_##name(struct buffer_head *bh) \
|
||||
{ \
|
||||
return test_and_clear_bit(BH_##bit, &(bh)->b_state); \
|
||||
} \
|
||||
|
||||
/*
|
||||
* Emit the buffer bitops functions. Note that there are also functions
|
||||
* of the form "mark_buffer_foo()". These are higher-level functions which
|
||||
* do something in addition to setting a b_state bit.
|
||||
*/
|
||||
BUFFER_FNS(Uptodate, uptodate)
|
||||
BUFFER_FNS(Dirty, dirty)
|
||||
TAS_BUFFER_FNS(Dirty, dirty)
|
||||
BUFFER_FNS(Lock, locked)
|
||||
TAS_BUFFER_FNS(Lock, locked)
|
||||
BUFFER_FNS(Req, req)
|
||||
TAS_BUFFER_FNS(Req, req)
|
||||
BUFFER_FNS(Mapped, mapped)
|
||||
BUFFER_FNS(New, new)
|
||||
BUFFER_FNS(Async_Read, async_read)
|
||||
BUFFER_FNS(Async_Write, async_write)
|
||||
BUFFER_FNS(Delay, delay)
|
||||
BUFFER_FNS(Boundary, boundary)
|
||||
BUFFER_FNS(Write_EIO, write_io_error)
|
||||
BUFFER_FNS(Ordered, ordered)
|
||||
BUFFER_FNS(Eopnotsupp, eopnotsupp)
|
||||
BUFFER_FNS(Unwritten, unwritten)
|
||||
|
||||
#define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)
|
||||
#define touch_buffer(bh) mark_page_accessed(bh->b_page)
|
||||
|
||||
/* If we *know* page->private refers to buffer_heads */
|
||||
#define page_buffers(page) \
|
||||
({ \
|
||||
BUG_ON(!PagePrivate(page)); \
|
||||
((struct buffer_head *)page_private(page)); \
|
||||
})
|
||||
#define page_has_buffers(page) PagePrivate(page)
|
||||
|
||||
/*
|
||||
* Declarations
|
||||
*/
|
||||
|
||||
void FASTCALL(mark_buffer_dirty(struct buffer_head *bh));
|
||||
void init_buffer(struct buffer_head *, bh_end_io_t *, void *);
|
||||
void set_bh_page(struct buffer_head *bh,
|
||||
struct page *page, unsigned long offset);
|
||||
int try_to_free_buffers(struct page *);
|
||||
struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size,
|
||||
int retry);
|
||||
void create_empty_buffers(struct page *, unsigned long,
|
||||
unsigned long b_state);
|
||||
void end_buffer_read_sync(struct buffer_head *bh, int uptodate);
|
||||
void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
|
||||
|
||||
/* Things to do with buffers at mapping->private_list */
|
||||
void mark_buffer_dirty_inode(struct buffer_head *bh, struct inode *inode);
|
||||
int inode_has_buffers(struct inode *);
|
||||
void invalidate_inode_buffers(struct inode *);
|
||||
int remove_inode_buffers(struct inode *inode);
|
||||
int sync_mapping_buffers(struct address_space *mapping);
|
||||
void unmap_underlying_metadata(struct block_device *bdev, sector_t block);
|
||||
|
||||
void mark_buffer_async_write(struct buffer_head *bh);
|
||||
void invalidate_bdev(struct block_device *, int);
|
||||
int sync_blockdev(struct block_device *bdev);
|
||||
void __wait_on_buffer(struct buffer_head *);
|
||||
wait_queue_head_t *bh_waitq_head(struct buffer_head *bh);
|
||||
int fsync_bdev(struct block_device *);
|
||||
struct super_block *freeze_bdev(struct block_device *);
|
||||
void thaw_bdev(struct block_device *, struct super_block *);
|
||||
int fsync_super(struct super_block *);
|
||||
int fsync_no_super(struct block_device *);
|
||||
struct buffer_head *__find_get_block(struct block_device *bdev, sector_t block,
|
||||
unsigned size);
|
||||
struct buffer_head *__getblk(struct block_device *bdev, sector_t block,
|
||||
unsigned size);
|
||||
void __brelse(struct buffer_head *);
|
||||
void __bforget(struct buffer_head *);
|
||||
void __breadahead(struct block_device *, sector_t block, unsigned int size);
|
||||
struct buffer_head *__bread(struct block_device *, sector_t block, unsigned size);
|
||||
struct buffer_head *alloc_buffer_head(gfp_t gfp_flags);
|
||||
void free_buffer_head(struct buffer_head * bh);
|
||||
void FASTCALL(unlock_buffer(struct buffer_head *bh));
|
||||
void FASTCALL(__lock_buffer(struct buffer_head *bh));
|
||||
void ll_rw_block(int, int, struct buffer_head * bh[]);
|
||||
int sync_dirty_buffer(struct buffer_head *bh);
|
||||
int submit_bh(int, struct buffer_head *);
|
||||
void write_boundary_block(struct block_device *bdev,
|
||||
sector_t bblock, unsigned blocksize);
|
||||
|
||||
extern int buffer_heads_over_limit;
|
||||
|
||||
/*
|
||||
* Generic address_space_operations implementations for buffer_head-backed
|
||||
* address_spaces.
|
||||
*/
|
||||
void block_invalidatepage(struct page *page, unsigned long offset);
|
||||
int block_write_full_page(struct page *page, get_block_t *get_block,
|
||||
struct writeback_control *wbc);
|
||||
int block_read_full_page(struct page*, get_block_t*);
|
||||
int block_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
|
||||
int cont_prepare_write(struct page*, unsigned, unsigned, get_block_t*,
|
||||
loff_t *);
|
||||
int generic_cont_expand(struct inode *inode, loff_t size);
|
||||
int generic_cont_expand_simple(struct inode *inode, loff_t size);
|
||||
int block_commit_write(struct page *page, unsigned from, unsigned to);
|
||||
void block_sync_page(struct page *);
|
||||
sector_t generic_block_bmap(struct address_space *, sector_t, get_block_t *);
|
||||
int generic_commit_write(struct file *, struct page *, unsigned, unsigned);
|
||||
int block_truncate_page(struct address_space *, loff_t, get_block_t *);
|
||||
int file_fsync(struct file *, struct dentry *, int);
|
||||
int nobh_prepare_write(struct page*, unsigned, unsigned, get_block_t*);
|
||||
int nobh_commit_write(struct file *, struct page *, unsigned, unsigned);
|
||||
int nobh_truncate_page(struct address_space *, loff_t);
|
||||
int nobh_writepage(struct page *page, get_block_t *get_block,
|
||||
struct writeback_control *wbc);
|
||||
|
||||
void buffer_init(void);
|
||||
|
||||
/*
|
||||
* inline definitions
|
||||
*/
|
||||
|
||||
static inline void attach_page_buffers(struct page *page,
|
||||
struct buffer_head *head)
|
||||
{
|
||||
page_cache_get(page);
|
||||
SetPagePrivate(page);
|
||||
set_page_private(page, (unsigned long)head);
|
||||
}
|
||||
|
||||
static inline void get_bh(struct buffer_head *bh)
|
||||
{
|
||||
atomic_inc(&bh->b_count);
|
||||
}
|
||||
|
||||
static inline void put_bh(struct buffer_head *bh)
|
||||
{
|
||||
smp_mb__before_atomic_dec();
|
||||
atomic_dec(&bh->b_count);
|
||||
}
|
||||
|
||||
static inline void brelse(struct buffer_head *bh)
|
||||
{
|
||||
if (bh)
|
||||
__brelse(bh);
|
||||
}
|
||||
|
||||
static inline void bforget(struct buffer_head *bh)
|
||||
{
|
||||
if (bh)
|
||||
__bforget(bh);
|
||||
}
|
||||
|
||||
static inline struct buffer_head *
|
||||
sb_bread(struct super_block *sb, sector_t block)
|
||||
{
|
||||
return __bread(sb->s_bdev, block, sb->s_blocksize);
|
||||
}
|
||||
|
||||
static inline void
|
||||
sb_breadahead(struct super_block *sb, sector_t block)
|
||||
{
|
||||
__breadahead(sb->s_bdev, block, sb->s_blocksize);
|
||||
}
|
||||
|
||||
static inline struct buffer_head *
|
||||
sb_getblk(struct super_block *sb, sector_t block)
|
||||
{
|
||||
return __getblk(sb->s_bdev, block, sb->s_blocksize);
|
||||
}
|
||||
|
||||
static inline struct buffer_head *
|
||||
sb_find_get_block(struct super_block *sb, sector_t block)
|
||||
{
|
||||
return __find_get_block(sb->s_bdev, block, sb->s_blocksize);
|
||||
}
|
||||
|
||||
static inline void
|
||||
map_bh(struct buffer_head *bh, struct super_block *sb, sector_t block)
|
||||
{
|
||||
set_buffer_mapped(bh);
|
||||
bh->b_bdev = sb->s_bdev;
|
||||
bh->b_blocknr = block;
|
||||
bh->b_size = sb->s_blocksize;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calling wait_on_buffer() for a zero-ref buffer is illegal, so we call into
|
||||
* __wait_on_buffer() just to trip a debug check. Because debug code in inline
|
||||
* functions is bloaty.
|
||||
*/
|
||||
static inline void wait_on_buffer(struct buffer_head *bh)
|
||||
{
|
||||
might_sleep();
|
||||
if (buffer_locked(bh) || atomic_read(&bh->b_count) == 0)
|
||||
__wait_on_buffer(bh);
|
||||
}
|
||||
|
||||
static inline void lock_buffer(struct buffer_head *bh)
|
||||
{
|
||||
might_sleep();
|
||||
if (test_set_buffer_locked(bh))
|
||||
__lock_buffer(bh);
|
||||
}
|
||||
|
||||
extern int __set_page_dirty_buffers(struct page *page);
|
||||
|
||||
#else /* CONFIG_BLOCK */
|
||||
|
||||
static inline void buffer_init(void) {}
|
||||
static inline int try_to_free_buffers(struct page *page) { return 1; }
|
||||
static inline int sync_blockdev(struct block_device *bdev) { return 0; }
|
||||
static inline int inode_has_buffers(struct inode *inode) { return 0; }
|
||||
static inline void invalidate_inode_buffers(struct inode *inode) {}
|
||||
static inline int remove_inode_buffers(struct inode *inode) { return 1; }
|
||||
static inline int sync_mapping_buffers(struct address_space *mapping) { return 0; }
|
||||
static inline void invalidate_bdev(struct block_device *bdev, int destroy_dirty_buffers) {}
|
||||
|
||||
|
||||
#endif /* CONFIG_BLOCK */
|
||||
#endif /* _LINUX_BUFFER_HEAD_H */
|
||||
47
include/linux/bug.h
Normal file
47
include/linux/bug.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef _LINUX_BUG_H
|
||||
#define _LINUX_BUG_H
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <asm/bug.h>
|
||||
|
||||
enum bug_trap_type {
|
||||
BUG_TRAP_TYPE_NONE = 0,
|
||||
BUG_TRAP_TYPE_WARN = 1,
|
||||
BUG_TRAP_TYPE_BUG = 2,
|
||||
};
|
||||
|
||||
#ifdef CONFIG_GENERIC_BUG
|
||||
#include <asm-generic/bug.h>
|
||||
|
||||
static inline int is_warning_bug(const struct bug_entry *bug)
|
||||
{
|
||||
return bug->flags & BUGFLAG_WARNING;
|
||||
}
|
||||
|
||||
const struct bug_entry *find_bug(unsigned long bugaddr);
|
||||
|
||||
enum bug_trap_type report_bug(unsigned long bug_addr);
|
||||
|
||||
int module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
|
||||
struct module *);
|
||||
void module_bug_cleanup(struct module *);
|
||||
|
||||
/* These are defined by the architecture */
|
||||
int is_valid_bugaddr(unsigned long addr);
|
||||
|
||||
#else /* !CONFIG_GENERIC_BUG */
|
||||
|
||||
static inline enum bug_trap_type report_bug(unsigned long bug_addr)
|
||||
{
|
||||
return BUG_TRAP_TYPE_BUG;
|
||||
}
|
||||
static inline int module_bug_finalize(const Elf_Ehdr *hdr,
|
||||
const Elf_Shdr *sechdrs,
|
||||
struct module *mod)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void module_bug_cleanup(struct module *mod) {}
|
||||
|
||||
#endif /* CONFIG_GENERIC_BUG */
|
||||
#endif /* _LINUX_BUG_H */
|
||||
5
include/linux/byteorder/Kbuild
Normal file
5
include/linux/byteorder/Kbuild
Normal file
@@ -0,0 +1,5 @@
|
||||
header-y += big_endian.h
|
||||
header-y += little_endian.h
|
||||
|
||||
unifdef-y += generic.h
|
||||
unifdef-y += swab.h
|
||||
106
include/linux/byteorder/big_endian.h
Normal file
106
include/linux/byteorder/big_endian.h
Normal file
@@ -0,0 +1,106 @@
|
||||
#ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
|
||||
#define _LINUX_BYTEORDER_BIG_ENDIAN_H
|
||||
|
||||
#ifndef __BIG_ENDIAN
|
||||
#define __BIG_ENDIAN 4321
|
||||
#endif
|
||||
#ifndef __BIG_ENDIAN_BITFIELD
|
||||
#define __BIG_ENDIAN_BITFIELD
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/byteorder/swab.h>
|
||||
|
||||
#define __constant_htonl(x) ((__force __be32)(__u32)(x))
|
||||
#define __constant_ntohl(x) ((__force __u32)(__be32)(x))
|
||||
#define __constant_htons(x) ((__force __be16)(__u16)(x))
|
||||
#define __constant_ntohs(x) ((__force __u16)(__be16)(x))
|
||||
#define __constant_cpu_to_le64(x) ((__force __le64)___constant_swab64((x)))
|
||||
#define __constant_le64_to_cpu(x) ___constant_swab64((__force __u64)(__le64)(x))
|
||||
#define __constant_cpu_to_le32(x) ((__force __le32)___constant_swab32((x)))
|
||||
#define __constant_le32_to_cpu(x) ___constant_swab32((__force __u32)(__le32)(x))
|
||||
#define __constant_cpu_to_le16(x) ((__force __le16)___constant_swab16((x)))
|
||||
#define __constant_le16_to_cpu(x) ___constant_swab16((__force __u16)(__le16)(x))
|
||||
#define __constant_cpu_to_be64(x) ((__force __be64)(__u64)(x))
|
||||
#define __constant_be64_to_cpu(x) ((__force __u64)(__be64)(x))
|
||||
#define __constant_cpu_to_be32(x) ((__force __be32)(__u32)(x))
|
||||
#define __constant_be32_to_cpu(x) ((__force __u32)(__be32)(x))
|
||||
#define __constant_cpu_to_be16(x) ((__force __be16)(__u16)(x))
|
||||
#define __constant_be16_to_cpu(x) ((__force __u16)(__be16)(x))
|
||||
#define __cpu_to_le64(x) ((__force __le64)__swab64((x)))
|
||||
#define __le64_to_cpu(x) __swab64((__force __u64)(__le64)(x))
|
||||
#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
|
||||
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
|
||||
#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
|
||||
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
|
||||
#define __cpu_to_be64(x) ((__force __be64)(__u64)(x))
|
||||
#define __be64_to_cpu(x) ((__force __u64)(__be64)(x))
|
||||
#define __cpu_to_be32(x) ((__force __be32)(__u32)(x))
|
||||
#define __be32_to_cpu(x) ((__force __u32)(__be32)(x))
|
||||
#define __cpu_to_be16(x) ((__force __be16)(__u16)(x))
|
||||
#define __be16_to_cpu(x) ((__force __u16)(__be16)(x))
|
||||
|
||||
static inline __le64 __cpu_to_le64p(const __u64 *p)
|
||||
{
|
||||
return (__force __le64)__swab64p(p);
|
||||
}
|
||||
static inline __u64 __le64_to_cpup(const __le64 *p)
|
||||
{
|
||||
return __swab64p((__u64 *)p);
|
||||
}
|
||||
static inline __le32 __cpu_to_le32p(const __u32 *p)
|
||||
{
|
||||
return (__force __le32)__swab32p(p);
|
||||
}
|
||||
static inline __u32 __le32_to_cpup(const __le32 *p)
|
||||
{
|
||||
return __swab32p((__u32 *)p);
|
||||
}
|
||||
static inline __le16 __cpu_to_le16p(const __u16 *p)
|
||||
{
|
||||
return (__force __le16)__swab16p(p);
|
||||
}
|
||||
static inline __u16 __le16_to_cpup(const __le16 *p)
|
||||
{
|
||||
return __swab16p((__u16 *)p);
|
||||
}
|
||||
static inline __be64 __cpu_to_be64p(const __u64 *p)
|
||||
{
|
||||
return (__force __be64)*p;
|
||||
}
|
||||
static inline __u64 __be64_to_cpup(const __be64 *p)
|
||||
{
|
||||
return (__force __u64)*p;
|
||||
}
|
||||
static inline __be32 __cpu_to_be32p(const __u32 *p)
|
||||
{
|
||||
return (__force __be32)*p;
|
||||
}
|
||||
static inline __u32 __be32_to_cpup(const __be32 *p)
|
||||
{
|
||||
return (__force __u32)*p;
|
||||
}
|
||||
static inline __be16 __cpu_to_be16p(const __u16 *p)
|
||||
{
|
||||
return (__force __be16)*p;
|
||||
}
|
||||
static inline __u16 __be16_to_cpup(const __be16 *p)
|
||||
{
|
||||
return (__force __u16)*p;
|
||||
}
|
||||
#define __cpu_to_le64s(x) __swab64s((x))
|
||||
#define __le64_to_cpus(x) __swab64s((x))
|
||||
#define __cpu_to_le32s(x) __swab32s((x))
|
||||
#define __le32_to_cpus(x) __swab32s((x))
|
||||
#define __cpu_to_le16s(x) __swab16s((x))
|
||||
#define __le16_to_cpus(x) __swab16s((x))
|
||||
#define __cpu_to_be64s(x) do {} while (0)
|
||||
#define __be64_to_cpus(x) do {} while (0)
|
||||
#define __cpu_to_be32s(x) do {} while (0)
|
||||
#define __be32_to_cpus(x) do {} while (0)
|
||||
#define __cpu_to_be16s(x) do {} while (0)
|
||||
#define __be16_to_cpus(x) do {} while (0)
|
||||
|
||||
#include <linux/byteorder/generic.h>
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
|
||||
176
include/linux/byteorder/generic.h
Normal file
176
include/linux/byteorder/generic.h
Normal file
@@ -0,0 +1,176 @@
|
||||
#ifndef _LINUX_BYTEORDER_GENERIC_H
|
||||
#define _LINUX_BYTEORDER_GENERIC_H
|
||||
|
||||
/*
|
||||
* linux/byteorder_generic.h
|
||||
* Generic Byte-reordering support
|
||||
*
|
||||
* The "... p" macros, like le64_to_cpup, can be used with pointers
|
||||
* to unaligned data, but there will be a performance penalty on
|
||||
* some architectures. Use get_unaligned for unaligned data.
|
||||
*
|
||||
* Francois-Rene Rideau <fare@tunes.org> 19970707
|
||||
* gathered all the good ideas from all asm-foo/byteorder.h into one file,
|
||||
* cleaned them up.
|
||||
* I hope it is compliant with non-GCC compilers.
|
||||
* I decided to put __BYTEORDER_HAS_U64__ in byteorder.h,
|
||||
* because I wasn't sure it would be ok to put it in types.h
|
||||
* Upgraded it to 2.1.43
|
||||
* Francois-Rene Rideau <fare@tunes.org> 19971012
|
||||
* Upgraded it to 2.1.57
|
||||
* to please Linus T., replaced huge #ifdef's between little/big endian
|
||||
* by nestedly #include'd files.
|
||||
* Francois-Rene Rideau <fare@tunes.org> 19971205
|
||||
* Made it to 2.1.71; now a facelift:
|
||||
* Put files under include/linux/byteorder/
|
||||
* Split swab from generic support.
|
||||
*
|
||||
* TODO:
|
||||
* = Regular kernel maintainers could also replace all these manual
|
||||
* byteswap macros that remain, disseminated among drivers,
|
||||
* after some grep or the sources...
|
||||
* = Linus might want to rename all these macros and files to fit his taste,
|
||||
* to fit his personal naming scheme.
|
||||
* = it seems that a few drivers would also appreciate
|
||||
* nybble swapping support...
|
||||
* = every architecture could add their byteswap macro in asm/byteorder.h
|
||||
* see how some architectures already do (i386, alpha, ppc, etc)
|
||||
* = cpu_to_beXX and beXX_to_cpu might some day need to be well
|
||||
* distinguished throughout the kernel. This is not the case currently,
|
||||
* since little endian, big endian, and pdp endian machines needn't it.
|
||||
* But this might be the case for, say, a port of Linux to 20/21 bit
|
||||
* architectures (and F21 Linux addict around?).
|
||||
*/
|
||||
|
||||
/*
|
||||
* The following macros are to be defined by <asm/byteorder.h>:
|
||||
*
|
||||
* Conversion of long and short int between network and host format
|
||||
* ntohl(__u32 x)
|
||||
* ntohs(__u16 x)
|
||||
* htonl(__u32 x)
|
||||
* htons(__u16 x)
|
||||
* It seems that some programs (which? where? or perhaps a standard? POSIX?)
|
||||
* might like the above to be functions, not macros (why?).
|
||||
* if that's true, then detect them, and take measures.
|
||||
* Anyway, the measure is: define only ___ntohl as a macro instead,
|
||||
* and in a separate file, have
|
||||
* unsigned long inline ntohl(x){return ___ntohl(x);}
|
||||
*
|
||||
* The same for constant arguments
|
||||
* __constant_ntohl(__u32 x)
|
||||
* __constant_ntohs(__u16 x)
|
||||
* __constant_htonl(__u32 x)
|
||||
* __constant_htons(__u16 x)
|
||||
*
|
||||
* Conversion of XX-bit integers (16- 32- or 64-)
|
||||
* between native CPU format and little/big endian format
|
||||
* 64-bit stuff only defined for proper architectures
|
||||
* cpu_to_[bl]eXX(__uXX x)
|
||||
* [bl]eXX_to_cpu(__uXX x)
|
||||
*
|
||||
* The same, but takes a pointer to the value to convert
|
||||
* cpu_to_[bl]eXXp(__uXX x)
|
||||
* [bl]eXX_to_cpup(__uXX x)
|
||||
*
|
||||
* The same, but change in situ
|
||||
* cpu_to_[bl]eXXs(__uXX x)
|
||||
* [bl]eXX_to_cpus(__uXX x)
|
||||
*
|
||||
* See asm-foo/byteorder.h for examples of how to provide
|
||||
* architecture-optimized versions
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__KERNEL__)
|
||||
/*
|
||||
* inside the kernel, we can use nicknames;
|
||||
* outside of it, we must avoid POSIX namespace pollution...
|
||||
*/
|
||||
#define cpu_to_le64 __cpu_to_le64
|
||||
#define le64_to_cpu __le64_to_cpu
|
||||
#define cpu_to_le32 __cpu_to_le32
|
||||
#define le32_to_cpu __le32_to_cpu
|
||||
#define cpu_to_le16 __cpu_to_le16
|
||||
#define le16_to_cpu __le16_to_cpu
|
||||
#define cpu_to_be64 __cpu_to_be64
|
||||
#define be64_to_cpu __be64_to_cpu
|
||||
#define cpu_to_be32 __cpu_to_be32
|
||||
#define be32_to_cpu __be32_to_cpu
|
||||
#define cpu_to_be16 __cpu_to_be16
|
||||
#define be16_to_cpu __be16_to_cpu
|
||||
#define cpu_to_le64p __cpu_to_le64p
|
||||
#define le64_to_cpup __le64_to_cpup
|
||||
#define cpu_to_le32p __cpu_to_le32p
|
||||
#define le32_to_cpup __le32_to_cpup
|
||||
#define cpu_to_le16p __cpu_to_le16p
|
||||
#define le16_to_cpup __le16_to_cpup
|
||||
#define cpu_to_be64p __cpu_to_be64p
|
||||
#define be64_to_cpup __be64_to_cpup
|
||||
#define cpu_to_be32p __cpu_to_be32p
|
||||
#define be32_to_cpup __be32_to_cpup
|
||||
#define cpu_to_be16p __cpu_to_be16p
|
||||
#define be16_to_cpup __be16_to_cpup
|
||||
#define cpu_to_le64s __cpu_to_le64s
|
||||
#define le64_to_cpus __le64_to_cpus
|
||||
#define cpu_to_le32s __cpu_to_le32s
|
||||
#define le32_to_cpus __le32_to_cpus
|
||||
#define cpu_to_le16s __cpu_to_le16s
|
||||
#define le16_to_cpus __le16_to_cpus
|
||||
#define cpu_to_be64s __cpu_to_be64s
|
||||
#define be64_to_cpus __be64_to_cpus
|
||||
#define cpu_to_be32s __cpu_to_be32s
|
||||
#define be32_to_cpus __be32_to_cpus
|
||||
#define cpu_to_be16s __cpu_to_be16s
|
||||
#define be16_to_cpus __be16_to_cpus
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__KERNEL__)
|
||||
/*
|
||||
* Handle ntohl and suches. These have various compatibility
|
||||
* issues - like we want to give the prototype even though we
|
||||
* also have a macro for them in case some strange program
|
||||
* wants to take the address of the thing or something..
|
||||
*
|
||||
* Note that these used to return a "long" in libc5, even though
|
||||
* long is often 64-bit these days.. Thus the casts.
|
||||
*
|
||||
* They have to be macros in order to do the constant folding
|
||||
* correctly - if the argument passed into a inline function
|
||||
* it is no longer constant according to gcc..
|
||||
*/
|
||||
|
||||
#undef ntohl
|
||||
#undef ntohs
|
||||
#undef htonl
|
||||
#undef htons
|
||||
|
||||
/*
|
||||
* Do the prototypes. Somebody might want to take the
|
||||
* address or some such sick thing..
|
||||
*/
|
||||
extern __u32 ntohl(__be32);
|
||||
extern __be32 htonl(__u32);
|
||||
extern __u16 ntohs(__be16);
|
||||
extern __be16 htons(__u16);
|
||||
|
||||
#if defined(__GNUC__) && defined(__OPTIMIZE__)
|
||||
|
||||
#define ___htonl(x) __cpu_to_be32(x)
|
||||
#define ___htons(x) __cpu_to_be16(x)
|
||||
#define ___ntohl(x) __be32_to_cpu(x)
|
||||
#define ___ntohs(x) __be16_to_cpu(x)
|
||||
|
||||
#define htonl(x) ___htonl(x)
|
||||
#define ntohl(x) ___ntohl(x)
|
||||
#define htons(x) ___htons(x)
|
||||
#define ntohs(x) ___ntohs(x)
|
||||
|
||||
#endif /* OPTIMIZE */
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_GENERIC_H */
|
||||
106
include/linux/byteorder/little_endian.h
Normal file
106
include/linux/byteorder/little_endian.h
Normal file
@@ -0,0 +1,106 @@
|
||||
#ifndef _LINUX_BYTEORDER_LITTLE_ENDIAN_H
|
||||
#define _LINUX_BYTEORDER_LITTLE_ENDIAN_H
|
||||
|
||||
#ifndef __LITTLE_ENDIAN
|
||||
#define __LITTLE_ENDIAN 1234
|
||||
#endif
|
||||
#ifndef __LITTLE_ENDIAN_BITFIELD
|
||||
#define __LITTLE_ENDIAN_BITFIELD
|
||||
#endif
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/byteorder/swab.h>
|
||||
|
||||
#define __constant_htonl(x) ((__force __be32)___constant_swab32((x)))
|
||||
#define __constant_ntohl(x) ___constant_swab32((__force __be32)(x))
|
||||
#define __constant_htons(x) ((__force __be16)___constant_swab16((x)))
|
||||
#define __constant_ntohs(x) ___constant_swab16((__force __be16)(x))
|
||||
#define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x))
|
||||
#define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x))
|
||||
#define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x))
|
||||
#define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x))
|
||||
#define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x))
|
||||
#define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x))
|
||||
#define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x)))
|
||||
#define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x))
|
||||
#define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x)))
|
||||
#define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x))
|
||||
#define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x)))
|
||||
#define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x))
|
||||
#define __cpu_to_le64(x) ((__force __le64)(__u64)(x))
|
||||
#define __le64_to_cpu(x) ((__force __u64)(__le64)(x))
|
||||
#define __cpu_to_le32(x) ((__force __le32)(__u32)(x))
|
||||
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
|
||||
#define __cpu_to_le16(x) ((__force __le16)(__u16)(x))
|
||||
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
|
||||
#define __cpu_to_be64(x) ((__force __be64)__swab64((x)))
|
||||
#define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x))
|
||||
#define __cpu_to_be32(x) ((__force __be32)__swab32((x)))
|
||||
#define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x))
|
||||
#define __cpu_to_be16(x) ((__force __be16)__swab16((x)))
|
||||
#define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x))
|
||||
|
||||
static inline __le64 __cpu_to_le64p(const __u64 *p)
|
||||
{
|
||||
return (__force __le64)*p;
|
||||
}
|
||||
static inline __u64 __le64_to_cpup(const __le64 *p)
|
||||
{
|
||||
return (__force __u64)*p;
|
||||
}
|
||||
static inline __le32 __cpu_to_le32p(const __u32 *p)
|
||||
{
|
||||
return (__force __le32)*p;
|
||||
}
|
||||
static inline __u32 __le32_to_cpup(const __le32 *p)
|
||||
{
|
||||
return (__force __u32)*p;
|
||||
}
|
||||
static inline __le16 __cpu_to_le16p(const __u16 *p)
|
||||
{
|
||||
return (__force __le16)*p;
|
||||
}
|
||||
static inline __u16 __le16_to_cpup(const __le16 *p)
|
||||
{
|
||||
return (__force __u16)*p;
|
||||
}
|
||||
static inline __be64 __cpu_to_be64p(const __u64 *p)
|
||||
{
|
||||
return (__force __be64)__swab64p(p);
|
||||
}
|
||||
static inline __u64 __be64_to_cpup(const __be64 *p)
|
||||
{
|
||||
return __swab64p((__u64 *)p);
|
||||
}
|
||||
static inline __be32 __cpu_to_be32p(const __u32 *p)
|
||||
{
|
||||
return (__force __be32)__swab32p(p);
|
||||
}
|
||||
static inline __u32 __be32_to_cpup(const __be32 *p)
|
||||
{
|
||||
return __swab32p((__u32 *)p);
|
||||
}
|
||||
static inline __be16 __cpu_to_be16p(const __u16 *p)
|
||||
{
|
||||
return (__force __be16)__swab16p(p);
|
||||
}
|
||||
static inline __u16 __be16_to_cpup(const __be16 *p)
|
||||
{
|
||||
return __swab16p((__u16 *)p);
|
||||
}
|
||||
#define __cpu_to_le64s(x) do {} while (0)
|
||||
#define __le64_to_cpus(x) do {} while (0)
|
||||
#define __cpu_to_le32s(x) do {} while (0)
|
||||
#define __le32_to_cpus(x) do {} while (0)
|
||||
#define __cpu_to_le16s(x) do {} while (0)
|
||||
#define __le16_to_cpus(x) do {} while (0)
|
||||
#define __cpu_to_be64s(x) __swab64s((x))
|
||||
#define __be64_to_cpus(x) __swab64s((x))
|
||||
#define __cpu_to_be32s(x) __swab32s((x))
|
||||
#define __be32_to_cpus(x) __swab32s((x))
|
||||
#define __cpu_to_be16s(x) __swab16s((x))
|
||||
#define __be16_to_cpus(x) __swab16s((x))
|
||||
|
||||
#include <linux/byteorder/generic.h>
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_LITTLE_ENDIAN_H */
|
||||
192
include/linux/byteorder/swab.h
Normal file
192
include/linux/byteorder/swab.h
Normal file
@@ -0,0 +1,192 @@
|
||||
#ifndef _LINUX_BYTEORDER_SWAB_H
|
||||
#define _LINUX_BYTEORDER_SWAB_H
|
||||
|
||||
/*
|
||||
* linux/byteorder/swab.h
|
||||
* Byte-swapping, independently from CPU endianness
|
||||
* swabXX[ps]?(foo)
|
||||
*
|
||||
* Francois-Rene Rideau <fare@tunes.org> 19971205
|
||||
* separated swab functions from cpu_to_XX,
|
||||
* to clean up support for bizarre-endian architectures.
|
||||
*
|
||||
* See asm-i386/byteorder.h and suches for examples of how to provide
|
||||
* architecture-dependent optimized versions
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/compiler.h>
|
||||
|
||||
/* casts are necessary for constants, because we never know how for sure
|
||||
* how U/UL/ULL map to __u16, __u32, __u64. At least not in a portable way.
|
||||
*/
|
||||
#define ___swab16(x) \
|
||||
({ \
|
||||
__u16 __x = (x); \
|
||||
((__u16)( \
|
||||
(((__u16)(__x) & (__u16)0x00ffU) << 8) | \
|
||||
(((__u16)(__x) & (__u16)0xff00U) >> 8) )); \
|
||||
})
|
||||
|
||||
#define ___swab32(x) \
|
||||
({ \
|
||||
__u32 __x = (x); \
|
||||
((__u32)( \
|
||||
(((__u32)(__x) & (__u32)0x000000ffUL) << 24) | \
|
||||
(((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | \
|
||||
(((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | \
|
||||
(((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); \
|
||||
})
|
||||
|
||||
#define ___swab64(x) \
|
||||
({ \
|
||||
__u64 __x = (x); \
|
||||
((__u64)( \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | \
|
||||
(__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); \
|
||||
})
|
||||
|
||||
#define ___constant_swab16(x) \
|
||||
((__u16)( \
|
||||
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
|
||||
(((__u16)(x) & (__u16)0xff00U) >> 8) ))
|
||||
#define ___constant_swab32(x) \
|
||||
((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x000000ffUL) << 24) | \
|
||||
(((__u32)(x) & (__u32)0x0000ff00UL) << 8) | \
|
||||
(((__u32)(x) & (__u32)0x00ff0000UL) >> 8) | \
|
||||
(((__u32)(x) & (__u32)0xff000000UL) >> 24) ))
|
||||
#define ___constant_swab64(x) \
|
||||
((__u64)( \
|
||||
(__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | \
|
||||
(__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) ))
|
||||
|
||||
/*
|
||||
* provide defaults when no architecture-specific optimization is detected
|
||||
*/
|
||||
#ifndef __arch__swab16
|
||||
# define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); })
|
||||
#endif
|
||||
#ifndef __arch__swab32
|
||||
# define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); })
|
||||
#endif
|
||||
#ifndef __arch__swab64
|
||||
# define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); })
|
||||
#endif
|
||||
|
||||
#ifndef __arch__swab16p
|
||||
# define __arch__swab16p(x) __arch__swab16(*(x))
|
||||
#endif
|
||||
#ifndef __arch__swab32p
|
||||
# define __arch__swab32p(x) __arch__swab32(*(x))
|
||||
#endif
|
||||
#ifndef __arch__swab64p
|
||||
# define __arch__swab64p(x) __arch__swab64(*(x))
|
||||
#endif
|
||||
|
||||
#ifndef __arch__swab16s
|
||||
# define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0)
|
||||
#endif
|
||||
#ifndef __arch__swab32s
|
||||
# define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0)
|
||||
#endif
|
||||
#ifndef __arch__swab64s
|
||||
# define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Allow constant folding
|
||||
*/
|
||||
#if defined(__GNUC__) && defined(__OPTIMIZE__)
|
||||
# define __swab16(x) \
|
||||
(__builtin_constant_p((__u16)(x)) ? \
|
||||
___swab16((x)) : \
|
||||
__fswab16((x)))
|
||||
# define __swab32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___swab32((x)) : \
|
||||
__fswab32((x)))
|
||||
# define __swab64(x) \
|
||||
(__builtin_constant_p((__u64)(x)) ? \
|
||||
___swab64((x)) : \
|
||||
__fswab64((x)))
|
||||
#else
|
||||
# define __swab16(x) __fswab16(x)
|
||||
# define __swab32(x) __fswab32(x)
|
||||
# define __swab64(x) __fswab64(x)
|
||||
#endif /* OPTIMIZE */
|
||||
|
||||
|
||||
static __inline__ __attribute_const__ __u16 __fswab16(__u16 x)
|
||||
{
|
||||
return __arch__swab16(x);
|
||||
}
|
||||
static __inline__ __u16 __swab16p(const __u16 *x)
|
||||
{
|
||||
return __arch__swab16p(x);
|
||||
}
|
||||
static __inline__ void __swab16s(__u16 *addr)
|
||||
{
|
||||
__arch__swab16s(addr);
|
||||
}
|
||||
|
||||
static __inline__ __attribute_const__ __u32 __fswab32(__u32 x)
|
||||
{
|
||||
return __arch__swab32(x);
|
||||
}
|
||||
static __inline__ __u32 __swab32p(const __u32 *x)
|
||||
{
|
||||
return __arch__swab32p(x);
|
||||
}
|
||||
static __inline__ void __swab32s(__u32 *addr)
|
||||
{
|
||||
__arch__swab32s(addr);
|
||||
}
|
||||
|
||||
#ifdef __BYTEORDER_HAS_U64__
|
||||
static __inline__ __attribute_const__ __u64 __fswab64(__u64 x)
|
||||
{
|
||||
# ifdef __SWAB_64_THRU_32__
|
||||
__u32 h = x >> 32;
|
||||
__u32 l = x & ((1ULL<<32)-1);
|
||||
return (((__u64)__swab32(l)) << 32) | ((__u64)(__swab32(h)));
|
||||
# else
|
||||
return __arch__swab64(x);
|
||||
# endif
|
||||
}
|
||||
static __inline__ __u64 __swab64p(const __u64 *x)
|
||||
{
|
||||
return __arch__swab64p(x);
|
||||
}
|
||||
static __inline__ void __swab64s(__u64 *addr)
|
||||
{
|
||||
__arch__swab64s(addr);
|
||||
}
|
||||
#endif /* __BYTEORDER_HAS_U64__ */
|
||||
|
||||
#if defined(__KERNEL__)
|
||||
#define swab16 __swab16
|
||||
#define swab32 __swab32
|
||||
#define swab64 __swab64
|
||||
#define swab16p __swab16p
|
||||
#define swab32p __swab32p
|
||||
#define swab64p __swab64p
|
||||
#define swab16s __swab16s
|
||||
#define swab32s __swab32s
|
||||
#define swab64s __swab64s
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_SWAB_H */
|
||||
135
include/linux/byteorder/swabb.h
Normal file
135
include/linux/byteorder/swabb.h
Normal file
@@ -0,0 +1,135 @@
|
||||
#ifndef _LINUX_BYTEORDER_SWABB_H
|
||||
#define _LINUX_BYTEORDER_SWABB_H
|
||||
|
||||
/*
|
||||
* linux/byteorder/swabb.h
|
||||
* SWAp Bytes Bizarrely
|
||||
* swaHHXX[ps]?(foo)
|
||||
*
|
||||
* Support for obNUXIous pdp-endian and other bizarre architectures.
|
||||
* Will Linux ever run on such ancient beasts? if not, this file
|
||||
* will be but a programming pearl. Still, it's a reminder that we
|
||||
* shouldn't be making too many assumptions when trying to be portable.
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* Meaning of the names I chose (vaxlinux people feel free to correct them):
|
||||
* swahw32 swap 16-bit half-words in a 32-bit word
|
||||
* swahb32 swap 8-bit halves of each 16-bit half-word in a 32-bit word
|
||||
*
|
||||
* No 64-bit support yet. I don't know NUXI conventions for long longs.
|
||||
* I guarantee it will be a mess when it's there, though :->
|
||||
* It will be even worse if there are conflicting 64-bit conventions.
|
||||
* Hopefully, no one ever used 64-bit objects on NUXI machines.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define ___swahw32(x) \
|
||||
({ \
|
||||
__u32 __x = (x); \
|
||||
((__u32)( \
|
||||
(((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | \
|
||||
(((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); \
|
||||
})
|
||||
#define ___swahb32(x) \
|
||||
({ \
|
||||
__u32 __x = (x); \
|
||||
((__u32)( \
|
||||
(((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | \
|
||||
(((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); \
|
||||
})
|
||||
|
||||
#define ___constant_swahw32(x) \
|
||||
((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x0000ffffUL) << 16) | \
|
||||
(((__u32)(x) & (__u32)0xffff0000UL) >> 16) ))
|
||||
#define ___constant_swahb32(x) \
|
||||
((__u32)( \
|
||||
(((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | \
|
||||
(((__u32)(x) & (__u32)0xff00ff00UL) >> 8) ))
|
||||
|
||||
/*
|
||||
* provide defaults when no architecture-specific optimization is detected
|
||||
*/
|
||||
#ifndef __arch__swahw32
|
||||
# define __arch__swahw32(x) ___swahw32(x)
|
||||
#endif
|
||||
#ifndef __arch__swahb32
|
||||
# define __arch__swahb32(x) ___swahb32(x)
|
||||
#endif
|
||||
|
||||
#ifndef __arch__swahw32p
|
||||
# define __arch__swahw32p(x) __swahw32(*(x))
|
||||
#endif
|
||||
#ifndef __arch__swahb32p
|
||||
# define __arch__swahb32p(x) __swahb32(*(x))
|
||||
#endif
|
||||
|
||||
#ifndef __arch__swahw32s
|
||||
# define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0)
|
||||
#endif
|
||||
#ifndef __arch__swahb32s
|
||||
# define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Allow constant folding
|
||||
*/
|
||||
#define __swahw32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___swahw32((x)) : \
|
||||
__fswahw32((x)))
|
||||
#define __swahb32(x) \
|
||||
(__builtin_constant_p((__u32)(x)) ? \
|
||||
___swahb32((x)) : \
|
||||
__fswahb32((x)))
|
||||
|
||||
|
||||
static inline __u32 __fswahw32(__u32 x)
|
||||
{
|
||||
return __arch__swahw32(x);
|
||||
}
|
||||
|
||||
static inline __u32 __swahw32p(__u32 *x)
|
||||
{
|
||||
return __arch__swahw32p(x);
|
||||
}
|
||||
|
||||
static inline void __swahw32s(__u32 *addr)
|
||||
{
|
||||
__arch__swahw32s(addr);
|
||||
}
|
||||
|
||||
static inline __u32 __fswahb32(__u32 x)
|
||||
{
|
||||
return __arch__swahb32(x);
|
||||
}
|
||||
|
||||
static inline __u32 __swahb32p(__u32 *x)
|
||||
{
|
||||
return __arch__swahb32p(x);
|
||||
}
|
||||
|
||||
static inline void __swahb32s(__u32 *addr)
|
||||
{
|
||||
__arch__swahb32s(addr);
|
||||
}
|
||||
|
||||
#ifdef __BYTEORDER_HAS_U64__
|
||||
/*
|
||||
* Not supported yet
|
||||
*/
|
||||
#endif /* __BYTEORDER_HAS_U64__ */
|
||||
|
||||
#define swahw32 __swahw32
|
||||
#define swahb32 __swahb32
|
||||
#define swahw32p __swahw32p
|
||||
#define swahb32p __swahb32p
|
||||
#define swahw32s __swahw32s
|
||||
#define swahb32s __swahb32s
|
||||
|
||||
#endif /* _LINUX_BYTEORDER_SWABB_H */
|
||||
63
include/linux/cache.h
Normal file
63
include/linux/cache.h
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef __LINUX_CACHE_H
|
||||
#define __LINUX_CACHE_H
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <asm/cache.h>
|
||||
|
||||
#ifndef L1_CACHE_ALIGN
|
||||
#define L1_CACHE_ALIGN(x) ALIGN(x, L1_CACHE_BYTES)
|
||||
#endif
|
||||
|
||||
#ifndef SMP_CACHE_BYTES
|
||||
#define SMP_CACHE_BYTES L1_CACHE_BYTES
|
||||
#endif
|
||||
|
||||
#ifndef __read_mostly
|
||||
#define __read_mostly
|
||||
#endif
|
||||
|
||||
#ifndef ____cacheline_aligned
|
||||
#define ____cacheline_aligned __attribute__((__aligned__(SMP_CACHE_BYTES)))
|
||||
#endif
|
||||
|
||||
#ifndef ____cacheline_aligned_in_smp
|
||||
#ifdef CONFIG_SMP
|
||||
#define ____cacheline_aligned_in_smp ____cacheline_aligned
|
||||
#else
|
||||
#define ____cacheline_aligned_in_smp
|
||||
#endif /* CONFIG_SMP */
|
||||
#endif
|
||||
|
||||
#ifndef __cacheline_aligned
|
||||
#define __cacheline_aligned \
|
||||
__attribute__((__aligned__(SMP_CACHE_BYTES), \
|
||||
__section__(".data.cacheline_aligned")))
|
||||
#endif /* __cacheline_aligned */
|
||||
|
||||
#ifndef __cacheline_aligned_in_smp
|
||||
#ifdef CONFIG_SMP
|
||||
#define __cacheline_aligned_in_smp __cacheline_aligned
|
||||
#else
|
||||
#define __cacheline_aligned_in_smp
|
||||
#endif /* CONFIG_SMP */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* The maximum alignment needed for some critical structures
|
||||
* These could be inter-node cacheline sizes/L3 cacheline
|
||||
* size etc. Define this in asm/cache.h for your arch
|
||||
*/
|
||||
#ifndef INTERNODE_CACHE_SHIFT
|
||||
#define INTERNODE_CACHE_SHIFT L1_CACHE_SHIFT
|
||||
#endif
|
||||
|
||||
#if !defined(____cacheline_internodealigned_in_smp)
|
||||
#if defined(CONFIG_SMP)
|
||||
#define ____cacheline_internodealigned_in_smp \
|
||||
__attribute__((__aligned__(1 << (INTERNODE_CACHE_SHIFT))))
|
||||
#else
|
||||
#define ____cacheline_internodealigned_in_smp
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __LINUX_CACHE_H */
|
||||
49
include/linux/calc64.h
Normal file
49
include/linux/calc64.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef _LINUX_CALC64_H
|
||||
#define _LINUX_CALC64_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <asm/div64.h>
|
||||
|
||||
/*
|
||||
* This is a generic macro which is used when the architecture
|
||||
* specific div64.h does not provide a optimized one.
|
||||
*
|
||||
* The 64bit dividend is divided by the divisor (data type long), the
|
||||
* result is returned and the remainder stored in the variable
|
||||
* referenced by remainder (data type long *). In contrast to the
|
||||
* do_div macro the dividend is kept intact.
|
||||
*/
|
||||
#ifndef div_long_long_rem
|
||||
#define div_long_long_rem(dividend, divisor, remainder) \
|
||||
do_div_llr((dividend), divisor, remainder)
|
||||
|
||||
static inline unsigned long do_div_llr(const long long dividend,
|
||||
const long divisor, long *remainder)
|
||||
{
|
||||
u64 result = dividend;
|
||||
|
||||
*(remainder) = do_div(result, divisor);
|
||||
return (unsigned long) result;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Sign aware variation of the above. On some architectures a
|
||||
* negative dividend leads to an divide overflow exception, which
|
||||
* is avoided by the sign check.
|
||||
*/
|
||||
static inline long div_long_long_rem_signed(const long long dividend,
|
||||
const long divisor, long *remainder)
|
||||
{
|
||||
long res;
|
||||
|
||||
if (unlikely(dividend < 0)) {
|
||||
res = -div_long_long_rem(-dividend, divisor, remainder);
|
||||
*remainder = -(*remainder);
|
||||
} else
|
||||
res = div_long_long_rem(dividend, divisor, remainder);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
#endif
|
||||
365
include/linux/capability.h
Normal file
365
include/linux/capability.h
Normal file
@@ -0,0 +1,365 @@
|
||||
/*
|
||||
* This is <linux/capability.h>
|
||||
*
|
||||
* Andrew G. Morgan <morgan@transmeta.com>
|
||||
* Alexander Kjeldaas <astor@guardian.no>
|
||||
* with help from Aleph1, Roland Buresund and Andrew Main.
|
||||
*
|
||||
* See here for the libcap library ("POSIX draft" compliance):
|
||||
*
|
||||
* ftp://linux.kernel.org/pub/linux/libs/security/linux-privs/kernel-2.2/
|
||||
*/
|
||||
|
||||
#ifndef _LINUX_CAPABILITY_H
|
||||
#define _LINUX_CAPABILITY_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/compiler.h>
|
||||
|
||||
/* User-level do most of the mapping between kernel and user
|
||||
capabilities based on the version tag given by the kernel. The
|
||||
kernel might be somewhat backwards compatible, but don't bet on
|
||||
it. */
|
||||
|
||||
/* XXX - Note, cap_t, is defined by POSIX to be an "opaque" pointer to
|
||||
a set of three capability sets. The transposition of 3*the
|
||||
following structure to such a composite is better handled in a user
|
||||
library since the draft standard requires the use of malloc/free
|
||||
etc.. */
|
||||
|
||||
#define _LINUX_CAPABILITY_VERSION 0x19980330
|
||||
|
||||
typedef struct __user_cap_header_struct {
|
||||
__u32 version;
|
||||
int pid;
|
||||
} __user *cap_user_header_t;
|
||||
|
||||
typedef struct __user_cap_data_struct {
|
||||
__u32 effective;
|
||||
__u32 permitted;
|
||||
__u32 inheritable;
|
||||
} __user *cap_user_data_t;
|
||||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/spinlock.h>
|
||||
#include <asm/current.h>
|
||||
|
||||
/* #define STRICT_CAP_T_TYPECHECKS */
|
||||
|
||||
#ifdef STRICT_CAP_T_TYPECHECKS
|
||||
|
||||
typedef struct kernel_cap_struct {
|
||||
__u32 cap;
|
||||
} kernel_cap_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef __u32 kernel_cap_t;
|
||||
|
||||
#endif
|
||||
|
||||
#define _USER_CAP_HEADER_SIZE (2*sizeof(__u32))
|
||||
#define _KERNEL_CAP_T_SIZE (sizeof(kernel_cap_t))
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
** POSIX-draft defined capabilities.
|
||||
**/
|
||||
|
||||
/* In a system with the [_POSIX_CHOWN_RESTRICTED] option defined, this
|
||||
overrides the restriction of changing file ownership and group
|
||||
ownership. */
|
||||
|
||||
#define CAP_CHOWN 0
|
||||
|
||||
/* Override all DAC access, including ACL execute access if
|
||||
[_POSIX_ACL] is defined. Excluding DAC access covered by
|
||||
CAP_LINUX_IMMUTABLE. */
|
||||
|
||||
#define CAP_DAC_OVERRIDE 1
|
||||
|
||||
/* Overrides all DAC restrictions regarding read and search on files
|
||||
and directories, including ACL restrictions if [_POSIX_ACL] is
|
||||
defined. Excluding DAC access covered by CAP_LINUX_IMMUTABLE. */
|
||||
|
||||
#define CAP_DAC_READ_SEARCH 2
|
||||
|
||||
/* Overrides all restrictions about allowed operations on files, where
|
||||
file owner ID must be equal to the user ID, except where CAP_FSETID
|
||||
is applicable. It doesn't override MAC and DAC restrictions. */
|
||||
|
||||
#define CAP_FOWNER 3
|
||||
|
||||
/* Overrides the following restrictions that the effective user ID
|
||||
shall match the file owner ID when setting the S_ISUID and S_ISGID
|
||||
bits on that file; that the effective group ID (or one of the
|
||||
supplementary group IDs) shall match the file owner ID when setting
|
||||
the S_ISGID bit on that file; that the S_ISUID and S_ISGID bits are
|
||||
cleared on successful return from chown(2) (not implemented). */
|
||||
|
||||
#define CAP_FSETID 4
|
||||
|
||||
/* Used to decide between falling back on the old suser() or fsuser(). */
|
||||
|
||||
#define CAP_FS_MASK 0x1f
|
||||
|
||||
/* Overrides the restriction that the real or effective user ID of a
|
||||
process sending a signal must match the real or effective user ID
|
||||
of the process receiving the signal. */
|
||||
|
||||
#define CAP_KILL 5
|
||||
|
||||
/* Allows setgid(2) manipulation */
|
||||
/* Allows setgroups(2) */
|
||||
/* Allows forged gids on socket credentials passing. */
|
||||
|
||||
#define CAP_SETGID 6
|
||||
|
||||
/* Allows set*uid(2) manipulation (including fsuid). */
|
||||
/* Allows forged pids on socket credentials passing. */
|
||||
|
||||
#define CAP_SETUID 7
|
||||
|
||||
|
||||
/**
|
||||
** Linux-specific capabilities
|
||||
**/
|
||||
|
||||
/* Transfer any capability in your permitted set to any pid,
|
||||
remove any capability in your permitted set from any pid */
|
||||
|
||||
#define CAP_SETPCAP 8
|
||||
|
||||
/* Allow modification of S_IMMUTABLE and S_APPEND file attributes */
|
||||
|
||||
#define CAP_LINUX_IMMUTABLE 9
|
||||
|
||||
/* Allows binding to TCP/UDP sockets below 1024 */
|
||||
/* Allows binding to ATM VCIs below 32 */
|
||||
|
||||
#define CAP_NET_BIND_SERVICE 10
|
||||
|
||||
/* Allow broadcasting, listen to multicast */
|
||||
|
||||
#define CAP_NET_BROADCAST 11
|
||||
|
||||
/* Allow interface configuration */
|
||||
/* Allow administration of IP firewall, masquerading and accounting */
|
||||
/* Allow setting debug option on sockets */
|
||||
/* Allow modification of routing tables */
|
||||
/* Allow setting arbitrary process / process group ownership on
|
||||
sockets */
|
||||
/* Allow binding to any address for transparent proxying */
|
||||
/* Allow setting TOS (type of service) */
|
||||
/* Allow setting promiscuous mode */
|
||||
/* Allow clearing driver statistics */
|
||||
/* Allow multicasting */
|
||||
/* Allow read/write of device-specific registers */
|
||||
/* Allow activation of ATM control sockets */
|
||||
|
||||
#define CAP_NET_ADMIN 12
|
||||
|
||||
/* Allow use of RAW sockets */
|
||||
/* Allow use of PACKET sockets */
|
||||
|
||||
#define CAP_NET_RAW 13
|
||||
|
||||
/* Allow locking of shared memory segments */
|
||||
/* Allow mlock and mlockall (which doesn't really have anything to do
|
||||
with IPC) */
|
||||
|
||||
#define CAP_IPC_LOCK 14
|
||||
|
||||
/* Override IPC ownership checks */
|
||||
|
||||
#define CAP_IPC_OWNER 15
|
||||
|
||||
/* Insert and remove kernel modules - modify kernel without limit */
|
||||
/* Modify cap_bset */
|
||||
#define CAP_SYS_MODULE 16
|
||||
|
||||
/* Allow ioperm/iopl access */
|
||||
/* Allow sending USB messages to any device via /proc/bus/usb */
|
||||
|
||||
#define CAP_SYS_RAWIO 17
|
||||
|
||||
/* Allow use of chroot() */
|
||||
|
||||
#define CAP_SYS_CHROOT 18
|
||||
|
||||
/* Allow ptrace() of any process */
|
||||
|
||||
#define CAP_SYS_PTRACE 19
|
||||
|
||||
/* Allow configuration of process accounting */
|
||||
|
||||
#define CAP_SYS_PACCT 20
|
||||
|
||||
/* Allow configuration of the secure attention key */
|
||||
/* Allow administration of the random device */
|
||||
/* Allow examination and configuration of disk quotas */
|
||||
/* Allow configuring the kernel's syslog (printk behaviour) */
|
||||
/* Allow setting the domainname */
|
||||
/* Allow setting the hostname */
|
||||
/* Allow calling bdflush() */
|
||||
/* Allow mount() and umount(), setting up new smb connection */
|
||||
/* Allow some autofs root ioctls */
|
||||
/* Allow nfsservctl */
|
||||
/* Allow VM86_REQUEST_IRQ */
|
||||
/* Allow to read/write pci config on alpha */
|
||||
/* Allow irix_prctl on mips (setstacksize) */
|
||||
/* Allow flushing all cache on m68k (sys_cacheflush) */
|
||||
/* Allow removing semaphores */
|
||||
/* Used instead of CAP_CHOWN to "chown" IPC message queues, semaphores
|
||||
and shared memory */
|
||||
/* Allow locking/unlocking of shared memory segment */
|
||||
/* Allow turning swap on/off */
|
||||
/* Allow forged pids on socket credentials passing */
|
||||
/* Allow setting readahead and flushing buffers on block devices */
|
||||
/* Allow setting geometry in floppy driver */
|
||||
/* Allow turning DMA on/off in xd driver */
|
||||
/* Allow administration of md devices (mostly the above, but some
|
||||
extra ioctls) */
|
||||
/* Allow tuning the ide driver */
|
||||
/* Allow access to the nvram device */
|
||||
/* Allow administration of apm_bios, serial and bttv (TV) device */
|
||||
/* Allow manufacturer commands in isdn CAPI support driver */
|
||||
/* Allow reading non-standardized portions of pci configuration space */
|
||||
/* Allow DDI debug ioctl on sbpcd driver */
|
||||
/* Allow setting up serial ports */
|
||||
/* Allow sending raw qic-117 commands */
|
||||
/* Allow enabling/disabling tagged queuing on SCSI controllers and sending
|
||||
arbitrary SCSI commands */
|
||||
/* Allow setting encryption key on loopback filesystem */
|
||||
/* Allow setting zone reclaim policy */
|
||||
|
||||
#define CAP_SYS_ADMIN 21
|
||||
|
||||
/* Allow use of reboot() */
|
||||
|
||||
#define CAP_SYS_BOOT 22
|
||||
|
||||
/* Allow raising priority and setting priority on other (different
|
||||
UID) processes */
|
||||
/* Allow use of FIFO and round-robin (realtime) scheduling on own
|
||||
processes and setting the scheduling algorithm used by another
|
||||
process. */
|
||||
/* Allow setting cpu affinity on other processes */
|
||||
|
||||
#define CAP_SYS_NICE 23
|
||||
|
||||
/* Override resource limits. Set resource limits. */
|
||||
/* Override quota limits. */
|
||||
/* Override reserved space on ext2 filesystem */
|
||||
/* Modify data journaling mode on ext3 filesystem (uses journaling
|
||||
resources) */
|
||||
/* NOTE: ext2 honors fsuid when checking for resource overrides, so
|
||||
you can override using fsuid too */
|
||||
/* Override size restrictions on IPC message queues */
|
||||
/* Allow more than 64hz interrupts from the real-time clock */
|
||||
/* Override max number of consoles on console allocation */
|
||||
/* Override max number of keymaps */
|
||||
|
||||
#define CAP_SYS_RESOURCE 24
|
||||
|
||||
/* Allow manipulation of system clock */
|
||||
/* Allow irix_stime on mips */
|
||||
/* Allow setting the real-time clock */
|
||||
|
||||
#define CAP_SYS_TIME 25
|
||||
|
||||
/* Allow configuration of tty devices */
|
||||
/* Allow vhangup() of tty */
|
||||
|
||||
#define CAP_SYS_TTY_CONFIG 26
|
||||
|
||||
/* Allow the privileged aspects of mknod() */
|
||||
|
||||
#define CAP_MKNOD 27
|
||||
|
||||
/* Allow taking of leases on files */
|
||||
|
||||
#define CAP_LEASE 28
|
||||
|
||||
#define CAP_AUDIT_WRITE 29
|
||||
|
||||
#define CAP_AUDIT_CONTROL 30
|
||||
|
||||
#ifdef __KERNEL__
|
||||
/*
|
||||
* Bounding set
|
||||
*/
|
||||
extern kernel_cap_t cap_bset;
|
||||
|
||||
/*
|
||||
* Internal kernel functions only
|
||||
*/
|
||||
|
||||
#ifdef STRICT_CAP_T_TYPECHECKS
|
||||
|
||||
#define to_cap_t(x) { x }
|
||||
#define cap_t(x) (x).cap
|
||||
|
||||
#else
|
||||
|
||||
#define to_cap_t(x) (x)
|
||||
#define cap_t(x) (x)
|
||||
|
||||
#endif
|
||||
|
||||
#define CAP_EMPTY_SET to_cap_t(0)
|
||||
#define CAP_FULL_SET to_cap_t(~0)
|
||||
#define CAP_INIT_EFF_SET to_cap_t(~0 & ~CAP_TO_MASK(CAP_SETPCAP))
|
||||
#define CAP_INIT_INH_SET to_cap_t(0)
|
||||
|
||||
#define CAP_TO_MASK(x) (1 << (x))
|
||||
#define cap_raise(c, flag) (cap_t(c) |= CAP_TO_MASK(flag))
|
||||
#define cap_lower(c, flag) (cap_t(c) &= ~CAP_TO_MASK(flag))
|
||||
#define cap_raised(c, flag) (cap_t(c) & CAP_TO_MASK(flag))
|
||||
|
||||
static inline kernel_cap_t cap_combine(kernel_cap_t a, kernel_cap_t b)
|
||||
{
|
||||
kernel_cap_t dest;
|
||||
cap_t(dest) = cap_t(a) | cap_t(b);
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline kernel_cap_t cap_intersect(kernel_cap_t a, kernel_cap_t b)
|
||||
{
|
||||
kernel_cap_t dest;
|
||||
cap_t(dest) = cap_t(a) & cap_t(b);
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline kernel_cap_t cap_drop(kernel_cap_t a, kernel_cap_t drop)
|
||||
{
|
||||
kernel_cap_t dest;
|
||||
cap_t(dest) = cap_t(a) & ~cap_t(drop);
|
||||
return dest;
|
||||
}
|
||||
|
||||
static inline kernel_cap_t cap_invert(kernel_cap_t c)
|
||||
{
|
||||
kernel_cap_t dest;
|
||||
cap_t(dest) = ~cap_t(c);
|
||||
return dest;
|
||||
}
|
||||
|
||||
#define cap_isclear(c) (!cap_t(c))
|
||||
#define cap_issubset(a,set) (!(cap_t(a) & ~cap_t(set)))
|
||||
|
||||
#define cap_clear(c) do { cap_t(c) = 0; } while(0)
|
||||
#define cap_set_full(c) do { cap_t(c) = ~0; } while(0)
|
||||
#define cap_mask(c,mask) do { cap_t(c) &= cap_t(mask); } while(0)
|
||||
|
||||
#define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK)
|
||||
|
||||
int capable(int cap);
|
||||
int __capable(struct task_struct *t, int cap);
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* !_LINUX_CAPABILITY_H */
|
||||
133
include/linux/capi.h
Normal file
133
include/linux/capi.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/* $Id: capi.h,v 1.1.1.1 2007/06/12 07:27:16 eyryu Exp $
|
||||
*
|
||||
* CAPI 2.0 Interface for Linux
|
||||
*
|
||||
* Copyright 1997 by Carsten Paeth (calle@calle.in-berlin.de)
|
||||
*
|
||||
* This software may be used and distributed according to the terms
|
||||
* of the GNU General Public License, incorporated herein by reference.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_CAPI_H__
|
||||
#define __LINUX_CAPI_H__
|
||||
|
||||
#include <asm/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
#ifndef __KERNEL__
|
||||
#include <linux/kernelcapi.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* CAPI_REGISTER
|
||||
*/
|
||||
|
||||
typedef struct capi_register_params { /* CAPI_REGISTER */
|
||||
__u32 level3cnt; /* No. of simulatneous user data connections */
|
||||
__u32 datablkcnt; /* No. of buffered data messages */
|
||||
__u32 datablklen; /* Size of buffered data messages */
|
||||
} capi_register_params;
|
||||
|
||||
#define CAPI_REGISTER _IOW('C',0x01,struct capi_register_params)
|
||||
|
||||
/*
|
||||
* CAPI_GET_MANUFACTURER
|
||||
*/
|
||||
|
||||
#define CAPI_MANUFACTURER_LEN 64
|
||||
|
||||
#define CAPI_GET_MANUFACTURER _IOWR('C',0x06,int) /* broken: wanted size 64 (CAPI_MANUFACTURER_LEN) */
|
||||
|
||||
/*
|
||||
* CAPI_GET_VERSION
|
||||
*/
|
||||
|
||||
typedef struct capi_version {
|
||||
__u32 majorversion;
|
||||
__u32 minorversion;
|
||||
__u32 majormanuversion;
|
||||
__u32 minormanuversion;
|
||||
} capi_version;
|
||||
|
||||
#define CAPI_GET_VERSION _IOWR('C',0x07,struct capi_version)
|
||||
|
||||
/*
|
||||
* CAPI_GET_SERIAL
|
||||
*/
|
||||
|
||||
#define CAPI_SERIAL_LEN 8
|
||||
#define CAPI_GET_SERIAL _IOWR('C',0x08,int) /* broken: wanted size 8 (CAPI_SERIAL_LEN) */
|
||||
|
||||
/*
|
||||
* CAPI_GET_PROFILE
|
||||
*/
|
||||
|
||||
typedef struct capi_profile {
|
||||
__u16 ncontroller; /* number of installed controller */
|
||||
__u16 nbchannel; /* number of B-Channels */
|
||||
__u32 goptions; /* global options */
|
||||
__u32 support1; /* B1 protocols support */
|
||||
__u32 support2; /* B2 protocols support */
|
||||
__u32 support3; /* B3 protocols support */
|
||||
__u32 reserved[6]; /* reserved */
|
||||
__u32 manu[5]; /* manufacturer specific information */
|
||||
} capi_profile;
|
||||
|
||||
#define CAPI_GET_PROFILE _IOWR('C',0x09,struct capi_profile)
|
||||
|
||||
typedef struct capi_manufacturer_cmd {
|
||||
unsigned long cmd;
|
||||
void __user *data;
|
||||
} capi_manufacturer_cmd;
|
||||
|
||||
/*
|
||||
* CAPI_MANUFACTURER_CMD
|
||||
*/
|
||||
|
||||
#define CAPI_MANUFACTURER_CMD _IOWR('C',0x20, struct capi_manufacturer_cmd)
|
||||
|
||||
/*
|
||||
* CAPI_GET_ERRCODE
|
||||
* capi errcode is set, * if read, write, or ioctl returns EIO,
|
||||
* ioctl returns errcode directly, and in arg, if != 0
|
||||
*/
|
||||
|
||||
#define CAPI_GET_ERRCODE _IOR('C',0x21, __u16)
|
||||
|
||||
/*
|
||||
* CAPI_INSTALLED
|
||||
*/
|
||||
#define CAPI_INSTALLED _IOR('C',0x22, __u16)
|
||||
|
||||
|
||||
/*
|
||||
* member contr is input for
|
||||
* CAPI_GET_MANUFACTURER, CAPI_VERSION, CAPI_GET_SERIAL
|
||||
* and CAPI_GET_PROFILE
|
||||
*/
|
||||
typedef union capi_ioctl_struct {
|
||||
__u32 contr;
|
||||
capi_register_params rparams;
|
||||
__u8 manufacturer[CAPI_MANUFACTURER_LEN];
|
||||
capi_version version;
|
||||
__u8 serial[CAPI_SERIAL_LEN];
|
||||
capi_profile profile;
|
||||
capi_manufacturer_cmd cmd;
|
||||
__u16 errcode;
|
||||
} capi_ioctl_struct;
|
||||
|
||||
/*
|
||||
* Middleware extension
|
||||
*/
|
||||
|
||||
#define CAPIFLAG_HIGHJACKING 0x0001
|
||||
|
||||
#define CAPI_GET_FLAGS _IOR('C',0x23, unsigned)
|
||||
#define CAPI_SET_FLAGS _IOR('C',0x24, unsigned)
|
||||
#define CAPI_CLR_FLAGS _IOR('C',0x25, unsigned)
|
||||
|
||||
#define CAPI_NCCI_OPENCOUNT _IOR('C',0x26, unsigned)
|
||||
|
||||
#define CAPI_NCCI_GETUNIT _IOR('C',0x27, unsigned)
|
||||
|
||||
#endif /* __LINUX_CAPI_H__ */
|
||||
241
include/linux/cciss_ioctl.h
Normal file
241
include/linux/cciss_ioctl.h
Normal file
@@ -0,0 +1,241 @@
|
||||
#ifndef CCISS_IOCTLH
|
||||
#define CCISS_IOCTLH
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define CCISS_IOC_MAGIC 'B'
|
||||
|
||||
|
||||
typedef struct _cciss_pci_info_struct
|
||||
{
|
||||
unsigned char bus;
|
||||
unsigned char dev_fn;
|
||||
unsigned short domain;
|
||||
__u32 board_id;
|
||||
} cciss_pci_info_struct;
|
||||
|
||||
typedef struct _cciss_coalint_struct
|
||||
{
|
||||
__u32 delay;
|
||||
__u32 count;
|
||||
} cciss_coalint_struct;
|
||||
|
||||
typedef char NodeName_type[16];
|
||||
|
||||
typedef __u32 Heartbeat_type;
|
||||
|
||||
#define CISS_PARSCSIU2 0x0001
|
||||
#define CISS_PARCSCIU3 0x0002
|
||||
#define CISS_FIBRE1G 0x0100
|
||||
#define CISS_FIBRE2G 0x0200
|
||||
typedef __u32 BusTypes_type;
|
||||
|
||||
typedef char FirmwareVer_type[4];
|
||||
typedef __u32 DriverVer_type;
|
||||
|
||||
#define MAX_KMALLOC_SIZE 128000
|
||||
|
||||
#ifndef CCISS_CMD_H
|
||||
// This defines are duplicated in cciss_cmd.h in the driver directory
|
||||
|
||||
//general boundary defintions
|
||||
#define SENSEINFOBYTES 32//note that this value may vary between host implementations
|
||||
|
||||
//Command Status value
|
||||
#define CMD_SUCCESS 0x0000
|
||||
#define CMD_TARGET_STATUS 0x0001
|
||||
#define CMD_DATA_UNDERRUN 0x0002
|
||||
#define CMD_DATA_OVERRUN 0x0003
|
||||
#define CMD_INVALID 0x0004
|
||||
#define CMD_PROTOCOL_ERR 0x0005
|
||||
#define CMD_HARDWARE_ERR 0x0006
|
||||
#define CMD_CONNECTION_LOST 0x0007
|
||||
#define CMD_ABORTED 0x0008
|
||||
#define CMD_ABORT_FAILED 0x0009
|
||||
#define CMD_UNSOLICITED_ABORT 0x000A
|
||||
#define CMD_TIMEOUT 0x000B
|
||||
#define CMD_UNABORTABLE 0x000C
|
||||
|
||||
//transfer direction
|
||||
#define XFER_NONE 0x00
|
||||
#define XFER_WRITE 0x01
|
||||
#define XFER_READ 0x02
|
||||
#define XFER_RSVD 0x03
|
||||
|
||||
//task attribute
|
||||
#define ATTR_UNTAGGED 0x00
|
||||
#define ATTR_SIMPLE 0x04
|
||||
#define ATTR_HEADOFQUEUE 0x05
|
||||
#define ATTR_ORDERED 0x06
|
||||
#define ATTR_ACA 0x07
|
||||
|
||||
//cdb type
|
||||
#define TYPE_CMD 0x00
|
||||
#define TYPE_MSG 0x01
|
||||
|
||||
// Type defs used in the following structs
|
||||
#define BYTE __u8
|
||||
#define WORD __u16
|
||||
#define HWORD __u16
|
||||
#define DWORD __u32
|
||||
|
||||
#define CISS_MAX_LUN 1024
|
||||
|
||||
#define LEVEL2LUN 1 // index into Target(x) structure, due to byte swapping
|
||||
#define LEVEL3LUN 0
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
//Command List Structure
|
||||
typedef union _SCSI3Addr_struct {
|
||||
struct {
|
||||
BYTE Dev;
|
||||
BYTE Bus:6;
|
||||
BYTE Mode:2; // b00
|
||||
} PeripDev;
|
||||
struct {
|
||||
BYTE DevLSB;
|
||||
BYTE DevMSB:6;
|
||||
BYTE Mode:2; // b01
|
||||
} LogDev;
|
||||
struct {
|
||||
BYTE Dev:5;
|
||||
BYTE Bus:3;
|
||||
BYTE Targ:6;
|
||||
BYTE Mode:2; // b10
|
||||
} LogUnit;
|
||||
} SCSI3Addr_struct;
|
||||
|
||||
typedef struct _PhysDevAddr_struct {
|
||||
DWORD TargetId:24;
|
||||
DWORD Bus:6;
|
||||
DWORD Mode:2;
|
||||
SCSI3Addr_struct Target[2]; //2 level target device addr
|
||||
} PhysDevAddr_struct;
|
||||
|
||||
typedef struct _LogDevAddr_struct {
|
||||
DWORD VolId:30;
|
||||
DWORD Mode:2;
|
||||
BYTE reserved[4];
|
||||
} LogDevAddr_struct;
|
||||
|
||||
typedef union _LUNAddr_struct {
|
||||
BYTE LunAddrBytes[8];
|
||||
SCSI3Addr_struct SCSI3Lun[4];
|
||||
PhysDevAddr_struct PhysDev;
|
||||
LogDevAddr_struct LogDev;
|
||||
} LUNAddr_struct;
|
||||
|
||||
typedef struct _RequestBlock_struct {
|
||||
BYTE CDBLen;
|
||||
struct {
|
||||
BYTE Type:3;
|
||||
BYTE Attribute:3;
|
||||
BYTE Direction:2;
|
||||
} Type;
|
||||
HWORD Timeout;
|
||||
BYTE CDB[16];
|
||||
} RequestBlock_struct;
|
||||
|
||||
typedef union _MoreErrInfo_struct{
|
||||
struct {
|
||||
BYTE Reserved[3];
|
||||
BYTE Type;
|
||||
DWORD ErrorInfo;
|
||||
}Common_Info;
|
||||
struct{
|
||||
BYTE Reserved[2];
|
||||
BYTE offense_size;//size of offending entry
|
||||
BYTE offense_num; //byte # of offense 0-base
|
||||
DWORD offense_value;
|
||||
}Invalid_Cmd;
|
||||
}MoreErrInfo_struct;
|
||||
typedef struct _ErrorInfo_struct {
|
||||
BYTE ScsiStatus;
|
||||
BYTE SenseLen;
|
||||
HWORD CommandStatus;
|
||||
DWORD ResidualCnt;
|
||||
MoreErrInfo_struct MoreErrInfo;
|
||||
BYTE SenseInfo[SENSEINFOBYTES];
|
||||
} ErrorInfo_struct;
|
||||
|
||||
#pragma pack()
|
||||
#endif /* CCISS_CMD_H */
|
||||
|
||||
typedef struct _IOCTL_Command_struct {
|
||||
LUNAddr_struct LUN_info;
|
||||
RequestBlock_struct Request;
|
||||
ErrorInfo_struct error_info;
|
||||
WORD buf_size; /* size in bytes of the buf */
|
||||
BYTE __user *buf;
|
||||
} IOCTL_Command_struct;
|
||||
|
||||
typedef struct _BIG_IOCTL_Command_struct {
|
||||
LUNAddr_struct LUN_info;
|
||||
RequestBlock_struct Request;
|
||||
ErrorInfo_struct error_info;
|
||||
DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
|
||||
DWORD buf_size; /* size in bytes of the buf */
|
||||
/* < malloc_size * MAXSGENTRIES */
|
||||
BYTE __user *buf;
|
||||
} BIG_IOCTL_Command_struct;
|
||||
|
||||
typedef struct _LogvolInfo_struct{
|
||||
__u32 LunID;
|
||||
int num_opens; /* number of opens on the logical volume */
|
||||
int num_parts; /* number of partitions configured on logvol */
|
||||
} LogvolInfo_struct;
|
||||
|
||||
#define CCISS_GETPCIINFO _IOR(CCISS_IOC_MAGIC, 1, cciss_pci_info_struct)
|
||||
|
||||
#define CCISS_GETINTINFO _IOR(CCISS_IOC_MAGIC, 2, cciss_coalint_struct)
|
||||
#define CCISS_SETINTINFO _IOW(CCISS_IOC_MAGIC, 3, cciss_coalint_struct)
|
||||
|
||||
#define CCISS_GETNODENAME _IOR(CCISS_IOC_MAGIC, 4, NodeName_type)
|
||||
#define CCISS_SETNODENAME _IOW(CCISS_IOC_MAGIC, 5, NodeName_type)
|
||||
|
||||
#define CCISS_GETHEARTBEAT _IOR(CCISS_IOC_MAGIC, 6, Heartbeat_type)
|
||||
#define CCISS_GETBUSTYPES _IOR(CCISS_IOC_MAGIC, 7, BusTypes_type)
|
||||
#define CCISS_GETFIRMVER _IOR(CCISS_IOC_MAGIC, 8, FirmwareVer_type)
|
||||
#define CCISS_GETDRIVVER _IOR(CCISS_IOC_MAGIC, 9, DriverVer_type)
|
||||
#define CCISS_REVALIDVOLS _IO(CCISS_IOC_MAGIC, 10)
|
||||
#define CCISS_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 11, IOCTL_Command_struct)
|
||||
#define CCISS_DEREGDISK _IO(CCISS_IOC_MAGIC, 12)
|
||||
|
||||
/* no longer used... use REGNEWD instead */
|
||||
#define CCISS_REGNEWDISK _IOW(CCISS_IOC_MAGIC, 13, int)
|
||||
|
||||
#define CCISS_REGNEWD _IO(CCISS_IOC_MAGIC, 14)
|
||||
#define CCISS_RESCANDISK _IO(CCISS_IOC_MAGIC, 16)
|
||||
#define CCISS_GETLUNINFO _IOR(CCISS_IOC_MAGIC, 17, LogvolInfo_struct)
|
||||
#define CCISS_BIG_PASSTHRU _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL_Command_struct)
|
||||
|
||||
#ifdef __KERNEL__
|
||||
#ifdef CONFIG_COMPAT
|
||||
|
||||
/* 32 bit compatible ioctl structs */
|
||||
typedef struct _IOCTL32_Command_struct {
|
||||
LUNAddr_struct LUN_info;
|
||||
RequestBlock_struct Request;
|
||||
ErrorInfo_struct error_info;
|
||||
WORD buf_size; /* size in bytes of the buf */
|
||||
__u32 buf; /* 32 bit pointer to data buffer */
|
||||
} IOCTL32_Command_struct;
|
||||
|
||||
typedef struct _BIG_IOCTL32_Command_struct {
|
||||
LUNAddr_struct LUN_info;
|
||||
RequestBlock_struct Request;
|
||||
ErrorInfo_struct error_info;
|
||||
DWORD malloc_size; /* < MAX_KMALLOC_SIZE in cciss.c */
|
||||
DWORD buf_size; /* size in bytes of the buf */
|
||||
/* < malloc_size * MAXSGENTRIES */
|
||||
__u32 buf; /* 32 bit pointer to data buffer */
|
||||
} BIG_IOCTL32_Command_struct;
|
||||
|
||||
#define CCISS_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 11, IOCTL32_Command_struct)
|
||||
#define CCISS_BIG_PASSTHRU32 _IOWR(CCISS_IOC_MAGIC, 18, BIG_IOCTL32_Command_struct)
|
||||
|
||||
#endif /* CONFIG_COMPAT */
|
||||
#endif /* __KERNEL__ */
|
||||
#endif
|
||||
292
include/linux/cd1400.h
Normal file
292
include/linux/cd1400.h
Normal file
@@ -0,0 +1,292 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* cd1400.h -- cd1400 UART hardware info.
|
||||
*
|
||||
* Copyright (C) 1996-1998 Stallion Technologies
|
||||
* Copyright (C) 1994-1996 Greg Ungerer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
#ifndef _CD1400_H
|
||||
#define _CD1400_H
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the number of async ports per cd1400 uart chip.
|
||||
*/
|
||||
#define CD1400_PORTS 4
|
||||
|
||||
/*
|
||||
* Define the cd1400 uarts internal FIFO sizes.
|
||||
*/
|
||||
#define CD1400_TXFIFOSIZE 12
|
||||
#define CD1400_RXFIFOSIZE 12
|
||||
|
||||
/*
|
||||
* Local RX FIFO thresh hold level. Also define the RTS thresh hold
|
||||
* based on the RX thresh hold.
|
||||
*/
|
||||
#define FIFO_RXTHRESHOLD 6
|
||||
#define FIFO_RTSTHRESHOLD 7
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the cd1400 register addresses. These are all the valid
|
||||
* registers with the cd1400. Some are global, some virtual, some
|
||||
* per port.
|
||||
*/
|
||||
#define GFRCR 0x40
|
||||
#define CAR 0x68
|
||||
#define GCR 0x4b
|
||||
#define SVRR 0x67
|
||||
#define RICR 0x44
|
||||
#define TICR 0x45
|
||||
#define MICR 0x46
|
||||
#define RIR 0x6b
|
||||
#define TIR 0x6a
|
||||
#define MIR 0x69
|
||||
#define PPR 0x7e
|
||||
|
||||
#define RIVR 0x43
|
||||
#define TIVR 0x42
|
||||
#define MIVR 0x41
|
||||
#define TDR 0x63
|
||||
#define RDSR 0x62
|
||||
#define MISR 0x4c
|
||||
#define EOSRR 0x60
|
||||
|
||||
#define LIVR 0x18
|
||||
#define CCR 0x05
|
||||
#define SRER 0x06
|
||||
#define COR1 0x08
|
||||
#define COR2 0x09
|
||||
#define COR3 0x0a
|
||||
#define COR4 0x1e
|
||||
#define COR5 0x1f
|
||||
#define CCSR 0x0b
|
||||
#define RDCR 0x0e
|
||||
#define SCHR1 0x1a
|
||||
#define SCHR2 0x1b
|
||||
#define SCHR3 0x1c
|
||||
#define SCHR4 0x1d
|
||||
#define SCRL 0x22
|
||||
#define SCRH 0x23
|
||||
#define LNC 0x24
|
||||
#define MCOR1 0x15
|
||||
#define MCOR2 0x16
|
||||
#define RTPR 0x21
|
||||
#define MSVR1 0x6c
|
||||
#define MSVR2 0x6d
|
||||
#define PSVR 0x6f
|
||||
#define RBPR 0x78
|
||||
#define RCOR 0x7c
|
||||
#define TBPR 0x72
|
||||
#define TCOR 0x76
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the set of baud rate clock divisors.
|
||||
*/
|
||||
#define CD1400_CLK0 8
|
||||
#define CD1400_CLK1 32
|
||||
#define CD1400_CLK2 128
|
||||
#define CD1400_CLK3 512
|
||||
#define CD1400_CLK4 2048
|
||||
|
||||
#define CD1400_NUMCLKS 5
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the clock pre-scalar value to be a 5 ms clock. This should be
|
||||
* OK for now. It would probably be better to make it 10 ms, but we
|
||||
* can't fit that divisor into 8 bits!
|
||||
*/
|
||||
#define PPR_SCALAR 244
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define values used to set character size options.
|
||||
*/
|
||||
#define COR1_CHL5 0x00
|
||||
#define COR1_CHL6 0x01
|
||||
#define COR1_CHL7 0x02
|
||||
#define COR1_CHL8 0x03
|
||||
|
||||
/*
|
||||
* Define values used to set the number of stop bits.
|
||||
*/
|
||||
#define COR1_STOP1 0x00
|
||||
#define COR1_STOP15 0x04
|
||||
#define COR1_STOP2 0x08
|
||||
|
||||
/*
|
||||
* Define values used to set the parity scheme in use.
|
||||
*/
|
||||
#define COR1_PARNONE 0x00
|
||||
#define COR1_PARFORCE 0x20
|
||||
#define COR1_PARENB 0x40
|
||||
#define COR1_PARIGNORE 0x10
|
||||
|
||||
#define COR1_PARODD 0x80
|
||||
#define COR1_PAREVEN 0x00
|
||||
|
||||
#define COR2_IXM 0x80
|
||||
#define COR2_TXIBE 0x40
|
||||
#define COR2_ETC 0x20
|
||||
#define COR2_LLM 0x10
|
||||
#define COR2_RLM 0x08
|
||||
#define COR2_RTSAO 0x04
|
||||
#define COR2_CTSAE 0x02
|
||||
|
||||
#define COR3_SCDRNG 0x80
|
||||
#define COR3_SCD34 0x40
|
||||
#define COR3_FCT 0x20
|
||||
#define COR3_SCD12 0x10
|
||||
|
||||
/*
|
||||
* Define values used by COR4.
|
||||
*/
|
||||
#define COR4_BRKINT 0x08
|
||||
#define COR4_IGNBRK 0x18
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the modem control register values.
|
||||
* Note that the actual hardware is a little different to the conventional
|
||||
* pin names on the cd1400.
|
||||
*/
|
||||
#define MSVR1_DTR 0x01
|
||||
#define MSVR1_DSR 0x10
|
||||
#define MSVR1_RI 0x20
|
||||
#define MSVR1_CTS 0x40
|
||||
#define MSVR1_DCD 0x80
|
||||
|
||||
#define MSVR2_RTS 0x02
|
||||
#define MSVR2_DSR 0x10
|
||||
#define MSVR2_RI 0x20
|
||||
#define MSVR2_CTS 0x40
|
||||
#define MSVR2_DCD 0x80
|
||||
|
||||
#define MCOR1_DCD 0x80
|
||||
#define MCOR1_CTS 0x40
|
||||
#define MCOR1_RI 0x20
|
||||
#define MCOR1_DSR 0x10
|
||||
|
||||
#define MCOR2_DCD 0x80
|
||||
#define MCOR2_CTS 0x40
|
||||
#define MCOR2_RI 0x20
|
||||
#define MCOR2_DSR 0x10
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the bits used with the service (interrupt) enable register.
|
||||
*/
|
||||
#define SRER_NNDT 0x01
|
||||
#define SRER_TXEMPTY 0x02
|
||||
#define SRER_TXDATA 0x04
|
||||
#define SRER_RXDATA 0x10
|
||||
#define SRER_MODEM 0x80
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define operational commands for the command register.
|
||||
*/
|
||||
#define CCR_RESET 0x80
|
||||
#define CCR_CORCHANGE 0x4e
|
||||
#define CCR_SENDCH 0x20
|
||||
#define CCR_CHANCTRL 0x10
|
||||
|
||||
#define CCR_TXENABLE (CCR_CHANCTRL | 0x08)
|
||||
#define CCR_TXDISABLE (CCR_CHANCTRL | 0x04)
|
||||
#define CCR_RXENABLE (CCR_CHANCTRL | 0x02)
|
||||
#define CCR_RXDISABLE (CCR_CHANCTRL | 0x01)
|
||||
|
||||
#define CCR_SENDSCHR1 (CCR_SENDCH | 0x01)
|
||||
#define CCR_SENDSCHR2 (CCR_SENDCH | 0x02)
|
||||
#define CCR_SENDSCHR3 (CCR_SENDCH | 0x03)
|
||||
#define CCR_SENDSCHR4 (CCR_SENDCH | 0x04)
|
||||
|
||||
#define CCR_RESETCHAN (CCR_RESET | 0x00)
|
||||
#define CCR_RESETFULL (CCR_RESET | 0x01)
|
||||
#define CCR_TXFLUSHFIFO (CCR_RESET | 0x02)
|
||||
|
||||
#define CCR_MAXWAIT 10000
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the valid acknowledgement types (for hw ack cycle).
|
||||
*/
|
||||
#define ACK_TYPMASK 0x07
|
||||
#define ACK_TYPTX 0x02
|
||||
#define ACK_TYPMDM 0x01
|
||||
#define ACK_TYPRXGOOD 0x03
|
||||
#define ACK_TYPRXBAD 0x07
|
||||
|
||||
#define SVRR_RX 0x01
|
||||
#define SVRR_TX 0x02
|
||||
#define SVRR_MDM 0x04
|
||||
|
||||
#define ST_OVERRUN 0x01
|
||||
#define ST_FRAMING 0x02
|
||||
#define ST_PARITY 0x04
|
||||
#define ST_BREAK 0x08
|
||||
#define ST_SCHAR1 0x10
|
||||
#define ST_SCHAR2 0x20
|
||||
#define ST_SCHAR3 0x30
|
||||
#define ST_SCHAR4 0x40
|
||||
#define ST_RANGE 0x70
|
||||
#define ST_SCHARMASK 0x70
|
||||
#define ST_TIMEOUT 0x80
|
||||
|
||||
#define MISR_DCD 0x80
|
||||
#define MISR_CTS 0x40
|
||||
#define MISR_RI 0x20
|
||||
#define MISR_DSR 0x10
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Defines for the CCSR status register.
|
||||
*/
|
||||
#define CCSR_RXENABLED 0x80
|
||||
#define CCSR_RXFLOWON 0x40
|
||||
#define CCSR_RXFLOWOFF 0x20
|
||||
#define CCSR_TXENABLED 0x08
|
||||
#define CCSR_TXFLOWON 0x04
|
||||
#define CCSR_TXFLOWOFF 0x02
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the embedded commands.
|
||||
*/
|
||||
#define ETC_CMD 0x00
|
||||
#define ETC_STARTBREAK 0x81
|
||||
#define ETC_DELAY 0x82
|
||||
#define ETC_STOPBREAK 0x83
|
||||
|
||||
/*****************************************************************************/
|
||||
#endif
|
||||
37
include/linux/cdev.h
Normal file
37
include/linux/cdev.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#ifndef _LINUX_CDEV_H
|
||||
#define _LINUX_CDEV_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/kdev_t.h>
|
||||
#include <linux/list.h>
|
||||
|
||||
struct file_operations;
|
||||
struct inode;
|
||||
struct module;
|
||||
|
||||
struct cdev {
|
||||
struct kobject kobj;
|
||||
struct module *owner;
|
||||
const struct file_operations *ops;
|
||||
struct list_head list;
|
||||
dev_t dev;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
void cdev_init(struct cdev *, const struct file_operations *);
|
||||
|
||||
struct cdev *cdev_alloc(void);
|
||||
|
||||
void cdev_put(struct cdev *p);
|
||||
|
||||
int cdev_add(struct cdev *, dev_t, unsigned);
|
||||
|
||||
void cdev_del(struct cdev *);
|
||||
|
||||
void cd_forget(struct inode *);
|
||||
|
||||
extern struct backing_dev_info directly_mappable_cdev_bdi;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
486
include/linux/cdk.h
Normal file
486
include/linux/cdk.h
Normal file
@@ -0,0 +1,486 @@
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* cdk.h -- CDK interface definitions.
|
||||
*
|
||||
* Copyright (C) 1996-1998 Stallion Technologies
|
||||
* Copyright (C) 1994-1996 Greg Ungerer.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
#ifndef _CDK_H
|
||||
#define _CDK_H
|
||||
/*****************************************************************************/
|
||||
|
||||
#pragma pack(2)
|
||||
|
||||
/*
|
||||
* The following set of definitions is used to communicate with the
|
||||
* shared memory interface of the Stallion intelligent multiport serial
|
||||
* boards. The definitions in this file are taken directly from the
|
||||
* document titled "Generic Stackable Interface, Downloader and
|
||||
* Communications Development Kit".
|
||||
*/
|
||||
|
||||
/*
|
||||
* Define the set of important shared memory addresses. These are
|
||||
* required to initialize the board and get things started. All of these
|
||||
* addresses are relative to the start of the shared memory.
|
||||
*/
|
||||
#define CDK_SIGADDR 0x200
|
||||
#define CDK_FEATADDR 0x280
|
||||
#define CDK_CDKADDR 0x300
|
||||
#define CDK_RDYADDR 0x262
|
||||
|
||||
#define CDK_ALIVEMARKER 13
|
||||
|
||||
/*
|
||||
* On hardware power up the ROMs located on the EasyConnection 8/64 will
|
||||
* fill out the following signature information into shared memory. This
|
||||
* way the host system can quickly determine that the board is present
|
||||
* and is operational.
|
||||
*/
|
||||
typedef struct cdkecpsig {
|
||||
unsigned long magic;
|
||||
unsigned short romver;
|
||||
unsigned short cputype;
|
||||
unsigned char panelid[8];
|
||||
} cdkecpsig_t;
|
||||
|
||||
#define ECP_MAGIC 0x21504345
|
||||
|
||||
/*
|
||||
* On hardware power up the ROMs located on the ONboard, Stallion and
|
||||
* Brumbys will fill out the following signature information into shared
|
||||
* memory. This way the host system can quickly determine that the board
|
||||
* is present and is operational.
|
||||
*/
|
||||
typedef struct cdkonbsig {
|
||||
unsigned short magic0;
|
||||
unsigned short magic1;
|
||||
unsigned short magic2;
|
||||
unsigned short magic3;
|
||||
unsigned short romver;
|
||||
unsigned short memoff;
|
||||
unsigned short memseg;
|
||||
unsigned short amask0;
|
||||
unsigned short pic;
|
||||
unsigned short status;
|
||||
unsigned short btype;
|
||||
unsigned short clkticks;
|
||||
unsigned short clkspeed;
|
||||
unsigned short amask1;
|
||||
unsigned short amask2;
|
||||
} cdkonbsig_t;
|
||||
|
||||
#define ONB_MAGIC0 0xf2a7
|
||||
#define ONB_MAGIC1 0xa149
|
||||
#define ONB_MAGIC2 0x6352
|
||||
#define ONB_MAGIC3 0xf121
|
||||
|
||||
/*
|
||||
* Define the feature area structure. The feature area is the set of
|
||||
* startup parameters used by the slave image when it starts executing.
|
||||
* They allow for the specification of buffer sizes, debug trace, etc.
|
||||
*/
|
||||
typedef struct cdkfeature {
|
||||
unsigned long debug;
|
||||
unsigned long banner;
|
||||
unsigned long etype;
|
||||
unsigned long nrdevs;
|
||||
unsigned long brdspec;
|
||||
unsigned long txrqsize;
|
||||
unsigned long rxrqsize;
|
||||
unsigned long flags;
|
||||
} cdkfeature_t;
|
||||
|
||||
#define ETYP_DDK 0
|
||||
#define ETYP_CDK 1
|
||||
|
||||
/*
|
||||
* Define the CDK header structure. This is the info that the slave
|
||||
* environment sets up after it has been downloaded and started. It
|
||||
* essentially provides a memory map for the shared memory interface.
|
||||
*/
|
||||
typedef struct cdkhdr {
|
||||
unsigned short command;
|
||||
unsigned short status;
|
||||
unsigned short port;
|
||||
unsigned short mode;
|
||||
unsigned long cmd_buf[14];
|
||||
unsigned short alive_cnt;
|
||||
unsigned short intrpt_mode;
|
||||
unsigned char intrpt_id[8];
|
||||
unsigned char ver_release;
|
||||
unsigned char ver_modification;
|
||||
unsigned char ver_fix;
|
||||
unsigned char deadman_restart;
|
||||
unsigned short deadman;
|
||||
unsigned short nrdevs;
|
||||
unsigned long memp;
|
||||
unsigned long hostp;
|
||||
unsigned long slavep;
|
||||
unsigned char hostreq;
|
||||
unsigned char slavereq;
|
||||
unsigned char cmd_reserved[30];
|
||||
} cdkhdr_t;
|
||||
|
||||
#define MODE_DDK 0
|
||||
#define MODE_CDK 1
|
||||
|
||||
#define IMD_INTR 0x0
|
||||
#define IMD_PPINTR 0x1
|
||||
#define IMD_POLL 0xff
|
||||
|
||||
/*
|
||||
* Define the memory mapping structure. This structure is pointed to by
|
||||
* the memp field in the stlcdkhdr struct. As many as these structures
|
||||
* as required are layed out in shared memory to define how the rest of
|
||||
* shared memory is divided up. There will be one for each port.
|
||||
*/
|
||||
typedef struct cdkmem {
|
||||
unsigned short dtype;
|
||||
unsigned long offset;
|
||||
} cdkmem_t;
|
||||
|
||||
#define TYP_UNDEFINED 0x0
|
||||
#define TYP_ASYNCTRL 0x1
|
||||
#define TYP_ASYNC 0x20
|
||||
#define TYP_PARALLEL 0x40
|
||||
#define TYP_SYNCX21 0x60
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Following is a set of defines and structures used to actually deal
|
||||
* with the serial ports on the board. Firstly is the set of commands
|
||||
* that can be applied to ports.
|
||||
*/
|
||||
#define ASYCMD (((unsigned long) 'a') << 8)
|
||||
|
||||
#define A_NULL (ASYCMD | 0)
|
||||
#define A_FLUSH (ASYCMD | 1)
|
||||
#define A_BREAK (ASYCMD | 2)
|
||||
#define A_GETPORT (ASYCMD | 3)
|
||||
#define A_SETPORT (ASYCMD | 4)
|
||||
#define A_SETPORTF (ASYCMD | 5)
|
||||
#define A_SETPORTFTX (ASYCMD | 6)
|
||||
#define A_SETPORTFRX (ASYCMD | 7)
|
||||
#define A_GETSIGNALS (ASYCMD | 8)
|
||||
#define A_SETSIGNALS (ASYCMD | 9)
|
||||
#define A_SETSIGNALSF (ASYCMD | 10)
|
||||
#define A_SETSIGNALSFTX (ASYCMD | 11)
|
||||
#define A_SETSIGNALSFRX (ASYCMD | 12)
|
||||
#define A_GETNOTIFY (ASYCMD | 13)
|
||||
#define A_SETNOTIFY (ASYCMD | 14)
|
||||
#define A_NOTIFY (ASYCMD | 15)
|
||||
#define A_PORTCTRL (ASYCMD | 16)
|
||||
#define A_GETSTATS (ASYCMD | 17)
|
||||
#define A_RQSTATE (ASYCMD | 18)
|
||||
#define A_FLOWSTATE (ASYCMD | 19)
|
||||
#define A_CLEARSTATS (ASYCMD | 20)
|
||||
|
||||
/*
|
||||
* Define those arguments used for simple commands.
|
||||
*/
|
||||
#define FLUSHRX 0x1
|
||||
#define FLUSHTX 0x2
|
||||
|
||||
#define BREAKON -1
|
||||
#define BREAKOFF -2
|
||||
|
||||
/*
|
||||
* Define the port setting structure, and all those defines that go along
|
||||
* with it. Basically this structure defines the characteristics of this
|
||||
* port: baud rate, chars, parity, input/output char cooking etc.
|
||||
*/
|
||||
typedef struct asyport {
|
||||
unsigned long baudout;
|
||||
unsigned long baudin;
|
||||
unsigned long iflag;
|
||||
unsigned long oflag;
|
||||
unsigned long lflag;
|
||||
unsigned long pflag;
|
||||
unsigned long flow;
|
||||
unsigned long spare1;
|
||||
unsigned short vtime;
|
||||
unsigned short vmin;
|
||||
unsigned short txlo;
|
||||
unsigned short txhi;
|
||||
unsigned short rxlo;
|
||||
unsigned short rxhi;
|
||||
unsigned short rxhog;
|
||||
unsigned short spare2;
|
||||
unsigned char csize;
|
||||
unsigned char stopbs;
|
||||
unsigned char parity;
|
||||
unsigned char stopin;
|
||||
unsigned char startin;
|
||||
unsigned char stopout;
|
||||
unsigned char startout;
|
||||
unsigned char parmark;
|
||||
unsigned char brkmark;
|
||||
unsigned char cc[11];
|
||||
} asyport_t;
|
||||
|
||||
#define PT_STOP1 0x0
|
||||
#define PT_STOP15 0x1
|
||||
#define PT_STOP2 0x2
|
||||
|
||||
#define PT_NOPARITY 0x0
|
||||
#define PT_ODDPARITY 0x1
|
||||
#define PT_EVENPARITY 0x2
|
||||
#define PT_MARKPARITY 0x3
|
||||
#define PT_SPACEPARITY 0x4
|
||||
|
||||
#define F_NONE 0x0
|
||||
#define F_IXON 0x1
|
||||
#define F_IXOFF 0x2
|
||||
#define F_IXANY 0x4
|
||||
#define F_IOXANY 0x8
|
||||
#define F_RTSFLOW 0x10
|
||||
#define F_CTSFLOW 0x20
|
||||
#define F_DTRFLOW 0x40
|
||||
#define F_DCDFLOW 0x80
|
||||
#define F_DSROFLOW 0x100
|
||||
#define F_DSRIFLOW 0x200
|
||||
|
||||
#define FI_NORX 0x1
|
||||
#define FI_RAW 0x2
|
||||
#define FI_ISTRIP 0x4
|
||||
#define FI_UCLC 0x8
|
||||
#define FI_INLCR 0x10
|
||||
#define FI_ICRNL 0x20
|
||||
#define FI_IGNCR 0x40
|
||||
#define FI_IGNBREAK 0x80
|
||||
#define FI_DSCRDBREAK 0x100
|
||||
#define FI_1MARKBREAK 0x200
|
||||
#define FI_2MARKBREAK 0x400
|
||||
#define FI_XCHNGBREAK 0x800
|
||||
#define FI_IGNRXERRS 0x1000
|
||||
#define FI_DSCDRXERRS 0x2000
|
||||
#define FI_1MARKRXERRS 0x4000
|
||||
#define FI_2MARKRXERRS 0x8000
|
||||
#define FI_XCHNGRXERRS 0x10000
|
||||
#define FI_DSCRDNULL 0x20000
|
||||
|
||||
#define FO_OLCUC 0x1
|
||||
#define FO_ONLCR 0x2
|
||||
#define FO_OOCRNL 0x4
|
||||
#define FO_ONOCR 0x8
|
||||
#define FO_ONLRET 0x10
|
||||
#define FO_ONL 0x20
|
||||
#define FO_OBS 0x40
|
||||
#define FO_OVT 0x80
|
||||
#define FO_OFF 0x100
|
||||
#define FO_OTAB1 0x200
|
||||
#define FO_OTAB2 0x400
|
||||
#define FO_OTAB3 0x800
|
||||
#define FO_OCR1 0x1000
|
||||
#define FO_OCR2 0x2000
|
||||
#define FO_OCR3 0x4000
|
||||
#define FO_OFILL 0x8000
|
||||
#define FO_ODELL 0x10000
|
||||
|
||||
#define P_RTSLOCK 0x1
|
||||
#define P_CTSLOCK 0x2
|
||||
#define P_MAPRTS 0x4
|
||||
#define P_MAPCTS 0x8
|
||||
#define P_LOOPBACK 0x10
|
||||
#define P_DTRFOLLOW 0x20
|
||||
#define P_FAKEDCD 0x40
|
||||
|
||||
#define P_RXIMIN 0x10000
|
||||
#define P_RXITIME 0x20000
|
||||
#define P_RXTHOLD 0x40000
|
||||
|
||||
/*
|
||||
* Define a structure to communicate serial port signal and data state
|
||||
* information.
|
||||
*/
|
||||
typedef struct asysigs {
|
||||
unsigned long data;
|
||||
unsigned long signal;
|
||||
unsigned long sigvalue;
|
||||
} asysigs_t;
|
||||
|
||||
#define DT_TXBUSY 0x1
|
||||
#define DT_TXEMPTY 0x2
|
||||
#define DT_TXLOW 0x4
|
||||
#define DT_TXHIGH 0x8
|
||||
#define DT_TXFULL 0x10
|
||||
#define DT_TXHOG 0x20
|
||||
#define DT_TXFLOWED 0x40
|
||||
#define DT_TXBREAK 0x80
|
||||
|
||||
#define DT_RXBUSY 0x100
|
||||
#define DT_RXEMPTY 0x200
|
||||
#define DT_RXLOW 0x400
|
||||
#define DT_RXHIGH 0x800
|
||||
#define DT_RXFULL 0x1000
|
||||
#define DT_RXHOG 0x2000
|
||||
#define DT_RXFLOWED 0x4000
|
||||
#define DT_RXBREAK 0x8000
|
||||
|
||||
#define SG_DTR 0x1
|
||||
#define SG_DCD 0x2
|
||||
#define SG_RTS 0x4
|
||||
#define SG_CTS 0x8
|
||||
#define SG_DSR 0x10
|
||||
#define SG_RI 0x20
|
||||
|
||||
/*
|
||||
* Define the notification setting structure. This is used to tell the
|
||||
* port what events we want to be informed about. Fields here use the
|
||||
* same defines as for the asysigs structure above.
|
||||
*/
|
||||
typedef struct asynotify {
|
||||
unsigned long ctrl;
|
||||
unsigned long data;
|
||||
unsigned long signal;
|
||||
unsigned long sigvalue;
|
||||
} asynotify_t;
|
||||
|
||||
/*
|
||||
* Define the port control structure. It is used to do fine grain
|
||||
* control operations on the port.
|
||||
*/
|
||||
typedef struct {
|
||||
unsigned long rxctrl;
|
||||
unsigned long txctrl;
|
||||
char rximdch;
|
||||
char tximdch;
|
||||
char spare1;
|
||||
char spare2;
|
||||
} asyctrl_t;
|
||||
|
||||
#define CT_ENABLE 0x1
|
||||
#define CT_DISABLE 0x2
|
||||
#define CT_STOP 0x4
|
||||
#define CT_START 0x8
|
||||
#define CT_STARTFLOW 0x10
|
||||
#define CT_STOPFLOW 0x20
|
||||
#define CT_SENDCHR 0x40
|
||||
|
||||
/*
|
||||
* Define the stats structure kept for each port. This is a useful set
|
||||
* of data collected for each port on the slave. The A_GETSTATS command
|
||||
* is used to retrieve this data from the slave.
|
||||
*/
|
||||
typedef struct asystats {
|
||||
unsigned long opens;
|
||||
unsigned long txchars;
|
||||
unsigned long rxchars;
|
||||
unsigned long txringq;
|
||||
unsigned long rxringq;
|
||||
unsigned long txmsgs;
|
||||
unsigned long rxmsgs;
|
||||
unsigned long txflushes;
|
||||
unsigned long rxflushes;
|
||||
unsigned long overruns;
|
||||
unsigned long framing;
|
||||
unsigned long parity;
|
||||
unsigned long ringover;
|
||||
unsigned long lost;
|
||||
unsigned long rxstart;
|
||||
unsigned long rxstop;
|
||||
unsigned long txstart;
|
||||
unsigned long txstop;
|
||||
unsigned long dcdcnt;
|
||||
unsigned long dtrcnt;
|
||||
unsigned long ctscnt;
|
||||
unsigned long rtscnt;
|
||||
unsigned long dsrcnt;
|
||||
unsigned long ricnt;
|
||||
unsigned long txbreaks;
|
||||
unsigned long rxbreaks;
|
||||
unsigned long signals;
|
||||
unsigned long state;
|
||||
unsigned long hwid;
|
||||
} asystats_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* All command and control communication with a device on the slave is
|
||||
* via a control block in shared memory. Each device has its own control
|
||||
* block, defined by the following structure. The control block allows
|
||||
* the host to open, close and control the device on the slave.
|
||||
*/
|
||||
typedef struct cdkctrl {
|
||||
unsigned char open;
|
||||
unsigned char close;
|
||||
unsigned long openarg;
|
||||
unsigned long closearg;
|
||||
unsigned long cmd;
|
||||
unsigned long status;
|
||||
unsigned long args[32];
|
||||
} cdkctrl_t;
|
||||
|
||||
/*
|
||||
* Each device on the slave passes data to and from the host via a ring
|
||||
* queue in shared memory. Define a ring queue structure to hold the
|
||||
* vital information about each ring queue. Two ring queues will be
|
||||
* allocated for each port, one for receive data and one for transmit
|
||||
* data.
|
||||
*/
|
||||
typedef struct cdkasyrq {
|
||||
unsigned long offset;
|
||||
unsigned short size;
|
||||
unsigned short head;
|
||||
unsigned short tail;
|
||||
} cdkasyrq_t;
|
||||
|
||||
/*
|
||||
* Each asynchronous port is defined in shared memory by the following
|
||||
* structure. It contains a control block to command a device, and also
|
||||
* the necessary data channel information as well.
|
||||
*/
|
||||
typedef struct cdkasy {
|
||||
cdkctrl_t ctrl;
|
||||
unsigned short notify;
|
||||
asynotify_t changed;
|
||||
unsigned short receive;
|
||||
cdkasyrq_t rxq;
|
||||
unsigned short transmit;
|
||||
cdkasyrq_t txq;
|
||||
} cdkasy_t;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
* Define the set of ioctls used by the driver to do special things
|
||||
* to the board. These include interrupting it, and initializing
|
||||
* the driver after board startup and shutdown.
|
||||
*/
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define STL_BINTR _IO('s',20)
|
||||
#define STL_BSTART _IO('s',21)
|
||||
#define STL_BSTOP _IO('s',22)
|
||||
#define STL_BRESET _IO('s',23)
|
||||
|
||||
/*
|
||||
* Define a set of ioctl extensions, used to get at special stuff.
|
||||
*/
|
||||
#define STL_GETPFLAG _IO('s',80)
|
||||
#define STL_SETPFLAG _IO('s',81)
|
||||
|
||||
/*****************************************************************************/
|
||||
#endif
|
||||
1189
include/linux/cdrom.h
Normal file
1189
include/linux/cdrom.h
Normal file
File diff suppressed because it is too large
Load Diff
82
include/linux/cfag12864b.h
Normal file
82
include/linux/cfag12864b.h
Normal file
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Filename: cfag12864b.h
|
||||
* Version: 0.1.0
|
||||
* Description: cfag12864b LCD driver header
|
||||
* License: GPLv2
|
||||
*
|
||||
* Author: Copyright (C) Miguel Ojeda Sandonis <maxextreme@gmail.com>
|
||||
* Date: 2006-10-12
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _CFAG12864B_H_
|
||||
#define _CFAG12864B_H_
|
||||
|
||||
#define CFAG12864B_WIDTH (128)
|
||||
#define CFAG12864B_HEIGHT (64)
|
||||
#define CFAG12864B_CONTROLLERS (2)
|
||||
#define CFAG12864B_PAGES (8)
|
||||
#define CFAG12864B_ADDRESSES (64)
|
||||
#define CFAG12864B_SIZE ((CFAG12864B_CONTROLLERS) * \
|
||||
(CFAG12864B_PAGES) * \
|
||||
(CFAG12864B_ADDRESSES))
|
||||
|
||||
/*
|
||||
* The driver will blit this buffer to the LCD
|
||||
*
|
||||
* Its size is CFAG12864B_SIZE.
|
||||
*/
|
||||
extern unsigned char * cfag12864b_buffer;
|
||||
|
||||
/*
|
||||
* Get the refresh rate of the LCD
|
||||
*
|
||||
* Returns the refresh rate (hertzs).
|
||||
*/
|
||||
extern unsigned int cfag12864b_getrate(void);
|
||||
|
||||
/*
|
||||
* Enable refreshing
|
||||
*
|
||||
* Returns 0 if successful (anyone was using it),
|
||||
* or != 0 if failed (someone is using it).
|
||||
*/
|
||||
extern unsigned char cfag12864b_enable(void);
|
||||
|
||||
/*
|
||||
* Disable refreshing
|
||||
*
|
||||
* You should call this only when you finish using the LCD.
|
||||
*/
|
||||
extern void cfag12864b_disable(void);
|
||||
|
||||
/*
|
||||
* Is enabled refreshing? (is anyone using the module?)
|
||||
*
|
||||
* Returns 0 if refreshing is not enabled (anyone is using it),
|
||||
* or != 0 if refreshing is enabled (someone is using it).
|
||||
*
|
||||
* Useful for buffer read-only modules.
|
||||
*/
|
||||
extern unsigned char cfag12864b_isenabled(void);
|
||||
|
||||
/*
|
||||
* Is the module inited?
|
||||
*/
|
||||
extern unsigned char cfag12864b_isinited(void);
|
||||
|
||||
#endif /* _CFAG12864B_H_ */
|
||||
|
||||
168
include/linux/chio.h
Normal file
168
include/linux/chio.h
Normal file
@@ -0,0 +1,168 @@
|
||||
/*
|
||||
* ioctl interface for the scsi media changer driver
|
||||
*/
|
||||
|
||||
/* changer element types */
|
||||
#define CHET_MT 0 /* media transport element (robot) */
|
||||
#define CHET_ST 1 /* storage element (media slots) */
|
||||
#define CHET_IE 2 /* import/export element */
|
||||
#define CHET_DT 3 /* data transfer element (tape/cdrom/whatever) */
|
||||
#define CHET_V1 4 /* vendor specific #1 */
|
||||
#define CHET_V2 5 /* vendor specific #2 */
|
||||
#define CHET_V3 6 /* vendor specific #3 */
|
||||
#define CHET_V4 7 /* vendor specific #4 */
|
||||
|
||||
|
||||
/*
|
||||
* CHIOGPARAMS
|
||||
* query changer properties
|
||||
*
|
||||
* CHIOVGPARAMS
|
||||
* query vendor-specific element types
|
||||
*
|
||||
* accessing elements works by specifing type and unit of the element.
|
||||
* for eample, storage elements are addressed with type = CHET_ST and
|
||||
* unit = 0 .. cp_nslots-1
|
||||
*
|
||||
*/
|
||||
struct changer_params {
|
||||
int cp_curpicker; /* current transport element */
|
||||
int cp_npickers; /* number of transport elements (CHET_MT) */
|
||||
int cp_nslots; /* number of storage elements (CHET_ST) */
|
||||
int cp_nportals; /* number of import/export elements (CHET_IE) */
|
||||
int cp_ndrives; /* number of data transfer elements (CHET_DT) */
|
||||
};
|
||||
struct changer_vendor_params {
|
||||
int cvp_n1; /* number of vendor specific elems (CHET_V1) */
|
||||
char cvp_label1[16];
|
||||
int cvp_n2; /* number of vendor specific elems (CHET_V2) */
|
||||
char cvp_label2[16];
|
||||
int cvp_n3; /* number of vendor specific elems (CHET_V3) */
|
||||
char cvp_label3[16];
|
||||
int cvp_n4; /* number of vendor specific elems (CHET_V4) */
|
||||
char cvp_label4[16];
|
||||
int reserved[8];
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* CHIOMOVE
|
||||
* move a medium from one element to another
|
||||
*/
|
||||
struct changer_move {
|
||||
int cm_fromtype; /* type/unit of source element */
|
||||
int cm_fromunit;
|
||||
int cm_totype; /* type/unit of destination element */
|
||||
int cm_tounit;
|
||||
int cm_flags;
|
||||
};
|
||||
#define CM_INVERT 1 /* flag: rotate media (for double-sided like MOD) */
|
||||
|
||||
|
||||
/*
|
||||
* CHIOEXCHANGE
|
||||
* move one medium from element #1 to element #2,
|
||||
* and another one from element #2 to element #3.
|
||||
* element #1 and #3 are allowed to be identical.
|
||||
*/
|
||||
struct changer_exchange {
|
||||
int ce_srctype; /* type/unit of element #1 */
|
||||
int ce_srcunit;
|
||||
int ce_fdsttype; /* type/unit of element #2 */
|
||||
int ce_fdstunit;
|
||||
int ce_sdsttype; /* type/unit of element #3 */
|
||||
int ce_sdstunit;
|
||||
int ce_flags;
|
||||
};
|
||||
#define CE_INVERT1 1
|
||||
#define CE_INVERT2 2
|
||||
|
||||
|
||||
/*
|
||||
* CHIOPOSITION
|
||||
* move the transport element (robot arm) to a specific element.
|
||||
*/
|
||||
struct changer_position {
|
||||
int cp_type;
|
||||
int cp_unit;
|
||||
int cp_flags;
|
||||
};
|
||||
#define CP_INVERT 1
|
||||
|
||||
|
||||
/*
|
||||
* CHIOGSTATUS
|
||||
* get element status for all elements of a specific type
|
||||
*/
|
||||
struct changer_element_status {
|
||||
int ces_type;
|
||||
unsigned char __user *ces_data;
|
||||
};
|
||||
#define CESTATUS_FULL 0x01 /* full */
|
||||
#define CESTATUS_IMPEXP 0x02 /* media was imported (inserted by sysop) */
|
||||
#define CESTATUS_EXCEPT 0x04 /* error condition */
|
||||
#define CESTATUS_ACCESS 0x08 /* access allowed */
|
||||
#define CESTATUS_EXENAB 0x10 /* element can export media */
|
||||
#define CESTATUS_INENAB 0x20 /* element can import media */
|
||||
|
||||
|
||||
/*
|
||||
* CHIOGELEM
|
||||
* get more detailed status informtion for a single element
|
||||
*/
|
||||
struct changer_get_element {
|
||||
int cge_type; /* type/unit */
|
||||
int cge_unit;
|
||||
int cge_status; /* status */
|
||||
int cge_errno; /* errno */
|
||||
int cge_srctype; /* source element of the last move/exchange */
|
||||
int cge_srcunit;
|
||||
int cge_id; /* scsi id (for data transfer elements) */
|
||||
int cge_lun; /* scsi lun (for data transfer elements) */
|
||||
char cge_pvoltag[36]; /* primary volume tag */
|
||||
char cge_avoltag[36]; /* alternate volume tag */
|
||||
int cge_flags;
|
||||
};
|
||||
/* flags */
|
||||
#define CGE_ERRNO 0x01 /* errno available */
|
||||
#define CGE_INVERT 0x02 /* media inverted */
|
||||
#define CGE_SRC 0x04 /* media src available */
|
||||
#define CGE_IDLUN 0x08 /* ID+LUN available */
|
||||
#define CGE_PVOLTAG 0x10 /* primary volume tag available */
|
||||
#define CGE_AVOLTAG 0x20 /* alternate volume tag available */
|
||||
|
||||
|
||||
/*
|
||||
* CHIOSVOLTAG
|
||||
* set volume tag
|
||||
*/
|
||||
struct changer_set_voltag {
|
||||
int csv_type; /* type/unit */
|
||||
int csv_unit;
|
||||
char csv_voltag[36]; /* volume tag */
|
||||
int csv_flags;
|
||||
};
|
||||
#define CSV_PVOLTAG 0x01 /* primary volume tag */
|
||||
#define CSV_AVOLTAG 0x02 /* alternate volume tag */
|
||||
#define CSV_CLEARTAG 0x04 /* clear volume tag */
|
||||
|
||||
/* ioctls */
|
||||
#define CHIOMOVE _IOW('c', 1,struct changer_move)
|
||||
#define CHIOEXCHANGE _IOW('c', 2,struct changer_exchange)
|
||||
#define CHIOPOSITION _IOW('c', 3,struct changer_position)
|
||||
#define CHIOGPICKER _IOR('c', 4,int) /* not impl. */
|
||||
#define CHIOSPICKER _IOW('c', 5,int) /* not impl. */
|
||||
#define CHIOGPARAMS _IOR('c', 6,struct changer_params)
|
||||
#define CHIOGSTATUS _IOW('c', 8,struct changer_element_status)
|
||||
#define CHIOGELEM _IOW('c',16,struct changer_get_element)
|
||||
#define CHIOINITELEM _IO('c',17)
|
||||
#define CHIOSVOLTAG _IOW('c',18,struct changer_set_voltag)
|
||||
#define CHIOGVPARAMS _IOR('c',19,struct changer_vendor_params)
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* c-basic-offset: 8
|
||||
* End:
|
||||
*/
|
||||
32
include/linux/circ_buf.h
Normal file
32
include/linux/circ_buf.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#ifndef _LINUX_CIRC_BUF_H
|
||||
#define _LINUX_CIRC_BUF_H 1
|
||||
|
||||
struct circ_buf {
|
||||
char *buf;
|
||||
int head;
|
||||
int tail;
|
||||
};
|
||||
|
||||
/* Return count in buffer. */
|
||||
#define CIRC_CNT(head,tail,size) (((head) - (tail)) & ((size)-1))
|
||||
|
||||
/* Return space available, 0..size-1. We always leave one free char
|
||||
as a completely full buffer has head == tail, which is the same as
|
||||
empty. */
|
||||
#define CIRC_SPACE(head,tail,size) CIRC_CNT((tail),((head)+1),(size))
|
||||
|
||||
/* Return count up to the end of the buffer. Carefully avoid
|
||||
accessing head and tail more than once, so they can change
|
||||
underneath us without returning inconsistent results. */
|
||||
#define CIRC_CNT_TO_END(head,tail,size) \
|
||||
({int end = (size) - (tail); \
|
||||
int n = ((head) + end) & ((size)-1); \
|
||||
n < end ? n : end;})
|
||||
|
||||
/* Return space available up to the end of the buffer. */
|
||||
#define CIRC_SPACE_TO_END(head,tail,size) \
|
||||
({int end = (size) - 1 - (head); \
|
||||
int n = (end + (tail)) & ((size)-1); \
|
||||
n <= end ? n : end+1;})
|
||||
|
||||
#endif /* _LINUX_CIRC_BUF_H */
|
||||
124
include/linux/clk.h
Normal file
124
include/linux/clk.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/*
|
||||
* linux/include/linux/clk.h
|
||||
*
|
||||
* Copyright (C) 2004 ARM Limited.
|
||||
* Written by Deep Blue Solutions Limited.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef __LINUX_CLK_H
|
||||
#define __LINUX_CLK_H
|
||||
|
||||
struct device;
|
||||
|
||||
/*
|
||||
* The base API.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* struct clk - an machine class defined object / cookie.
|
||||
*/
|
||||
struct clk;
|
||||
|
||||
/**
|
||||
* clk_get - lookup and obtain a reference to a clock producer.
|
||||
* @dev: device for clock "consumer"
|
||||
* @id: clock comsumer ID
|
||||
*
|
||||
* Returns a struct clk corresponding to the clock producer, or
|
||||
* valid IS_ERR() condition containing errno. The implementation
|
||||
* uses @dev and @id to determine the clock consumer, and thereby
|
||||
* the clock producer. (IOW, @id may be identical strings, but
|
||||
* clk_get may return different clock producers depending on @dev.)
|
||||
*
|
||||
* Drivers must assume that the clock source is not enabled.
|
||||
*/
|
||||
struct clk *clk_get(struct device *dev, const char *id);
|
||||
|
||||
/**
|
||||
* clk_enable - inform the system when the clock source should be running.
|
||||
* @clk: clock source
|
||||
*
|
||||
* If the clock can not be enabled/disabled, this should return success.
|
||||
*
|
||||
* Returns success (0) or negative errno.
|
||||
*/
|
||||
int clk_enable(struct clk *clk);
|
||||
|
||||
/**
|
||||
* clk_disable - inform the system when the clock source is no longer required.
|
||||
* @clk: clock source
|
||||
*
|
||||
* Inform the system that a clock source is no longer required by
|
||||
* a driver and may be shut down.
|
||||
*
|
||||
* Implementation detail: if the clock source is shared between
|
||||
* multiple drivers, clk_enable() calls must be balanced by the
|
||||
* same number of clk_disable() calls for the clock source to be
|
||||
* disabled.
|
||||
*/
|
||||
void clk_disable(struct clk *clk);
|
||||
|
||||
/**
|
||||
* clk_get_rate - obtain the current clock rate (in Hz) for a clock source.
|
||||
* This is only valid once the clock source has been enabled.
|
||||
* @clk: clock source
|
||||
*/
|
||||
unsigned long clk_get_rate(struct clk *clk);
|
||||
|
||||
/**
|
||||
* clk_put - "free" the clock source
|
||||
* @clk: clock source
|
||||
*
|
||||
* Note: drivers must ensure that all clk_enable calls made on this
|
||||
* clock source are balanced by clk_disable calls prior to calling
|
||||
* this function.
|
||||
*/
|
||||
void clk_put(struct clk *clk);
|
||||
|
||||
|
||||
/*
|
||||
* The remaining APIs are optional for machine class support.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* clk_round_rate - adjust a rate to the exact rate a clock can provide
|
||||
* @clk: clock source
|
||||
* @rate: desired clock rate in Hz
|
||||
*
|
||||
* Returns rounded clock rate in Hz, or negative errno.
|
||||
*/
|
||||
long clk_round_rate(struct clk *clk, unsigned long rate);
|
||||
|
||||
/**
|
||||
* clk_set_rate - set the clock rate for a clock source
|
||||
* @clk: clock source
|
||||
* @rate: desired clock rate in Hz
|
||||
*
|
||||
* Returns success (0) or negative errno.
|
||||
*/
|
||||
int clk_set_rate(struct clk *clk, unsigned long rate);
|
||||
|
||||
/**
|
||||
* clk_set_parent - set the parent clock source for this clock
|
||||
* @clk: clock source
|
||||
* @parent: parent clock source
|
||||
*
|
||||
* Returns success (0) or negative errno.
|
||||
*/
|
||||
int clk_set_parent(struct clk *clk, struct clk *parent);
|
||||
|
||||
/**
|
||||
* clk_get_parent - get the parent clock source for this clock
|
||||
* @clk: clock source
|
||||
*
|
||||
* Returns struct clk corresponding to parent clock source, or
|
||||
* valid IS_ERR() condition containing errno.
|
||||
*/
|
||||
struct clk *clk_get_parent(struct clk *clk);
|
||||
|
||||
#endif
|
||||
142
include/linux/clockchips.h
Normal file
142
include/linux/clockchips.h
Normal file
@@ -0,0 +1,142 @@
|
||||
/* linux/include/linux/clockchips.h
|
||||
*
|
||||
* This file contains the structure definitions for clockchips.
|
||||
*
|
||||
* If you are not a clockchip, or the time of day code, you should
|
||||
* not be including this file!
|
||||
*/
|
||||
#ifndef _LINUX_CLOCKCHIPS_H
|
||||
#define _LINUX_CLOCKCHIPS_H
|
||||
|
||||
#ifdef CONFIG_GENERIC_CLOCKEVENTS
|
||||
|
||||
#include <linux/clocksource.h>
|
||||
#include <linux/cpumask.h>
|
||||
#include <linux/ktime.h>
|
||||
#include <linux/notifier.h>
|
||||
|
||||
struct clock_event_device;
|
||||
|
||||
/* Clock event mode commands */
|
||||
enum clock_event_mode {
|
||||
CLOCK_EVT_MODE_UNUSED = 0,
|
||||
CLOCK_EVT_MODE_SHUTDOWN,
|
||||
CLOCK_EVT_MODE_PERIODIC,
|
||||
CLOCK_EVT_MODE_ONESHOT,
|
||||
};
|
||||
|
||||
/* Clock event notification values */
|
||||
enum clock_event_nofitiers {
|
||||
CLOCK_EVT_NOTIFY_ADD,
|
||||
CLOCK_EVT_NOTIFY_BROADCAST_ON,
|
||||
CLOCK_EVT_NOTIFY_BROADCAST_OFF,
|
||||
CLOCK_EVT_NOTIFY_BROADCAST_ENTER,
|
||||
CLOCK_EVT_NOTIFY_BROADCAST_EXIT,
|
||||
CLOCK_EVT_NOTIFY_SUSPEND,
|
||||
CLOCK_EVT_NOTIFY_RESUME,
|
||||
CLOCK_EVT_NOTIFY_CPU_DEAD,
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock event features
|
||||
*/
|
||||
#define CLOCK_EVT_FEAT_PERIODIC 0x000001
|
||||
#define CLOCK_EVT_FEAT_ONESHOT 0x000002
|
||||
/*
|
||||
* x86(64) specific misfeatures:
|
||||
*
|
||||
* - Clockevent source stops in C3 State and needs broadcast support.
|
||||
* - Local APIC timer is used as a dummy device.
|
||||
*/
|
||||
#define CLOCK_EVT_FEAT_C3STOP 0x000004
|
||||
#define CLOCK_EVT_FEAT_DUMMY 0x000008
|
||||
|
||||
/**
|
||||
* struct clock_event_device - clock event device descriptor
|
||||
* @name: ptr to clock event name
|
||||
* @hints: usage hints
|
||||
* @max_delta_ns: maximum delta value in ns
|
||||
* @min_delta_ns: minimum delta value in ns
|
||||
* @mult: nanosecond to cycles multiplier
|
||||
* @shift: nanoseconds to cycles divisor (power of two)
|
||||
* @rating: variable to rate clock event devices
|
||||
* @irq: irq number (only for non cpu local devices)
|
||||
* @cpumask: cpumask to indicate for which cpus this device works
|
||||
* @set_next_event: set next event
|
||||
* @set_mode: set mode function
|
||||
* @evthandler: Assigned by the framework to be called by the low
|
||||
* level handler of the event source
|
||||
* @broadcast: function to broadcast events
|
||||
* @list: list head for the management code
|
||||
* @mode: operating mode assigned by the management code
|
||||
* @next_event: local storage for the next event in oneshot mode
|
||||
*/
|
||||
struct clock_event_device {
|
||||
const char *name;
|
||||
unsigned int features;
|
||||
unsigned long max_delta_ns;
|
||||
unsigned long min_delta_ns;
|
||||
unsigned long mult;
|
||||
int shift;
|
||||
int rating;
|
||||
int irq;
|
||||
cpumask_t cpumask;
|
||||
int (*set_next_event)(unsigned long evt,
|
||||
struct clock_event_device *);
|
||||
void (*set_mode)(enum clock_event_mode mode,
|
||||
struct clock_event_device *);
|
||||
void (*event_handler)(struct clock_event_device *);
|
||||
void (*broadcast)(cpumask_t mask);
|
||||
struct list_head list;
|
||||
enum clock_event_mode mode;
|
||||
ktime_t next_event;
|
||||
};
|
||||
|
||||
/*
|
||||
* Calculate a multiplication factor for scaled math, which is used to convert
|
||||
* nanoseconds based values to clock ticks:
|
||||
*
|
||||
* clock_ticks = (nanoseconds * factor) >> shift.
|
||||
*
|
||||
* div_sc is the rearranged equation to calculate a factor from a given clock
|
||||
* ticks / nanoseconds ratio:
|
||||
*
|
||||
* factor = (clock_ticks << shift) / nanoseconds
|
||||
*/
|
||||
static inline unsigned long div_sc(unsigned long ticks, unsigned long nsec,
|
||||
int shift)
|
||||
{
|
||||
uint64_t tmp = ((uint64_t)ticks) << shift;
|
||||
|
||||
do_div(tmp, nsec);
|
||||
return (unsigned long) tmp;
|
||||
}
|
||||
|
||||
/* Clock event layer functions */
|
||||
extern unsigned long clockevent_delta2ns(unsigned long latch,
|
||||
struct clock_event_device *evt);
|
||||
extern void clockevents_register_device(struct clock_event_device *dev);
|
||||
|
||||
extern void clockevents_exchange_device(struct clock_event_device *old,
|
||||
struct clock_event_device *new);
|
||||
extern
|
||||
struct clock_event_device *clockevents_request_device(unsigned int features,
|
||||
cpumask_t cpumask);
|
||||
extern void clockevents_release_device(struct clock_event_device *dev);
|
||||
extern void clockevents_set_mode(struct clock_event_device *dev,
|
||||
enum clock_event_mode mode);
|
||||
extern int clockevents_register_notifier(struct notifier_block *nb);
|
||||
extern void clockevents_unregister_notifier(struct notifier_block *nb);
|
||||
extern int clockevents_program_event(struct clock_event_device *dev,
|
||||
ktime_t expires, ktime_t now);
|
||||
|
||||
extern void clockevents_notify(unsigned long reason, void *arg);
|
||||
|
||||
#else
|
||||
|
||||
static inline void clockevents_resume_events(void) { }
|
||||
#define clockevents_notify(reason, arg) do { } while (0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
213
include/linux/clocksource.h
Normal file
213
include/linux/clocksource.h
Normal file
@@ -0,0 +1,213 @@
|
||||
/* linux/include/linux/clocksource.h
|
||||
*
|
||||
* This file contains the structure definitions for clocksources.
|
||||
*
|
||||
* If you are not a clocksource, or timekeeping code, you should
|
||||
* not be including this file!
|
||||
*/
|
||||
#ifndef _LINUX_CLOCKSOURCE_H
|
||||
#define _LINUX_CLOCKSOURCE_H
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/timex.h>
|
||||
#include <linux/time.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/timer.h>
|
||||
#include <asm/div64.h>
|
||||
#include <asm/io.h>
|
||||
|
||||
/* clocksource cycle base type */
|
||||
typedef u64 cycle_t;
|
||||
struct clocksource;
|
||||
|
||||
/**
|
||||
* struct clocksource - hardware abstraction for a free running counter
|
||||
* Provides mostly state-free accessors to the underlying hardware.
|
||||
*
|
||||
* @name: ptr to clocksource name
|
||||
* @list: list head for registration
|
||||
* @rating: rating value for selection (higher is better)
|
||||
* To avoid rating inflation the following
|
||||
* list should give you a guide as to how
|
||||
* to assign your clocksource a rating
|
||||
* 1-99: Unfit for real use
|
||||
* Only available for bootup and testing purposes.
|
||||
* 100-199: Base level usability.
|
||||
* Functional for real use, but not desired.
|
||||
* 200-299: Good.
|
||||
* A correct and usable clocksource.
|
||||
* 300-399: Desired.
|
||||
* A reasonably fast and accurate clocksource.
|
||||
* 400-499: Perfect
|
||||
* The ideal clocksource. A must-use where
|
||||
* available.
|
||||
* @read: returns a cycle value
|
||||
* @mask: bitmask for two's complement
|
||||
* subtraction of non 64 bit counters
|
||||
* @mult: cycle to nanosecond multiplier
|
||||
* @shift: cycle to nanosecond divisor (power of two)
|
||||
* @flags: flags describing special properties
|
||||
* @vread: vsyscall based read
|
||||
* @resume: resume function for the clocksource, if necessary
|
||||
* @cycle_interval: Used internally by timekeeping core, please ignore.
|
||||
* @xtime_interval: Used internally by timekeeping core, please ignore.
|
||||
*/
|
||||
struct clocksource {
|
||||
char *name;
|
||||
struct list_head list;
|
||||
int rating;
|
||||
cycle_t (*read)(void);
|
||||
cycle_t mask;
|
||||
u32 mult;
|
||||
u32 shift;
|
||||
unsigned long flags;
|
||||
cycle_t (*vread)(void);
|
||||
void (*resume)(void);
|
||||
|
||||
/* timekeeping specific data, ignore */
|
||||
cycle_t cycle_last, cycle_interval;
|
||||
u64 xtime_nsec, xtime_interval;
|
||||
s64 error;
|
||||
|
||||
#ifdef CONFIG_CLOCKSOURCE_WATCHDOG
|
||||
/* Watchdog related data, used by the framework */
|
||||
struct list_head wd_list;
|
||||
cycle_t wd_last;
|
||||
#endif
|
||||
};
|
||||
|
||||
/*
|
||||
* Clock source flags bits::
|
||||
*/
|
||||
#define CLOCK_SOURCE_IS_CONTINUOUS 0x01
|
||||
#define CLOCK_SOURCE_MUST_VERIFY 0x02
|
||||
|
||||
#define CLOCK_SOURCE_WATCHDOG 0x10
|
||||
#define CLOCK_SOURCE_VALID_FOR_HRES 0x20
|
||||
|
||||
/* simplify initialization of mask field */
|
||||
#define CLOCKSOURCE_MASK(bits) (cycle_t)(bits<64 ? ((1ULL<<bits)-1) : -1)
|
||||
|
||||
/**
|
||||
* clocksource_khz2mult - calculates mult from khz and shift
|
||||
* @khz: Clocksource frequency in KHz
|
||||
* @shift_constant: Clocksource shift factor
|
||||
*
|
||||
* Helper functions that converts a khz counter frequency to a timsource
|
||||
* multiplier, given the clocksource shift value
|
||||
*/
|
||||
static inline u32 clocksource_khz2mult(u32 khz, u32 shift_constant)
|
||||
{
|
||||
/* khz = cyc/(Million ns)
|
||||
* mult/2^shift = ns/cyc
|
||||
* mult = ns/cyc * 2^shift
|
||||
* mult = 1Million/khz * 2^shift
|
||||
* mult = 1000000 * 2^shift / khz
|
||||
* mult = (1000000<<shift) / khz
|
||||
*/
|
||||
u64 tmp = ((u64)1000000) << shift_constant;
|
||||
|
||||
tmp += khz/2; /* round for do_div */
|
||||
do_div(tmp, khz);
|
||||
|
||||
return (u32)tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* clocksource_hz2mult - calculates mult from hz and shift
|
||||
* @hz: Clocksource frequency in Hz
|
||||
* @shift_constant: Clocksource shift factor
|
||||
*
|
||||
* Helper functions that converts a hz counter
|
||||
* frequency to a timsource multiplier, given the
|
||||
* clocksource shift value
|
||||
*/
|
||||
static inline u32 clocksource_hz2mult(u32 hz, u32 shift_constant)
|
||||
{
|
||||
/* hz = cyc/(Billion ns)
|
||||
* mult/2^shift = ns/cyc
|
||||
* mult = ns/cyc * 2^shift
|
||||
* mult = 1Billion/hz * 2^shift
|
||||
* mult = 1000000000 * 2^shift / hz
|
||||
* mult = (1000000000<<shift) / hz
|
||||
*/
|
||||
u64 tmp = ((u64)1000000000) << shift_constant;
|
||||
|
||||
tmp += hz/2; /* round for do_div */
|
||||
do_div(tmp, hz);
|
||||
|
||||
return (u32)tmp;
|
||||
}
|
||||
|
||||
/**
|
||||
* clocksource_read: - Access the clocksource's current cycle value
|
||||
* @cs: pointer to clocksource being read
|
||||
*
|
||||
* Uses the clocksource to return the current cycle_t value
|
||||
*/
|
||||
static inline cycle_t clocksource_read(struct clocksource *cs)
|
||||
{
|
||||
return cs->read();
|
||||
}
|
||||
|
||||
/**
|
||||
* cyc2ns - converts clocksource cycles to nanoseconds
|
||||
* @cs: Pointer to clocksource
|
||||
* @cycles: Cycles
|
||||
*
|
||||
* Uses the clocksource and ntp ajdustment to convert cycle_ts to nanoseconds.
|
||||
*
|
||||
* XXX - This could use some mult_lxl_ll() asm optimization
|
||||
*/
|
||||
static inline s64 cyc2ns(struct clocksource *cs, cycle_t cycles)
|
||||
{
|
||||
u64 ret = (u64)cycles;
|
||||
ret = (ret * cs->mult) >> cs->shift;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* clocksource_calculate_interval - Calculates a clocksource interval struct
|
||||
*
|
||||
* @c: Pointer to clocksource.
|
||||
* @length_nsec: Desired interval length in nanoseconds.
|
||||
*
|
||||
* Calculates a fixed cycle/nsec interval for a given clocksource/adjustment
|
||||
* pair and interval request.
|
||||
*
|
||||
* Unless you're the timekeeping code, you should not be using this!
|
||||
*/
|
||||
static inline void clocksource_calculate_interval(struct clocksource *c,
|
||||
unsigned long length_nsec)
|
||||
{
|
||||
u64 tmp;
|
||||
|
||||
/* XXX - All of this could use a whole lot of optimization */
|
||||
tmp = length_nsec;
|
||||
tmp <<= c->shift;
|
||||
tmp += c->mult/2;
|
||||
do_div(tmp, c->mult);
|
||||
|
||||
c->cycle_interval = (cycle_t)tmp;
|
||||
if (c->cycle_interval == 0)
|
||||
c->cycle_interval = 1;
|
||||
|
||||
c->xtime_interval = (u64)c->cycle_interval * c->mult;
|
||||
}
|
||||
|
||||
|
||||
/* used to install a new clocksource */
|
||||
extern int clocksource_register(struct clocksource*);
|
||||
extern struct clocksource* clocksource_get_next(void);
|
||||
extern void clocksource_change_rating(struct clocksource *cs, int rating);
|
||||
extern void clocksource_resume(void);
|
||||
|
||||
#ifdef CONFIG_GENERIC_TIME_VSYSCALL
|
||||
extern void update_vsyscall(struct timespec *ts, struct clocksource *c);
|
||||
#else
|
||||
static inline void update_vsyscall(struct timespec *ts, struct clocksource *c)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_CLOCKSOURCE_H */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user