[parisc-linux-cvs] Rationalise PDC return values

Matthew Wilcox willy@ldl.fc.hp.com
Fri, 05 Oct 2001 11:07:10 -0600


-pa40

Index: arch/parisc/kernel/drivers.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/drivers.c,v
retrieving revision 1.27
diff -u -p -r1.27 drivers.c
--- arch/parisc/kernel/drivers.c	2001/10/04 23:26:28	1.27
+++ arch/parisc/kernel/drivers.c	2001/10/05 16:59:03
@@ -203,7 +203,7 @@ struct parisc_device *alloc_pa_dev(unsig
 	memset(dev, 0, sizeof(*dev));
 	
 	status = pdc_iodc_read(&bytecnt, hpa, 0, &iodc_data, 32);
-	if (status != PDC_RET_OK) {
+	if (status != PDC_OK) {
 		/* There is no device here, so we'll skip it */
 		write_unlock(&pa_lock);
 		return NULL;
Index: arch/parisc/kernel/firmware.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/firmware.c,v
retrieving revision 1.32
diff -u -p -r1.32 firmware.c
--- arch/parisc/kernel/firmware.c	2001/10/04 00:17:52	1.32
+++ arch/parisc/kernel/firmware.c	2001/10/05 16:59:03
@@ -294,7 +294,7 @@ int pdc_model_sysmodel(char *name)
                               OS_ID_HPUX, __pa(name));
         convert_to_wide(pdc_result);
 
-        if (retval == PDC_RET_OK) {
+        if (retval == PDC_OK) {
                 name[pdc_result[0]] = '\0'; /* add trailing '\0' */
         } else {
                 name[0] = 0;
Index: arch/parisc/kernel/inventory.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/inventory.c,v
retrieving revision 1.38
diff -u -p -r1.38 inventory.c
--- arch/parisc/kernel/inventory.c	2001/10/04 23:07:52	1.38
+++ arch/parisc/kernel/inventory.c	2001/10/05 16:59:03
@@ -53,7 +53,7 @@ void __init setup_pdc(void)
 	printk(KERN_INFO "Determining PDC firmware type: ");
 
 	status = pdc_system_map_find_mods(&module_result, &module_path, 0);
-	if (status == PDC_RET_OK) {
+	if (status == PDC_OK) {
 		pdc_type = PDC_TYPE_SYSTEM_MAP;
 		printk("System Map.\n");
 		return;
@@ -72,7 +72,7 @@ void __init setup_pdc(void)
 
 #ifdef __LP64__
 	status = pdc_pat_cell_get_number(&cell_info);
-	if (status == PDC_RET_OK) {
+	if (status == PDC_OK) {
 		pdc_type = PDC_TYPE_PAT;
 		printk("64 bit PAT.\n");
 		return;
@@ -178,7 +178,7 @@ pat_query_module(ulong pcell_loc, ulong 
 	status = pdc_pat_cell_module(&bytecnt, pcell_loc, mod_index,
 				     PA_VIEW, &pa_pdc_cell);
 
-	if (status != PDC_RET_OK) {
+	if (status != PDC_OK) {
 		/* no more cell modules or error */
 		return status;
 	}
@@ -186,7 +186,7 @@ pat_query_module(ulong pcell_loc, ulong 
 	temp = pa_pdc_cell.cba;
 	dev = alloc_pa_dev(PAT_GET_CBA(temp));	/* sets dev->hpa */
 	if (!dev) {
-		return PDC_RET_NE_MOD;
+		return PDC_NE_MOD;
 	}
 
 	/*
@@ -256,7 +256,7 @@ pat_query_module(ulong pcell_loc, ulong 
 		break;
 	}
 #endif /* DEBUG_PAT */
-	return PDC_RET_OK;
+	return PDC_OK;
 }
 
 
@@ -284,7 +284,7 @@ static void __init pat_memconfig(void)
 
 	status = pdc_pat_pd_get_addr_map(&actual_len, mem_table, length, 0L);
 
-	if ((status != PDC_RET_OK)
+	if ((status != PDC_OK)
 	    || ((actual_len % sizeof(struct pdc_pat_pd_addr_map_entry)) != 0)) {
 
 		/* The above pdc call shouldn't fail, but, just in
@@ -346,7 +346,7 @@ static int __init pat_inventory(void)
 	**        implement PDC_PAT_CELL sub-options 0 and 2.
 	*/
 	status = pdc_pat_cell_get_number(&cell_info);
-	if (status != PDC_RET_OK) {
+	if (status != PDC_OK) {
 		return 0;
 	}
 
@@ -355,7 +355,7 @@ static int __init pat_inventory(void)
 	       cell_info.cell_loc);
 #endif
 
-	while (PDC_RET_OK == pat_query_module(cell_info.cell_loc, mod_index)) {
+	while (PDC_OK == pat_query_module(cell_info.cell_loc, mod_index)) {
 		mod_index++;
 	}
 
@@ -376,7 +376,7 @@ static void __init sprockets_memconfig(v
 	status = pdc_mem_mem_table(&r_addr,mem_table,
 				(unsigned long)MAX_PHYSMEM_RANGES);
 
-	if (status != PDC_RET_OK) {
+	if (status != PDC_OK) {
 
 		/* The above pdc call only works on boxes with sprockets
 		 * firmware (newer B,C,J class). Other non PAT PDC machines
@@ -423,7 +423,7 @@ legacy_create_device(struct pdc_memory_m
 {
 	struct parisc_device *dev;
 	int status = pdc_mem_map_hpa(r_addr, module_path);
-	if (status != PDC_RET_OK)
+	if (status != PDC_OK)
 		return NULL;
 
 	dev = alloc_pa_dev(r_addr->hpa);
@@ -543,7 +543,7 @@ add_system_map_addresses(struct parisc_d
 	for(i = 0; i < num_addrs; ++i) {
 		status = pdc_system_map_find_addrs(&addr_result, 
 						   module_instance, i);
-		if(PDC_RET_OK == status) {
+		if(PDC_OK == status) {
 			dev->addr[dev->num_addrs] = (unsigned long)addr_result.mod_addr;
 			dev->num_addrs++;
 		} else {
@@ -565,16 +565,16 @@ add_system_map_addresses(struct parisc_d
 static int __init system_map_inventory(void)
 {
 	int i, num = 0;
-	long status = PDC_RET_OK;
+	long status = PDC_OK;
 
-	for (i = 0; status != PDC_RET_NE_PROC && status != PDC_RET_NE_MOD; i++) {
+	for (i = 0; status != PDC_BAD_PROC && status != PDC_NE_MOD; i++) {
 		struct parisc_device *dev;
 		struct pdc_system_map_mod_info module_result;
 		struct pdc_module_path module_path;
 
 		status = pdc_system_map_find_mods(&module_result,
 				&module_path, i);
-		if (status != PDC_RET_OK)
+		if (status != PDC_OK)
 			continue;
 		
 		dev = alloc_pa_dev(module_result.mod_addr);
Index: arch/parisc/kernel/iosapic.c
===================================================================
RCS file: /home/cvs/parisc/linux/arch/parisc/kernel/iosapic.c,v
retrieving revision 1.32
diff -u -p -r1.32 iosapic.c
--- arch/parisc/kernel/iosapic.c	2001/10/02 20:58:42	1.32
+++ arch/parisc/kernel/iosapic.c	2001/10/05 16:59:03
@@ -342,7 +342,7 @@ iosapic_load_irt(unsigned long cell_num,
 		status = pdc_pat_get_irt_size(&num_entries, cell_num);
 		DBG("get_irt_size: %ld\n", status);
 
-		ASSERT(status == PDC_RET_OK);
+		ASSERT(status == PDC_OK);
 
 		/* save the number of entries in the table */
 		ASSERT(0UL != num_entries);
@@ -362,7 +362,7 @@ iosapic_load_irt(unsigned long cell_num,
 		/* get PCI INT routing table */
 		status = pdc_pat_get_irt(table, cell_num);
 		DBG("pdc_pat_get_irt: %ld\n", status);
-		ASSERT(status == PDC_RET_OK);
+		ASSERT(status == PDC_OK);
 	} else {
 		/*
 		** C3000/J5000 (and similar) platforms with Sprockets PDC
@@ -376,7 +376,7 @@ iosapic_load_irt(unsigned long cell_num,
 		status = pdc_pci_irt_size(&num_entries, 0);
 		DBG("pdc_pci_irt_size: %ld\n", status);
 
-		if (PDC_RET_OK != status) {
+		if (PDC_OK != status) {
 			/* Not a "legacy" system with I/O SAPIC either */
 			return 0;
 		}
@@ -391,7 +391,7 @@ iosapic_load_irt(unsigned long cell_num,
 
 		/* HPA ignored by this call too. */
 		status = pdc_pci_irt(num_entries, 0, table);
-		ASSERT(PDC_RET_OK == status);
+		ASSERT(PDC_OK == status);
 	}
 
 	/* return interrupt table address */
@@ -443,7 +443,7 @@ iosapic_init(void)
 		struct pdc_pat_cell_num cell_info;
 
 		status = pdc_pat_cell_get_number(&cell_info);
-		if (status == PDC_RET_OK) {
+		if (status == PDC_OK) {
 			cell = cell_info.cell_num;
 		}
 	}
Index: include/asm-parisc/pdc.h
===================================================================
RCS file: /home/cvs/parisc/linux/include/asm-parisc/pdc.h,v
retrieving revision 1.33
diff -u -p -r1.33 pdc.h
--- include/asm-parisc/pdc.h	2001/10/04 00:17:52	1.33
+++ include/asm-parisc/pdc.h	2001/10/05 16:59:04
@@ -120,42 +120,22 @@
 #define PDC_PCI_GET_INT_TBL_SIZE	13UL
 #define PDC_PCI_GET_INT_TBL	     14UL
 
-/* generic error codes returned by all PDC-functions */
+/* All PDC calls return a subset of these errors. */
 
-#define PDC_WARN	    3  /* Call completed with a warning */
-#define PDC_REQ_ERR_1       2  /* See above */
-#define PDC_REQ_ERR_0       1  /* Call would generate a requestor error */
-#define PDC_OK	      0  /* Call completed successfully */
-#define PDC_BAD_PROC	   -1  /* Called non-existent procedure */
-#define PDC_BAD_OPTION     -2  /* Called with non-existent option */
-#define PDC_ERROR	  -3  /* Call could not complete without an error */
-#define PDC_INVALID_ARG   -10  /* Called with an invalid argument */
-#define PDC_BUS_POW_WARN  -12  /* Call could not complete in allowed power budget */
-
-
-/* The following are from the HPUX .h files, and are just for
-compatibility */
-
-#define PDC_RET_OK       0L	/* Call completed successfully */
-#define PDC_RET_NE_PROC -1L	/* Non-existent procedure */
-#define PDC_RET_NE_OPT  -2L	/* non-existent option - arg1 */
-#define PDC_RET_NE_MOD  -5L	/* Module not found */
-#define PDC_RET_NE_CELL_MOD -7L	/* Cell module not found */
-#define PDC_RET_INV_ARG	-10L	/* Invalid argument */
-#define PDC_RET_NOT_NARROW -17L /* Narrow mode not supported */
-
-
-/* Error codes for PDC_ADD_VALID */
-
-#define PDC_ADD_VALID_WARN	    3  /* Call completed with a warning */
-#define PDC_ADD_VALID_REQ_ERR_1       2  /* See above */
-#define PDC_ADD_VALID_REQ_ERR_0       1  /* Call would generate a requestor error */
-#define PDC_ADD_VALID_OK	      0  /* Call completed successfully */
-#define PDC_ADD_VALID_BAD_OPTION     -2  /* Called with non-existent option */
-#define PDC_ADD_VALID_ERROR	  -3  /* Call could not complete without an error */
-#define PDC_ADD_VALID_INVALID_ARG   -10  /* Called with an invalid argument */
-#define PDC_ADD_VALID_BUS_POW_WARN  -12  /* Call could not complete in allowed power budget */
+#define PDC_WARN		  3 /* Call completed with a warning */
+#define PDC_REQ_ERR_1		  2 /* See above */
+#define PDC_REQ_ERR_0		  1 /* Call would generate a requestor error */
+#define PDC_OK			  0 /* Call completed successfully */
+#define PDC_BAD_PROC		 -1 /* Called non-existent procedure */
+#define PDC_BAD_OPTION		 -2 /* Called with non-existent option */
+#define PDC_ERROR		 -3 /* Call could not complete without an error */
+#define PDC_NE_MOD		 -5 /* Module not found */
+#define PDC_NE_CELL_MOD		 -7 /* Cell module not found */
+#define PDC_INVALID_ARG		-10 /* Called with an invalid argument */
+#define PDC_BUS_POW_WARN	-12 /* Call could not complete in allowed power budget */
+#define PDC_NOT_NARROW		-17 /* Narrow mode not supported */
 
+
 /* The PDC_MEM_MAP calls */
 
 #define PDC_MEM_MAP	    128
@@ -879,8 +859,8 @@ int pdc_pat_pd_get_addr_map(unsigned lon
 
 #else /* !__LP64__ */
 /* No PAT support for 32-bit kernels...sorry */
-#define pdc_pat_get_irt_size(num_entries, cell_numn)	PDC_RET_NE_PROC
-#define pdc_pat_get_irt(r_addr, cell_num)	PDC_RET_NE_PROC
+#define pdc_pat_get_irt_size(num_entries, cell_numn)	PDC_BAD_PROC
+#define pdc_pat_get_irt(r_addr, cell_num)	PDC_BAD_PROC
 #endif /* !__LP64__ */
 
 extern void pdc_init(void);