[TG3]: Set minimal hw interrupt mitigation.
[linux-2.6/verdex.git] / drivers / pci / hotplug / shpchp_sysfs.c
blob9a1ee132d12cb47115b68fc310b95193be9bb74d
1 /*
2 * Compaq Hot Plug Controller Driver
4 * Copyright (c) 1995,2001 Compaq Computer Corporation
5 * Copyright (c) 2001,2003 Greg Kroah-Hartman (greg@kroah.com)
6 * Copyright (c) 2001 IBM Corp.
8 * All rights reserved.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or (at
13 * your option) any later version.
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
18 * NON INFRINGEMENT. See the GNU General Public License for more
19 * details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 * Send feedback to <greg@kroah.com>
29 #include <linux/config.h>
30 #include <linux/module.h>
31 #include <linux/kernel.h>
32 #include <linux/types.h>
33 #include <linux/proc_fs.h>
34 #include <linux/workqueue.h>
35 #include <linux/pci.h>
36 #include "shpchp.h"
39 /* A few routines that create sysfs entries for the hot plug controller */
41 static ssize_t show_ctrl (struct device *dev, char *buf)
43 struct pci_dev *pci_dev;
44 struct controller *ctrl;
45 char * out = buf;
46 int index;
47 struct pci_resource *res;
49 pci_dev = container_of (dev, struct pci_dev, dev);
50 ctrl = pci_get_drvdata(pci_dev);
52 out += sprintf(buf, "Free resources: memory\n");
53 index = 11;
54 res = ctrl->mem_head;
55 while (res && index--) {
56 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
57 res = res->next;
59 out += sprintf(out, "Free resources: prefetchable memory\n");
60 index = 11;
61 res = ctrl->p_mem_head;
62 while (res && index--) {
63 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
64 res = res->next;
66 out += sprintf(out, "Free resources: IO\n");
67 index = 11;
68 res = ctrl->io_head;
69 while (res && index--) {
70 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
71 res = res->next;
73 out += sprintf(out, "Free resources: bus numbers\n");
74 index = 11;
75 res = ctrl->bus_head;
76 while (res && index--) {
77 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
78 res = res->next;
81 return out - buf;
83 static DEVICE_ATTR (ctrl, S_IRUGO, show_ctrl, NULL);
85 static ssize_t show_dev (struct device *dev, char *buf)
87 struct pci_dev *pci_dev;
88 struct controller *ctrl;
89 char * out = buf;
90 int index;
91 struct pci_resource *res;
92 struct pci_func *new_slot;
93 struct slot *slot;
95 pci_dev = container_of (dev, struct pci_dev, dev);
96 ctrl = pci_get_drvdata(pci_dev);
98 slot=ctrl->slot;
100 while (slot) {
101 new_slot = shpchp_slot_find(slot->bus, slot->device, 0);
102 if (!new_slot)
103 break;
104 out += sprintf(out, "assigned resources: memory\n");
105 index = 11;
106 res = new_slot->mem_head;
107 while (res && index--) {
108 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
109 res = res->next;
111 out += sprintf(out, "assigned resources: prefetchable memory\n");
112 index = 11;
113 res = new_slot->p_mem_head;
114 while (res && index--) {
115 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
116 res = res->next;
118 out += sprintf(out, "assigned resources: IO\n");
119 index = 11;
120 res = new_slot->io_head;
121 while (res && index--) {
122 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
123 res = res->next;
125 out += sprintf(out, "assigned resources: bus numbers\n");
126 index = 11;
127 res = new_slot->bus_head;
128 while (res && index--) {
129 out += sprintf(out, "start = %8.8x, length = %8.8x\n", res->base, res->length);
130 res = res->next;
132 slot=slot->next;
135 return out - buf;
137 static DEVICE_ATTR (dev, S_IRUGO, show_dev, NULL);
139 void shpchp_create_ctrl_files (struct controller *ctrl)
141 device_create_file (&ctrl->pci_dev->dev, &dev_attr_ctrl);
142 device_create_file (&ctrl->pci_dev->dev, &dev_attr_dev);