Commit f2dbb513 authored by Russell King's avatar Russell King

[PCMCIA] Convert PCI socket drivers to use struct resource.

Convert PCI socket drivers to use the resource passed in rather than
pccard_mem_map's sys_start and sys_stop elements.  This also means
that we convert the struct resource to a PCI bus region, thereby
performing any platform specific fixups which may be necessary.
parent 6fb31841
...@@ -706,12 +706,16 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma ...@@ -706,12 +706,16 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem) static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number; struct socket_info *sock_info = container_of(socket, struct socket_info, socket);
unsigned int sock = sock_info->number;
struct pci_bus_region region;
unsigned short base, i; unsigned short base, i;
unsigned char map; unsigned char map;
enter("i82092aa_set_mem_map"); enter("i82092aa_set_mem_map");
pcibios_resource_to_bus(sock_info->dev, &region, mem->res);
map = mem->map; map = mem->map;
if (map > 4) { if (map > 4) {
leave("i82092aa_set_mem_map: invalid map"); leave("i82092aa_set_mem_map: invalid map");
...@@ -719,10 +723,10 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -719,10 +723,10 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
} }
if ( (mem->card_start > 0x3ffffff) || (mem->sys_start > mem->sys_stop) || if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
(mem->speed > 1000) ) { (mem->speed > 1000) ) {
leave("i82092aa_set_mem_map: invalid address / speed"); leave("i82092aa_set_mem_map: invalid address / speed");
printk("invalid mem map for socket %i : %lx to %lx with a start of %x \n",sock,mem->sys_start, mem->sys_stop, mem->card_start); printk("invalid mem map for socket %i : %lx to %lx with a start of %x \n",sock,region.start, region.end, mem->card_start);
return -EINVAL; return -EINVAL;
} }
...@@ -731,11 +735,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -731,11 +735,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map)); indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
/* printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, mem->sys_start,mem->sys_stop,sock,mem->speed,mem->flags & MAP_ACTIVE); */ /* printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, region.start,region.end,sock,mem->speed,mem->flags & MAP_ACTIVE); */
/* write the start address */ /* write the start address */
base = I365_MEM(map); base = I365_MEM(map);
i = (mem->sys_start >> 12) & 0x0fff; i = (region.start >> 12) & 0x0fff;
if (mem->flags & MAP_16BIT) if (mem->flags & MAP_16BIT)
i |= I365_MEM_16BIT; i |= I365_MEM_16BIT;
if (mem->flags & MAP_0WS) if (mem->flags & MAP_0WS)
...@@ -744,7 +748,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -744,7 +748,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
/* write the stop address */ /* write the stop address */
i= (mem->sys_stop >> 12) & 0x0fff; i= (region.end >> 12) & 0x0fff;
switch (to_cycles(mem->speed)) { switch (to_cycles(mem->speed)) {
case 0: case 0:
break; break;
...@@ -763,7 +767,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -763,7 +767,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
/* card start */ /* card start */
i = ((mem->card_start - mem->sys_start) >> 12) & 0x3fff; i = ((mem->card_start - region.start) >> 12) & 0x3fff;
if (mem->flags & MAP_WRPROT) if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT; i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) { if (mem->flags & MAP_ATTRIB) {
......
...@@ -343,14 +343,17 @@ static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io ...@@ -343,14 +343,17 @@ static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io
static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem) static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
{ {
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket); struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
struct pci_bus_region region;
int map; int map;
unsigned char addr, enable; unsigned char addr, enable;
unsigned int start, stop, card_start; unsigned int start, stop, card_start;
unsigned short word; unsigned short word;
pcibios_resource_to_bus(socket->dev, &region, mem->res);
map = mem->map; map = mem->map;
start = mem->sys_start; start = region.start;
stop = mem->sys_stop; stop = region.end;
card_start = mem->card_start; card_start = mem->card_start;
if (map > 4 || start > stop || ((start ^ stop) >> 24) || if (map > 4 || start > stop || ((start ^ stop) >> 24) ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment