aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-05-03 13:05:11 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-05-03 13:05:11 -0400
commitbf640be423d60d954b9673527e106a461a129eb8 (patch)
tree654d168d6effc47d18528ef5770c6f6dea51d901 /arch
parentc36c804559d3a891a2e655ba8185b4fa7eaee156 (diff)
parent4a1236ac6ee3bb3a2f585e66871de3c39ab38f7c (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6: sparc32: Delete prom_stdin and prom_stdout. sparc32: More memory probing consolidation. sparc32: Kill totally unused memory information tables. sparc64: Fix syscall restart, for real... serial: Fix sparc driver name strings. sparc64: Stop creating dummy root PCI host controller devices.
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/kernel/setup.c5
-rw-r--r--arch/sparc/mm/fault.c61
-rw-r--r--arch/sparc/prom/init.c7
-rw-r--r--arch/sparc/prom/memory.c235
-rw-r--r--arch/sparc64/kernel/pci.c130
-rw-r--r--arch/sparc64/kernel/pci_common.c6
-rw-r--r--arch/sparc64/kernel/pci_impl.h9
-rw-r--r--arch/sparc64/kernel/process.c6
-rw-r--r--arch/sparc64/kernel/signal.c6
-rw-r--r--arch/sparc64/kernel/signal32.c6
10 files changed, 111 insertions, 360 deletions
diff --git a/arch/sparc/kernel/setup.c b/arch/sparc/kernel/setup.c
index 3c13137685da..8a55c4f0df84 100644
--- a/arch/sparc/kernel/setup.c
+++ b/arch/sparc/kernel/setup.c
@@ -180,11 +180,9 @@ static void __init boot_flags_init(char *commands)
180 180
181/* This routine will in the future do all the nasty prom stuff 181/* This routine will in the future do all the nasty prom stuff
182 * to probe for the mmu type and its parameters, etc. This will 182 * to probe for the mmu type and its parameters, etc. This will
183 * also be where SMP things happen plus the Sparc specific memory 183 * also be where SMP things happen.
184 * physical memory probe as on the alpha.
185 */ 184 */
186 185
187extern int prom_probe_memory(void);
188extern void sun4c_probe_vac(void); 186extern void sun4c_probe_vac(void);
189extern char cputypval; 187extern char cputypval;
190extern unsigned long start, end; 188extern unsigned long start, end;
@@ -268,7 +266,6 @@ void __init setup_arch(char **cmdline_p)
268 if (ARCH_SUN4C_SUN4) 266 if (ARCH_SUN4C_SUN4)
269 sun4c_probe_vac(); 267 sun4c_probe_vac();
270 load_mmu(); 268 load_mmu();
271 (void) prom_probe_memory();
272 269
273 phys_base = 0xffffffffUL; 270 phys_base = 0xffffffffUL;
274 highest_paddr = 0UL; 271 highest_paddr = 0UL;
diff --git a/arch/sparc/mm/fault.c b/arch/sparc/mm/fault.c
index e4d9c8e19df5..abd50795a7b6 100644
--- a/arch/sparc/mm/fault.c
+++ b/arch/sparc/mm/fault.c
@@ -47,64 +47,15 @@ int vac_size, vac_linesize, vac_do_hw_vac_flushes;
47int vac_entries_per_context, vac_entries_per_segment; 47int vac_entries_per_context, vac_entries_per_segment;
48int vac_entries_per_page; 48int vac_entries_per_page;
49 49
50/* Nice, simple, prom library does all the sweating for us. ;) */ 50/* Return how much physical memory we have. */
51int prom_probe_memory (void) 51unsigned long probe_memory(void)
52{ 52{
53 register struct linux_mlist_v0 *mlist; 53 unsigned long total = 0;
54 register unsigned long bytes, base_paddr, tally; 54 int i;
55 register int i;
56
57 i = 0;
58 mlist= *prom_meminfo()->v0_available;
59 bytes = tally = mlist->num_bytes;
60 base_paddr = (unsigned long) mlist->start_adr;
61
62 sp_banks[0].base_addr = base_paddr;
63 sp_banks[0].num_bytes = bytes;
64
65 while (mlist->theres_more != (void *) 0){
66 i++;
67 mlist = mlist->theres_more;
68 bytes = mlist->num_bytes;
69 tally += bytes;
70 if (i > SPARC_PHYS_BANKS-1) {
71 printk ("The machine has more banks than "
72 "this kernel can support\n"
73 "Increase the SPARC_PHYS_BANKS "
74 "setting (currently %d)\n",
75 SPARC_PHYS_BANKS);
76 i = SPARC_PHYS_BANKS-1;
77 break;
78 }
79
80 sp_banks[i].base_addr = (unsigned long) mlist->start_adr;
81 sp_banks[i].num_bytes = mlist->num_bytes;
82 }
83
84 i++;
85 sp_banks[i].base_addr = 0xdeadbeef;
86 sp_banks[i].num_bytes = 0;
87
88 /* Now mask all bank sizes on a page boundary, it is all we can
89 * use anyways.
90 */
91 for(i=0; sp_banks[i].num_bytes != 0; i++)
92 sp_banks[i].num_bytes &= PAGE_MASK;
93
94 return tally;
95}
96
97/* Traverse the memory lists in the prom to see how much physical we
98 * have.
99 */
100unsigned long
101probe_memory(void)
102{
103 int total;
104 55
105 total = prom_probe_memory(); 56 for (i = 0; sp_banks[i].num_bytes; i++)
57 total += sp_banks[i].num_bytes;
106 58
107 /* Oh man, much nicer, keep the dirt in promlib. */
108 return total; 59 return total;
109} 60}
110 61
diff --git a/arch/sparc/prom/init.c b/arch/sparc/prom/init.c
index 50abfb1b880e..2fa3a474e3a2 100644
--- a/arch/sparc/prom/init.c
+++ b/arch/sparc/prom/init.c
@@ -21,8 +21,6 @@ linux_sun4_romvec *sun4_romvec;
21/* The root node of the prom device tree. */ 21/* The root node of the prom device tree. */
22int prom_root_node; 22int prom_root_node;
23 23
24int prom_stdin, prom_stdout;
25
26/* Pointer to the device tree operations structure. */ 24/* Pointer to the device tree operations structure. */
27struct linux_nodeops *prom_nodeops; 25struct linux_nodeops *prom_nodeops;
28 26
@@ -74,11 +72,6 @@ void __init prom_init(struct linux_romvec *rp)
74 (((unsigned long) prom_nodeops) == -1)) 72 (((unsigned long) prom_nodeops) == -1))
75 prom_halt(); 73 prom_halt();
76 74
77 if(prom_vers == PROM_V2 || prom_vers == PROM_V3) {
78 prom_stdout = *romvec->pv_v2bootargs.fd_stdout;
79 prom_stdin = *romvec->pv_v2bootargs.fd_stdin;
80 }
81
82 prom_meminit(); 75 prom_meminit();
83 76
84 prom_ranges_init(); 77 prom_ranges_init();
diff --git a/arch/sparc/prom/memory.c b/arch/sparc/prom/memory.c
index b0c0f9c4fc14..947f047dc95a 100644
--- a/arch/sparc/prom/memory.c
+++ b/arch/sparc/prom/memory.c
@@ -1,215 +1,100 @@
1/* $Id: memory.c,v 1.15 2000/01/29 01:09:12 anton Exp $ 1/* memory.c: Prom routine for acquiring various bits of information
2 * memory.c: Prom routine for acquiring various bits of information
3 * about RAM on the machine, both virtual and physical. 2 * about RAM on the machine, both virtual and physical.
4 * 3 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 4 * Copyright (C) 1995, 2008 David S. Miller (davem@davemloft.net)
6 * Copyright (C) 1997 Michael A. Griffith (grif@acm.org) 5 * Copyright (C) 1997 Michael A. Griffith (grif@acm.org)
7 */ 6 */
8 7
9#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sort.h>
10#include <linux/init.h> 10#include <linux/init.h>
11 11
12#include <asm/openprom.h> 12#include <asm/openprom.h>
13#include <asm/sun4prom.h> 13#include <asm/sun4prom.h>
14#include <asm/oplib.h> 14#include <asm/oplib.h>
15#include <asm/page.h>
15 16
16/* This routine, for consistency, returns the ram parameters in the 17static int __init prom_meminit_v0(void)
17 * V0 prom memory descriptor format. I choose this format because I 18{
18 * think it was the easiest to work with. I feel the religious 19 struct linux_mlist_v0 *p;
19 * arguments now... ;) Also, I return the linked lists sorted to 20 int index;
20 * prevent paging_init() upset stomach as I have not yet written 21
21 * the pepto-bismol kernel module yet. 22 index = 0;
22 */ 23 for (p = *(romvec->pv_v0mem.v0_available); p; p = p->theres_more) {
24 sp_banks[index].base_addr = (unsigned long) p->start_adr;
25 sp_banks[index].num_bytes = p->num_bytes;
26 index++;
27 }
23 28
24struct linux_prom_registers prom_reg_memlist[64]; 29 return index;
25struct linux_prom_registers prom_reg_tmp[64]; 30}
26 31
27struct linux_mlist_v0 prom_phys_total[64]; 32static int __init prom_meminit_v2(void)
28struct linux_mlist_v0 prom_prom_taken[64]; 33{
29struct linux_mlist_v0 prom_phys_avail[64]; 34 struct linux_prom_registers reg[64];
35 int node, size, num_ents, i;
30 36
31struct linux_mlist_v0 *prom_ptot_ptr = prom_phys_total; 37 node = prom_searchsiblings(prom_getchild(prom_root_node), "memory");
32struct linux_mlist_v0 *prom_ptak_ptr = prom_prom_taken; 38 size = prom_getproperty(node, "available", (char *) reg, sizeof(reg));
33struct linux_mlist_v0 *prom_pavl_ptr = prom_phys_avail; 39 num_ents = size / sizeof(struct linux_prom_registers);
34 40
35struct linux_mem_v0 prom_memlist; 41 for (i = 0; i < num_ents; i++) {
42 sp_banks[i].base_addr = reg[i].phys_addr;
43 sp_banks[i].num_bytes = reg[i].reg_size;
44 }
36 45
46 return num_ents;
47}
37 48
38/* Internal Prom library routine to sort a linux_mlist_v0 memory 49static int __init prom_meminit_sun4(void)
39 * list. Used below in initialization.
40 */
41static void __init
42prom_sortmemlist(struct linux_mlist_v0 *thislist)
43{ 50{
44 int swapi = 0; 51#ifdef CONFIG_SUN4
45 int i, mitr, tmpsize; 52 sp_banks[0].base_addr = 0;
46 char *tmpaddr; 53 sp_banks[0].num_bytes = *(sun4_romvec->memoryavail);
47 char *lowest; 54#endif
48 55 return 1;
49 for(i=0; thislist[i].theres_more; i++) { 56}
50 lowest = thislist[i].start_adr; 57
51 for(mitr = i+1; thislist[mitr-1].theres_more; mitr++) 58static int sp_banks_cmp(const void *a, const void *b)
52 if(thislist[mitr].start_adr < lowest) { 59{
53 lowest = thislist[mitr].start_adr; 60 const struct sparc_phys_banks *x = a, *y = b;
54 swapi = mitr;
55 }
56 if(lowest == thislist[i].start_adr) continue;
57 tmpaddr = thislist[swapi].start_adr;
58 tmpsize = thislist[swapi].num_bytes;
59 for(mitr = swapi; mitr > i; mitr--) {
60 thislist[mitr].start_adr = thislist[mitr-1].start_adr;
61 thislist[mitr].num_bytes = thislist[mitr-1].num_bytes;
62 }
63 thislist[i].start_adr = tmpaddr;
64 thislist[i].num_bytes = tmpsize;
65 }
66 61
67 return; 62 if (x->base_addr > y->base_addr)
63 return 1;
64 if (x->base_addr < y->base_addr)
65 return -1;
66 return 0;
68} 67}
69 68
70/* Initialize the memory lists based upon the prom version. */ 69/* Initialize the memory lists based upon the prom version. */
71void __init prom_meminit(void) 70void __init prom_meminit(void)
72{ 71{
73 int node = 0; 72 int i, num_ents = 0;
74 unsigned int iter, num_regs;
75 struct linux_mlist_v0 *mptr; /* ptr for traversal */
76 73
77 switch(prom_vers) { 74 switch (prom_vers) {
78 case PROM_V0: 75 case PROM_V0:
79 /* Nice, kind of easier to do in this case. */ 76 num_ents = prom_meminit_v0();
80 /* First, the total physical descriptors. */
81 for(mptr = (*(romvec->pv_v0mem.v0_totphys)), iter=0;
82 mptr; mptr=mptr->theres_more, iter++) {
83 prom_phys_total[iter].start_adr = mptr->start_adr;
84 prom_phys_total[iter].num_bytes = mptr->num_bytes;
85 prom_phys_total[iter].theres_more = &prom_phys_total[iter+1];
86 }
87 prom_phys_total[iter-1].theres_more = NULL;
88 /* Second, the total prom taken descriptors. */
89 for(mptr = (*(romvec->pv_v0mem.v0_prommap)), iter=0;
90 mptr; mptr=mptr->theres_more, iter++) {
91 prom_prom_taken[iter].start_adr = mptr->start_adr;
92 prom_prom_taken[iter].num_bytes = mptr->num_bytes;
93 prom_prom_taken[iter].theres_more = &prom_prom_taken[iter+1];
94 }
95 prom_prom_taken[iter-1].theres_more = NULL;
96 /* Last, the available physical descriptors. */
97 for(mptr = (*(romvec->pv_v0mem.v0_available)), iter=0;
98 mptr; mptr=mptr->theres_more, iter++) {
99 prom_phys_avail[iter].start_adr = mptr->start_adr;
100 prom_phys_avail[iter].num_bytes = mptr->num_bytes;
101 prom_phys_avail[iter].theres_more = &prom_phys_avail[iter+1];
102 }
103 prom_phys_avail[iter-1].theres_more = NULL;
104 /* Sort all the lists. */
105 prom_sortmemlist(prom_phys_total);
106 prom_sortmemlist(prom_prom_taken);
107 prom_sortmemlist(prom_phys_avail);
108 break; 77 break;
78
109 case PROM_V2: 79 case PROM_V2:
110 case PROM_V3: 80 case PROM_V3:
111 /* Grrr, have to traverse the prom device tree ;( */ 81 num_ents = prom_meminit_v2();
112 node = prom_getchild(prom_root_node);
113 node = prom_searchsiblings(node, "memory");
114 num_regs = prom_getproperty(node, "available",
115 (char *) prom_reg_memlist,
116 sizeof(prom_reg_memlist));
117 num_regs = (num_regs/sizeof(struct linux_prom_registers));
118 for(iter=0; iter<num_regs; iter++) {
119 prom_phys_avail[iter].start_adr =
120 (char *) prom_reg_memlist[iter].phys_addr;
121 prom_phys_avail[iter].num_bytes =
122 (unsigned long) prom_reg_memlist[iter].reg_size;
123 prom_phys_avail[iter].theres_more =
124 &prom_phys_avail[iter+1];
125 }
126 prom_phys_avail[iter-1].theres_more = NULL;
127
128 num_regs = prom_getproperty(node, "reg",
129 (char *) prom_reg_memlist,
130 sizeof(prom_reg_memlist));
131 num_regs = (num_regs/sizeof(struct linux_prom_registers));
132 for(iter=0; iter<num_regs; iter++) {
133 prom_phys_total[iter].start_adr =
134 (char *) prom_reg_memlist[iter].phys_addr;
135 prom_phys_total[iter].num_bytes =
136 (unsigned long) prom_reg_memlist[iter].reg_size;
137 prom_phys_total[iter].theres_more =
138 &prom_phys_total[iter+1];
139 }
140 prom_phys_total[iter-1].theres_more = NULL;
141
142 node = prom_getchild(prom_root_node);
143 node = prom_searchsiblings(node, "virtual-memory");
144 num_regs = prom_getproperty(node, "available",
145 (char *) prom_reg_memlist,
146 sizeof(prom_reg_memlist));
147 num_regs = (num_regs/sizeof(struct linux_prom_registers));
148
149 /* Convert available virtual areas to taken virtual
150 * areas. First sort, then convert.
151 */
152 for(iter=0; iter<num_regs; iter++) {
153 prom_prom_taken[iter].start_adr =
154 (char *) prom_reg_memlist[iter].phys_addr;
155 prom_prom_taken[iter].num_bytes =
156 (unsigned long) prom_reg_memlist[iter].reg_size;
157 prom_prom_taken[iter].theres_more =
158 &prom_prom_taken[iter+1];
159 }
160 prom_prom_taken[iter-1].theres_more = NULL;
161
162 prom_sortmemlist(prom_prom_taken);
163
164 /* Finally, convert. */
165 for(iter=0; iter<num_regs; iter++) {
166 prom_prom_taken[iter].start_adr =
167 prom_prom_taken[iter].start_adr +
168 prom_prom_taken[iter].num_bytes;
169 prom_prom_taken[iter].num_bytes =
170 prom_prom_taken[iter+1].start_adr -
171 prom_prom_taken[iter].start_adr;
172 }
173 prom_prom_taken[iter-1].num_bytes =
174 0xffffffff - (unsigned long) prom_prom_taken[iter-1].start_adr;
175
176 /* Sort the other two lists. */
177 prom_sortmemlist(prom_phys_total);
178 prom_sortmemlist(prom_phys_avail);
179 break; 82 break;
180 83
181 case PROM_SUN4: 84 case PROM_SUN4:
182#ifdef CONFIG_SUN4 85 num_ents = prom_meminit_sun4();
183 /* how simple :) */
184 prom_phys_total[0].start_adr = NULL;
185 prom_phys_total[0].num_bytes = *(sun4_romvec->memorysize);
186 prom_phys_total[0].theres_more = NULL;
187 prom_prom_taken[0].start_adr = NULL;
188 prom_prom_taken[0].num_bytes = 0x0;
189 prom_prom_taken[0].theres_more = NULL;
190 prom_phys_avail[0].start_adr = NULL;
191 prom_phys_avail[0].num_bytes = *(sun4_romvec->memoryavail);
192 prom_phys_avail[0].theres_more = NULL;
193#endif
194 break; 86 break;
195 87
196 default: 88 default:
197 break; 89 break;
198 }; 90 }
199 91 sort(sp_banks, num_ents, sizeof(struct sparc_phys_banks),
200 /* Link all the lists into the top-level descriptor. */ 92 sp_banks_cmp, NULL);
201 prom_memlist.v0_totphys=&prom_ptot_ptr;
202 prom_memlist.v0_prommap=&prom_ptak_ptr;
203 prom_memlist.v0_available=&prom_pavl_ptr;
204 93
205 return; 94 /* Sentinel. */
206} 95 sp_banks[num_ents].base_addr = 0xdeadbeef;
96 sp_banks[num_ents].num_bytes = 0;
207 97
208/* This returns a pointer to our libraries internal v0 format 98 for (i = 0; i < num_ents; i++)
209 * memory descriptor. 99 sp_banks[i].num_bytes &= PAGE_MASK;
210 */
211struct linux_mem_v0 *
212prom_meminfo(void)
213{
214 return &prom_memlist;
215} 100}
diff --git a/arch/sparc64/kernel/pci.c b/arch/sparc64/kernel/pci.c
index dbf2fc2f4d87..112b09f16f36 100644
--- a/arch/sparc64/kernel/pci.c
+++ b/arch/sparc64/kernel/pci.c
@@ -350,8 +350,7 @@ static void pci_parse_of_addrs(struct of_device *op,
350 350
351struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm, 351struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
352 struct device_node *node, 352 struct device_node *node,
353 struct pci_bus *bus, int devfn, 353 struct pci_bus *bus, int devfn)
354 int host_controller)
355{ 354{
356 struct dev_archdata *sd; 355 struct dev_archdata *sd;
357 struct pci_dev *dev; 356 struct pci_dev *dev;
@@ -390,43 +389,28 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
390 dev->devfn = devfn; 389 dev->devfn = devfn;
391 dev->multifunction = 0; /* maybe a lie? */ 390 dev->multifunction = 0; /* maybe a lie? */
392 391
393 if (host_controller) { 392 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff);
394 if (tlb_type != hypervisor) { 393 dev->device = of_getintprop_default(node, "device-id", 0xffff);
395 pci_read_config_word(dev, PCI_VENDOR_ID, 394 dev->subsystem_vendor =
396 &dev->vendor); 395 of_getintprop_default(node, "subsystem-vendor-id", 0);
397 pci_read_config_word(dev, PCI_DEVICE_ID, 396 dev->subsystem_device =
398 &dev->device); 397 of_getintprop_default(node, "subsystem-id", 0);
399 } else { 398
400 dev->vendor = PCI_VENDOR_ID_SUN; 399 dev->cfg_size = pci_cfg_space_size(dev);
401 dev->device = 0x80f0; 400
402 } 401 /* We can't actually use the firmware value, we have
403 dev->cfg_size = 256; 402 * to read what is in the register right now. One
404 dev->class = PCI_CLASS_BRIDGE_HOST << 8; 403 * reason is that in the case of IDE interfaces the
405 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 404 * firmware can sample the value before the the IDE
406 0x00, PCI_SLOT(devfn), PCI_FUNC(devfn)); 405 * interface is programmed into native mode.
407 } else { 406 */
408 dev->vendor = of_getintprop_default(node, "vendor-id", 0xffff); 407 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
409 dev->device = of_getintprop_default(node, "device-id", 0xffff); 408 dev->class = class >> 8;
410 dev->subsystem_vendor = 409 dev->revision = class & 0xff;
411 of_getintprop_default(node, "subsystem-vendor-id", 0); 410
412 dev->subsystem_device = 411 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
413 of_getintprop_default(node, "subsystem-id", 0); 412 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
414
415 dev->cfg_size = pci_cfg_space_size(dev);
416
417 /* We can't actually use the firmware value, we have
418 * to read what is in the register right now. One
419 * reason is that in the case of IDE interfaces the
420 * firmware can sample the value before the the IDE
421 * interface is programmed into native mode.
422 */
423 pci_read_config_dword(dev, PCI_CLASS_REVISION, &class);
424 dev->class = class >> 8;
425 dev->revision = class & 0xff;
426 413
427 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
428 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
429 }
430 if (ofpci_verbose) 414 if (ofpci_verbose)
431 printk(" class: 0x%x device name: %s\n", 415 printk(" class: 0x%x device name: %s\n",
432 dev->class, pci_name(dev)); 416 dev->class, pci_name(dev));
@@ -441,26 +425,21 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
441 dev->current_state = 4; /* unknown power state */ 425 dev->current_state = 4; /* unknown power state */
442 dev->error_state = pci_channel_io_normal; 426 dev->error_state = pci_channel_io_normal;
443 427
444 if (host_controller) { 428 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
429 /* a PCI-PCI bridge */
445 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE; 430 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
446 dev->rom_base_reg = PCI_ROM_ADDRESS1; 431 dev->rom_base_reg = PCI_ROM_ADDRESS1;
447 dev->irq = PCI_IRQ_NONE; 432 } else if (!strcmp(type, "cardbus")) {
433 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
448 } else { 434 } else {
449 if (!strcmp(type, "pci") || !strcmp(type, "pciex")) { 435 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
450 /* a PCI-PCI bridge */ 436 dev->rom_base_reg = PCI_ROM_ADDRESS;
451 dev->hdr_type = PCI_HEADER_TYPE_BRIDGE;
452 dev->rom_base_reg = PCI_ROM_ADDRESS1;
453 } else if (!strcmp(type, "cardbus")) {
454 dev->hdr_type = PCI_HEADER_TYPE_CARDBUS;
455 } else {
456 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
457 dev->rom_base_reg = PCI_ROM_ADDRESS;
458 437
459 dev->irq = sd->op->irqs[0]; 438 dev->irq = sd->op->irqs[0];
460 if (dev->irq == 0xffffffff) 439 if (dev->irq == 0xffffffff)
461 dev->irq = PCI_IRQ_NONE; 440 dev->irq = PCI_IRQ_NONE;
462 }
463 } 441 }
442
464 pci_parse_of_addrs(sd->op, node, dev); 443 pci_parse_of_addrs(sd->op, node, dev);
465 444
466 if (ofpci_verbose) 445 if (ofpci_verbose)
@@ -749,7 +728,7 @@ static void __devinit pci_of_scan_bus(struct pci_pbm_info *pbm,
749 prev_devfn = devfn; 728 prev_devfn = devfn;
750 729
751 /* create a new pci_dev for this device */ 730 /* create a new pci_dev for this device */
752 dev = of_create_pci_dev(pbm, child, bus, devfn, 0); 731 dev = of_create_pci_dev(pbm, child, bus, devfn);
753 if (!dev) 732 if (!dev)
754 continue; 733 continue;
755 if (ofpci_verbose) 734 if (ofpci_verbose)
@@ -796,48 +775,9 @@ static void __devinit pci_bus_register_of_sysfs(struct pci_bus *bus)
796 pci_bus_register_of_sysfs(child_bus); 775 pci_bus_register_of_sysfs(child_bus);
797} 776}
798 777
799int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
800 unsigned int devfn,
801 int where, int size,
802 u32 *value)
803{
804 static u8 fake_pci_config[] = {
805 0x8e, 0x10, /* Vendor: 0x108e (Sun) */
806 0xf0, 0x80, /* Device: 0x80f0 (Fire) */
807 0x46, 0x01, /* Command: 0x0146 (SERR, PARITY, MASTER, MEM) */
808 0xa0, 0x22, /* Status: 0x02a0 (DEVSEL_MED, FB2B, 66MHZ) */
809 0x00, 0x00, 0x00, 0x06, /* Class: 0x06000000 host bridge */
810 0x00, /* Cacheline: 0x00 */
811 0x40, /* Latency: 0x40 */
812 0x00, /* Header-Type: 0x00 normal */
813 };
814
815 *value = 0;
816 if (where >= 0 && where < sizeof(fake_pci_config) &&
817 (where + size) >= 0 &&
818 (where + size) < sizeof(fake_pci_config) &&
819 size <= sizeof(u32)) {
820 while (size--) {
821 *value <<= 8;
822 *value |= fake_pci_config[where + size];
823 }
824 }
825
826 return PCIBIOS_SUCCESSFUL;
827}
828
829int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev,
830 unsigned int devfn,
831 int where, int size,
832 u32 value)
833{
834 return PCIBIOS_SUCCESSFUL;
835}
836
837struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm) 778struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
838{ 779{
839 struct device_node *node = pbm->prom_node; 780 struct device_node *node = pbm->prom_node;
840 struct pci_dev *host_pdev;
841 struct pci_bus *bus; 781 struct pci_bus *bus;
842 782
843 printk("PCI: Scanning PBM %s\n", node->full_name); 783 printk("PCI: Scanning PBM %s\n", node->full_name);
@@ -855,10 +795,6 @@ struct pci_bus * __devinit pci_scan_one_pbm(struct pci_pbm_info *pbm)
855 bus->resource[0] = &pbm->io_space; 795 bus->resource[0] = &pbm->io_space;
856 bus->resource[1] = &pbm->mem_space; 796 bus->resource[1] = &pbm->mem_space;
857 797
858 /* Create the dummy host bridge and link it in. */
859 host_pdev = of_create_pci_dev(pbm, node, bus, 0x00, 1);
860 bus->self = host_pdev;
861
862 pci_of_scan_bus(pbm, node, bus); 798 pci_of_scan_bus(pbm, node, bus);
863 pci_bus_add_devices(bus); 799 pci_bus_add_devices(bus);
864 pci_bus_register_of_sysfs(bus); 800 pci_bus_register_of_sysfs(bus);
diff --git a/arch/sparc64/kernel/pci_common.c b/arch/sparc64/kernel/pci_common.c
index 923e0bcc3bfd..19fa621d6a60 100644
--- a/arch/sparc64/kernel/pci_common.c
+++ b/arch/sparc64/kernel/pci_common.c
@@ -264,9 +264,6 @@ static int sun4v_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
264 unsigned int func = PCI_FUNC(devfn); 264 unsigned int func = PCI_FUNC(devfn);
265 unsigned long ret; 265 unsigned long ret;
266 266
267 if (!bus && devfn == 0x00)
268 return pci_host_bridge_read_pci_cfg(bus_dev, devfn, where,
269 size, value);
270 if (config_out_of_range(pbm, bus, devfn, where)) { 267 if (config_out_of_range(pbm, bus, devfn, where)) {
271 ret = ~0UL; 268 ret = ~0UL;
272 } else { 269 } else {
@@ -300,9 +297,6 @@ static int sun4v_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
300 unsigned int func = PCI_FUNC(devfn); 297 unsigned int func = PCI_FUNC(devfn);
301 unsigned long ret; 298 unsigned long ret;
302 299
303 if (!bus && devfn == 0x00)
304 return pci_host_bridge_write_pci_cfg(bus_dev, devfn, where,
305 size, value);
306 if (config_out_of_range(pbm, bus, devfn, where)) { 300 if (config_out_of_range(pbm, bus, devfn, where)) {
307 /* Do nothing. */ 301 /* Do nothing. */
308 } else { 302 } else {
diff --git a/arch/sparc64/kernel/pci_impl.h b/arch/sparc64/kernel/pci_impl.h
index 218bac4ff79b..c385d126be11 100644
--- a/arch/sparc64/kernel/pci_impl.h
+++ b/arch/sparc64/kernel/pci_impl.h
@@ -167,15 +167,6 @@ extern void pci_get_pbm_props(struct pci_pbm_info *pbm);
167extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm); 167extern struct pci_bus *pci_scan_one_pbm(struct pci_pbm_info *pbm);
168extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm); 168extern void pci_determine_mem_io_space(struct pci_pbm_info *pbm);
169 169
170extern int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
171 unsigned int devfn,
172 int where, int size,
173 u32 *value);
174extern int pci_host_bridge_write_pci_cfg(struct pci_bus *bus_dev,
175 unsigned int devfn,
176 int where, int size,
177 u32 value);
178
179/* Error reporting support. */ 170/* Error reporting support. */
180extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *); 171extern void pci_scan_for_target_abort(struct pci_pbm_info *, struct pci_bus *);
181extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *); 172extern void pci_scan_for_master_abort(struct pci_pbm_info *, struct pci_bus *);
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 056013749157..500ac6d483a0 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -591,12 +591,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
591 if (clone_flags & CLONE_SETTLS) 591 if (clone_flags & CLONE_SETTLS)
592 t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3]; 592 t->kregs->u_regs[UREG_G7] = regs->u_regs[UREG_I3];
593 593
594 /* We do not want to accidently trigger system call restart
595 * handling in the new thread. Therefore, clear out the trap
596 * type, which will make pt_regs_regs_is_syscall() return false.
597 */
598 pt_regs_clear_trap_type(t->kregs);
599
600 return 0; 594 return 0;
601} 595}
602 596
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index f2d88d8f7a42..45d6bf632daa 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -332,6 +332,9 @@ void do_rt_sigreturn(struct pt_regs *regs)
332 regs->tpc = tpc; 332 regs->tpc = tpc;
333 regs->tnpc = tnpc; 333 regs->tnpc = tnpc;
334 334
335 /* Prevent syscall restart. */
336 pt_regs_clear_trap_type(regs);
337
335 sigdelsetmask(&set, ~_BLOCKABLE); 338 sigdelsetmask(&set, ~_BLOCKABLE);
336 spin_lock_irq(&current->sighand->siglock); 339 spin_lock_irq(&current->sighand->siglock);
337 current->blocked = set; 340 current->blocked = set;
@@ -515,7 +518,8 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
515 siginfo_t info; 518 siginfo_t info;
516 int signr; 519 int signr;
517 520
518 if (pt_regs_is_syscall(regs)) { 521 if (pt_regs_is_syscall(regs) &&
522 (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY))) {
519 pt_regs_clear_trap_type(regs); 523 pt_regs_clear_trap_type(regs);
520 cookie.restart_syscall = 1; 524 cookie.restart_syscall = 1;
521 } else 525 } else
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 91f8d0826db1..9415d2c918c5 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -268,6 +268,9 @@ void do_sigreturn32(struct pt_regs *regs)
268 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); 268 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
269 regs->tstate |= psr_to_tstate_icc(psr); 269 regs->tstate |= psr_to_tstate_icc(psr);
270 270
271 /* Prevent syscall restart. */
272 pt_regs_clear_trap_type(regs);
273
271 err |= __get_user(fpu_save, &sf->fpu_save); 274 err |= __get_user(fpu_save, &sf->fpu_save);
272 if (fpu_save) 275 if (fpu_save)
273 err |= restore_fpu_state32(regs, &sf->fpu_state); 276 err |= restore_fpu_state32(regs, &sf->fpu_state);
@@ -351,6 +354,9 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
351 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC); 354 regs->tstate &= ~(TSTATE_ICC|TSTATE_XCC);
352 regs->tstate |= psr_to_tstate_icc(psr); 355 regs->tstate |= psr_to_tstate_icc(psr);
353 356
357 /* Prevent syscall restart. */
358 pt_regs_clear_trap_type(regs);
359
354 err |= __get_user(fpu_save, &sf->fpu_save); 360 err |= __get_user(fpu_save, &sf->fpu_save);
355 if (fpu_save) 361 if (fpu_save)
356 err |= restore_fpu_state32(regs, &sf->fpu_state); 362 err |= restore_fpu_state32(regs, &sf->fpu_state);