Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Typedefs | Functions | Variables
cistpl.c File Reference
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/major.h>
#include <linux/errno.h>
#include <linux/timer.h>
#include <linux/slab.h>
#include <linux/mm.h>
#include <linux/pci.h>
#include <linux/ioport.h>
#include <linux/io.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
#include <pcmcia/ss.h>
#include <pcmcia/cisreg.h>
#include <pcmcia/cistpl.h>
#include "cs_internal.h"

Go to the source code of this file.

Data Structures

struct  tuple_flags
 

Macros

#define SPEED_CVT(v)   (mantissa[(((v)>>3)&15)-1] * exponent[(v)&7] / 10)
 
#define POWER_CVT(v)   (mantissa[((v)>>3)&15] * exponent[(v)&7] / 10)
 
#define POWER_SCALE(v)   (exponent[(v)&7])
 
#define MAX_TUPLES   200
 
#define IRQ_INFO2_VALID   0x10
 
#define IS_ATTR   1
 
#define IS_INDIRECT   8
 
#define LINK_SPACE(f)   (((tuple_flags *)(&(f)))->link_space)
 
#define HAS_LINK(f)   (((tuple_flags *)(&(f)))->has_link)
 
#define MFC_FN(f)   (((tuple_flags *)(&(f)))->mfc_fn)
 
#define SPACE(f)   (((tuple_flags *)(&(f)))->space)
 
#define to_socket(_dev)   container_of(_dev, struct pcmcia_socket, dev)
 

Typedefs

typedef struct tuple_flags tuple_flags
 

Functions

 module_param (cis_width, int, 0444)
 
void release_cis_mem (struct pcmcia_socket *s)
 
int pcmcia_read_cis_mem (struct pcmcia_socket *s, int attr, u_int addr, u_int len, void *ptr)
 
int pcmcia_write_cis_mem (struct pcmcia_socket *s, int attr, u_int addr, u_int len, void *ptr)
 
void destroy_cis_cache (struct pcmcia_socket *s)
 
int verify_cis_cache (struct pcmcia_socket *s)
 
int pcmcia_replace_cis (struct pcmcia_socket *s, const u8 *data, const size_t len)
 
int pccard_get_first_tuple (struct pcmcia_socket *s, unsigned int function, tuple_t *tuple)
 
int pccard_get_next_tuple (struct pcmcia_socket *s, unsigned int function, tuple_t *tuple)
 
int pccard_get_tuple_data (struct pcmcia_socket *s, tuple_t *tuple)
 
int pcmcia_parse_tuple (tuple_t *tuple, cisparse_t *parse)
 
 EXPORT_SYMBOL (pcmcia_parse_tuple)
 
int pccard_validate_cis (struct pcmcia_socket *s, unsigned int *info)
 

Variables

struct bin_attribute pccard_cis_attr
 

Macro Definition Documentation

#define HAS_LINK (   f)    (((tuple_flags *)(&(f)))->has_link)

Definition at line 442 of file cistpl.c.

#define IRQ_INFO2_VALID   0x10

Definition at line 56 of file cistpl.c.

#define IS_ATTR   1

Definition at line 128 of file cistpl.c.

#define IS_INDIRECT   8

Definition at line 129 of file cistpl.c.

#define LINK_SPACE (   f)    (((tuple_flags *)(&(f)))->link_space)

Definition at line 441 of file cistpl.c.

#define MAX_TUPLES   200

Definition at line 53 of file cistpl.c.

#define MFC_FN (   f)    (((tuple_flags *)(&(f)))->mfc_fn)

Definition at line 443 of file cistpl.c.

#define POWER_CVT (   v)    (mantissa[((v)>>3)&15] * exponent[(v)&7] / 10)

Definition at line 48 of file cistpl.c.

#define POWER_SCALE (   v)    (exponent[(v)&7])

Definition at line 50 of file cistpl.c.

#define SPACE (   f)    (((tuple_flags *)(&(f)))->space)

Definition at line 444 of file cistpl.c.

#define SPEED_CVT (   v)    (mantissa[(((v)>>3)&15)-1] * exponent[(v)&7] / 10)

Definition at line 45 of file cistpl.c.

#define to_socket (   _dev)    container_of(_dev, struct pcmcia_socket, dev)

Definition at line 1465 of file cistpl.c.

Typedef Documentation

Function Documentation

void destroy_cis_cache ( struct pcmcia_socket s)

destroy_cis_cache() - destroy the CIS cache : pcmcia_socket for which CIS cache shall be destroyed

This destroys the CIS cache but keeps any fake CIS alive. Must be called with ops_mutex held.

Definition at line 355 of file cistpl.c.

EXPORT_SYMBOL ( pcmcia_parse_tuple  )
module_param ( cis_width  ,
int  ,
0444   
)
int pccard_get_first_tuple ( struct pcmcia_socket s,
unsigned int  function,
tuple_t tuple 
)

Definition at line 446 of file cistpl.c.

int pccard_get_next_tuple ( struct pcmcia_socket s,
unsigned int  function,
tuple_t tuple 
)

Definition at line 521 of file cistpl.c.

int pccard_get_tuple_data ( struct pcmcia_socket s,
tuple_t tuple 
)

Definition at line 633 of file cistpl.c.

int pccard_validate_cis ( struct pcmcia_socket s,
unsigned int info 
)

pccard_validate_cis() - check whether card has a sensible CIS : the struct pcmcia_socket we are to check : returns the number of tuples in the (valid) CIS, or 0

This tries to determine if a card has a sensible CIS. In , it returns the number of tuples in the CIS, or 0 if the CIS looks bad. The checks include making sure several critical tuples are present and valid; seeing if the total number of tuples is reasonable; and looking for tuples that use reserved codes.

The function returns 0 on success.

Definition at line 1376 of file cistpl.c.

int pcmcia_parse_tuple ( tuple_t tuple,
cisparse_t parse 
)

Definition at line 1288 of file cistpl.c.

int pcmcia_read_cis_mem ( struct pcmcia_socket s,
int  attr,
u_int  addr,
u_int  len,
void ptr 
)

pcmcia_read_cis_mem() - low-level function to read CIS memory

must be called with ops_mutex held

Definition at line 136 of file cistpl.c.

int pcmcia_replace_cis ( struct pcmcia_socket s,
const u8 data,
const size_t  len 
)

pcmcia_replace_cis() - use a replacement CIS instead of the card's CIS

For really bad cards, we provide a facility for uploading a replacement CIS.

Definition at line 410 of file cistpl.c.

int pcmcia_write_cis_mem ( struct pcmcia_socket s,
int  attr,
u_int  addr,
u_int  len,
void ptr 
)

pcmcia_write_cis_mem() - low-level function to write CIS memory

Probably only useful for writing one-byte registers. Must be called with ops_mutex held.

Definition at line 214 of file cistpl.c.

void release_cis_mem ( struct pcmcia_socket s)

Definition at line 62 of file cistpl.c.

int verify_cis_cache ( struct pcmcia_socket s)

verify_cis_cache() - does the CIS match what is in the CIS cache?

Definition at line 370 of file cistpl.c.

Variable Documentation

struct bin_attribute pccard_cis_attr
Initial value:
= {
.attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR },
.size = 0x200,
.read = pccard_show_cis,
.write = pccard_store_cis,
}

Definition at line 1595 of file cistpl.c.