OpenCores
URL https://opencores.org/ocsvn/or1k_old/or1k_old/trunk

Subversion Repositories or1k_old

[/] [or1k_old/] [trunk/] [uclinux/] [uClinux-2.0.x/] [drivers/] [scsi/] [eata_pio_proc.c] - Blame information for rev 1782

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
 
2
/*
3
 * eata_set_info
4
 * buffer : pointer to the data that has been written to the hostfile
5
 * length : number of bytes written to the hostfile
6
 * HBA_ptr: pointer to the Scsi_Host struct
7
 */
8
int eata_pio_set_info(char *buffer, int length, struct Scsi_Host *HBA_ptr)
9
{
10
    DBG(DBG_PROC_WRITE, printk("%s\n", buffer));
11
    return(-ENOSYS);  /* Currently this is a no-op */
12
}
13
 
14
/*
15
 * eata_proc_info
16
 * inout : decides on the direction of the dataflow and the meaning of the
17
 *         variables
18
 * buffer: If inout==FALSE data is being written to it else read from it
19
 * *start: If inout==FALSE start of the valid data in the buffer
20
 * offset: If inout==FALSE offset from the beginning of the imaginary file
21
 *         from which we start writing into the buffer
22
 * length: If inout==FALSE max number of bytes to be written into the buffer
23
 *         else number of bytes in the buffer
24
 */
25
int eata_pio_proc_info(char *buffer, char **start, off_t offset, int length,
26
                       int hostno, int inout)
27
{
28
 
29
    Scsi_Device *scd;
30
    struct Scsi_Host *HBA_ptr;
31
    static u8 buff[512];
32
    int i;
33
    int   size, len = 0;
34
    off_t begin = 0;
35
    off_t pos = 0;
36
 
37
    HBA_ptr = first_HBA;
38
    for (i = 1; i <= registered_HBAs; i++) {
39
        if (HBA_ptr->host_no == hostno)
40
            break;
41
        HBA_ptr = SD(HBA_ptr)->next;
42
    }
43
 
44
    if(inout == TRUE) /* Has data been written to the file ? */
45
        return(eata_pio_set_info(buffer, length, HBA_ptr));
46
 
47
    if (offset == 0)
48
        memset(buff, 0, sizeof(buff));
49
 
50
    size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: "
51
                   "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
52
    len += size; pos = begin + len;
53
    size = sprintf(buffer + len, "queued commands:     %10ld\n"
54
                   "processed interrupts:%10ld\n", queue_counter, int_counter);
55
    len += size; pos = begin + len;
56
 
57
    size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
58
                   HBA_ptr->host_no, SD(HBA_ptr)->name);
59
    len += size;
60
    pos = begin + len;
61
    size = sprintf(buffer + len, "Firmware revision: v%s\n",
62
                   SD(HBA_ptr)->revision);
63
    len += size;
64
    pos = begin + len;
65
    size = sprintf(buffer + len, "IO: PIO\n");
66
    len += size;
67
    pos = begin + len;
68
    size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) HBA_ptr->base);
69
    len += size;
70
    pos = begin + len;
71
    size = sprintf(buffer + len, "Host Bus: %s\n",
72
                   (SD(HBA_ptr)->bustype == 'P')?"PCI ":
73
                   (SD(HBA_ptr)->bustype == 'E')?"EISA":"ISA ");
74
 
75
    len += size;
76
    pos = begin + len;
77
 
78
    if (pos < offset) {
79
        len = 0;
80
        begin = pos;
81
    }
82
    if (pos > offset + length)
83
        goto stop_output;
84
 
85
    scd = scsi_devices;
86
 
87
    size = sprintf(buffer+len,"Attached devices: %s\n", (scd)?"":"none");
88
    len += size;
89
    pos = begin + len;
90
 
91
    while (scd) {
92
        if (scd->host == HBA_ptr) {
93
            proc_print_scsidevice(scd, buffer, &size, len);
94
            len += size;
95
            pos = begin + len;
96
 
97
            if (pos < offset) {
98
                len = 0;
99
                begin = pos;
100
            }
101
            if (pos > offset + length)
102
                goto stop_output;
103
        }
104
        scd = scd->next;
105
    }
106
 
107
 stop_output:
108
    DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
109
    *start=buffer+(offset-begin);   /* Start of wanted data */
110
    len-=(offset-begin);            /* Start slop */
111
    if(len>length)
112
        len = length;               /* Ending slop */
113
    DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
114
 
115
    return (len);
116
}
117
 
118
/*
119
 * Overrides for Emacs so that we follow Linus's tabbing style.
120
 * Emacs will notice this stuff at the end of the file and automatically
121
 * adjust the settings for this buffer only.  This must remain at the end
122
 * of the file.
123
 * ---------------------------------------------------------------------------
124
 * Local variables:
125
 * c-indent-level: 4
126
 * c-brace-imaginary-offset: 0
127
 * c-brace-offset: -4
128
 * c-argdecl-indent: 4
129
 * c-label-offset: -4
130
 * c-continued-statement-offset: 4
131
 * c-continued-brace-offset: 0
132
 * tab-width: 8
133
 * End:
134
 */
135
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.