zorro.c (137f5ae4dae85011b13e3a7049414c4060ad94c0) zorro.c (acafe7e30216166a17e6e226aadc3ecb63993242)
1/*
2 * Zorro Bus Services
3 *
4 * Copyright (C) 1995-2003 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.

--- 87 unchanged lines hidden (view full) ---

96 end &= ~Z2RAM_CHUNKMASK;
97
98 if (end <= Z2RAM_START || start >= Z2RAM_END)
99 return;
100 start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
101 end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
102 while (start < end) {
103 u32 chunk = start>>Z2RAM_CHUNKSHIFT;
1/*
2 * Zorro Bus Services
3 *
4 * Copyright (C) 1995-2003 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.

--- 87 unchanged lines hidden (view full) ---

96 end &= ~Z2RAM_CHUNKMASK;
97
98 if (end <= Z2RAM_START || start >= Z2RAM_END)
99 return;
100 start = start < Z2RAM_START ? 0x00000000 : start-Z2RAM_START;
101 end = end > Z2RAM_END ? Z2RAM_SIZE : end-Z2RAM_START;
102 while (start < end) {
103 u32 chunk = start>>Z2RAM_CHUNKSHIFT;
104
105 if (flag)
106 set_bit(chunk, zorro_unused_z2ram);
107 else
108 clear_bit(chunk, zorro_unused_z2ram);
109 start += Z2RAM_CHUNKSIZE;
110 }
111}
112
113
114static struct resource __init *zorro_find_parent_resource(
115 struct platform_device *bridge, struct zorro_dev *z)
116{
117 int i;
118
119 for (i = 0; i < bridge->num_resources; i++) {
120 struct resource *r = &bridge->resource[i];
104 if (flag)
105 set_bit(chunk, zorro_unused_z2ram);
106 else
107 clear_bit(chunk, zorro_unused_z2ram);
108 start += Z2RAM_CHUNKSIZE;
109 }
110}
111
112
113static struct resource __init *zorro_find_parent_resource(
114 struct platform_device *bridge, struct zorro_dev *z)
115{
116 int i;
117
118 for (i = 0; i < bridge->num_resources; i++) {
119 struct resource *r = &bridge->resource[i];
121
122 if (zorro_resource_start(z) >= r->start &&
123 zorro_resource_end(z) <= r->end)
124 return r;
125 }
126 return &iomem_resource;
127}
128
129
130
131static int __init amiga_zorro_probe(struct platform_device *pdev)
132{
133 struct zorro_bus *bus;
134 struct zorro_dev_init *zi;
135 struct zorro_dev *z;
136 struct resource *r;
137 unsigned int i;
138 int error;
139
140 /* Initialize the Zorro bus */
120 if (zorro_resource_start(z) >= r->start &&
121 zorro_resource_end(z) <= r->end)
122 return r;
123 }
124 return &iomem_resource;
125}
126
127
128
129static int __init amiga_zorro_probe(struct platform_device *pdev)
130{
131 struct zorro_bus *bus;
132 struct zorro_dev_init *zi;
133 struct zorro_dev *z;
134 struct resource *r;
135 unsigned int i;
136 int error;
137
138 /* Initialize the Zorro bus */
141 bus = kzalloc(sizeof(*bus) +
142 zorro_num_autocon * sizeof(bus->devices[0]),
139 bus = kzalloc(struct_size(bus, devices, zorro_num_autocon),
143 GFP_KERNEL);
144 if (!bus)
145 return -ENOMEM;
146
147 zorro_autocon = bus->devices;
148 bus->dev.parent = &pdev->dev;
149 dev_set_name(&bus->dev, zorro_bus_type.name);
150 error = device_register(&bus->dev);

--- 14 unchanged lines hidden (view full) ---

165 z = &zorro_autocon[i];
166
167 z->rom = zi->rom;
168 z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) |
169 (z->rom.er_Product << 8);
170 if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
171 /* GVP quirk */
172 unsigned long magic = zi->boardaddr + 0x8000;
140 GFP_KERNEL);
141 if (!bus)
142 return -ENOMEM;
143
144 zorro_autocon = bus->devices;
145 bus->dev.parent = &pdev->dev;
146 dev_set_name(&bus->dev, zorro_bus_type.name);
147 error = device_register(&bus->dev);

--- 14 unchanged lines hidden (view full) ---

162 z = &zorro_autocon[i];
163
164 z->rom = zi->rom;
165 z->id = (be16_to_cpu(z->rom.er_Manufacturer) << 16) |
166 (z->rom.er_Product << 8);
167 if (z->id == ZORRO_PROD_GVP_EPC_BASE) {
168 /* GVP quirk */
169 unsigned long magic = zi->boardaddr + 0x8000;
173
174 z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
175 }
176 z->slotaddr = zi->slotaddr;
177 z->slotsize = zi->slotsize;
178 sprintf(z->name, "Zorro device %08x", z->id);
179 zorro_name_device(z);
180 z->resource.start = zi->boardaddr;
181 z->resource.end = zi->boardaddr + zi->boardsize - 1;

--- 66 unchanged lines hidden ---
170 z->id |= *(u16 *)ZTWO_VADDR(magic) & GVP_PRODMASK;
171 }
172 z->slotaddr = zi->slotaddr;
173 z->slotsize = zi->slotsize;
174 sprintf(z->name, "Zorro device %08x", z->id);
175 zorro_name_device(z);
176 z->resource.start = zi->boardaddr;
177 z->resource.end = zi->boardaddr + zi->boardsize - 1;

--- 66 unchanged lines hidden ---