2 * (C) Copyright 2000-2009
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #undef _LINUX_CONFIG_H
28 #define _LINUX_CONFIG_H 1 /* avoid reading Linux autoconf.h file */
30 #ifndef __ASSEMBLY__ /* put C only stuff in this section */
32 typedef unsigned char uchar;
33 typedef volatile unsigned long vu_long;
34 typedef volatile unsigned short vu_short;
35 typedef volatile unsigned char vu_char;
38 #include <linux/bitops.h>
39 #include <linux/types.h>
40 #include <linux/string.h>
41 #include <asm/ptrace.h>
43 #if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000))
46 #if defined(CONFIG_8xx)
47 #include <asm/8xx_immap.h>
48 #if defined(CONFIG_MPC852) || defined(CONFIG_MPC852T) || \
49 defined(CONFIG_MPC859) || defined(CONFIG_MPC859T) || \
50 defined(CONFIG_MPC859DSL) || \
51 defined(CONFIG_MPC866) || defined(CONFIG_MPC866T) || \
52 defined(CONFIG_MPC866P)
53 # define CONFIG_MPC866_FAMILY 1
54 #elif defined(CONFIG_MPC870) \
55 || defined(CONFIG_MPC875) \
56 || defined(CONFIG_MPC880) \
57 || defined(CONFIG_MPC885)
58 # define CONFIG_MPC885_FAMILY 1
60 #if defined(CONFIG_MPC860) \
61 || defined(CONFIG_MPC860T) \
62 || defined(CONFIG_MPC866_FAMILY) \
63 || defined(CONFIG_MPC885_FAMILY)
64 # define CONFIG_MPC86x 1
66 #elif defined(CONFIG_5xx)
67 #include <asm/5xx_immap.h>
68 #elif defined(CONFIG_MPC5xxx)
70 #elif defined(CONFIG_MPC512X)
71 #include <asm/immap_512x.h>
72 #elif defined(CONFIG_MPC8220)
73 #include <asm/immap_8220.h>
74 #elif defined(CONFIG_8260)
75 #if defined(CONFIG_MPC8247) \
76 || defined(CONFIG_MPC8248) \
77 || defined(CONFIG_MPC8271) \
78 || defined(CONFIG_MPC8272)
79 #define CONFIG_MPC8272_FAMILY 1
81 #if defined(CONFIG_MPC8272_FAMILY)
82 #define CONFIG_MPC8260 1
84 #include <asm/immap_8260.h>
88 #include <asm/immap_86xx.h>
92 #include <asm/immap_85xx.h>
96 #include <asm/immap_83xx.h>
99 #include <asm/ppc4xx.h>
102 #include <board/hymod/hymod.h>
105 #define asmlinkage /* nothing */
107 #ifdef CONFIG_BLACKFIN
108 #include <asm/blackfin.h>
110 #ifdef CONFIG_SOC_DA8XX
111 #include <asm/arch/hardware.h>
119 #define debug(fmt,args...) printf (fmt ,##args)
120 #define debugX(level,fmt,args...) if (DEBUG>=level) printf(fmt,##args);
122 #define debug(fmt,args...)
123 #define debugX(level,fmt,args...)
126 #define error(fmt, args...) do { \
127 printf("ERROR: " fmt "\nat %s:%d/%s()\n", \
128 ##args, __FILE__, __LINE__, __func__); \
133 printf("BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
136 #define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
139 typedef void (interrupt_handler_t)(void *);
141 #include <asm/u-boot.h> /* boot information for Linux kernel */
142 #include <asm/global_data.h> /* global data used for startup functions */
145 * enable common handling for all TQM8xxL/M boards:
146 * - CONFIG_TQM8xxM will be defined for all TQM8xxM boards
147 * - CONFIG_TQM8xxL will be defined for all TQM8xxL _and_ TQM8xxM boards
148 * and for the TQM885D board
150 #if defined(CONFIG_TQM823M) || defined(CONFIG_TQM850M) || \
151 defined(CONFIG_TQM855M) || defined(CONFIG_TQM860M) || \
152 defined(CONFIG_TQM862M) || defined(CONFIG_TQM866M)
153 # ifndef CONFIG_TQM8xxM
154 # define CONFIG_TQM8xxM
157 #if defined(CONFIG_TQM823L) || defined(CONFIG_TQM850L) || \
158 defined(CONFIG_TQM855L) || defined(CONFIG_TQM860L) || \
159 defined(CONFIG_TQM862L) || defined(CONFIG_TQM8xxM) || \
160 defined(CONFIG_TQM885D)
161 # ifndef CONFIG_TQM8xxL
162 # define CONFIG_TQM8xxL
166 #ifndef CONFIG_SERIAL_MULTI
168 #if defined(CONFIG_8xx_CONS_SMC1) || defined(CONFIG_8xx_CONS_SMC2) \
169 || defined(CONFIG_8xx_CONS_SCC1) || defined(CONFIG_8xx_CONS_SCC2) \
170 || defined(CONFIG_8xx_CONS_SCC3) || defined(CONFIG_8xx_CONS_SCC4)
172 #define CONFIG_SERIAL_MULTI 1
176 #endif /* CONFIG_SERIAL_MULTI */
179 * General Purpose Utilities
182 ({ typeof (X) __x = (X), __y = (Y); \
183 (__x < __y) ? __x : __y; })
186 ({ typeof (X) __x = (X), __y = (Y); \
187 (__x > __y) ? __x : __y; })
189 #define MIN(x, y) min(x, y)
190 #define MAX(x, y) max(x, y)
192 #if defined(CONFIG_ENV_IS_EMBEDDED)
193 #define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
194 #elif ( ((CONFIG_ENV_ADDR+CONFIG_ENV_SIZE) < CONFIG_SYS_MONITOR_BASE) || \
195 (CONFIG_ENV_ADDR >= (CONFIG_SYS_MONITOR_BASE + CONFIG_SYS_MONITOR_LEN)) ) || \
196 defined(CONFIG_ENV_IS_IN_NVRAM)
197 #define TOTAL_MALLOC_LEN (CONFIG_SYS_MALLOC_LEN + CONFIG_ENV_SIZE)
199 #define TOTAL_MALLOC_LEN CONFIG_SYS_MALLOC_LEN
203 * container_of - cast a member of a structure out to the containing structure
204 * @ptr: the pointer to the member.
205 * @type: the type of the container struct this is embedded in.
206 * @member: the name of the member within the struct.
209 #define container_of(ptr, type, member) ({ \
210 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
211 (type *)( (char *)__mptr - offsetof(type,member) );})
214 * Function Prototypes
217 #ifdef CONFIG_SERIAL_SOFTWARE_FIFO
218 void serial_buffered_init (void);
219 void serial_buffered_putc (const char);
220 void serial_buffered_puts (const char *);
221 int serial_buffered_getc (void);
222 int serial_buffered_tstc (void);
223 #endif /* CONFIG_SERIAL_SOFTWARE_FIFO */
225 void hang (void) __attribute__ ((noreturn));
228 phys_size_t initdram (int);
229 int display_options (void);
230 void print_size(unsigned long long, const char *);
231 int print_buffer (ulong addr, void* data, uint width, uint count, uint linelen);
234 void main_loop (void);
235 int run_command (const char *cmd, int flag);
236 int readline (const char *const prompt);
237 int readline_into_buffer (const char *const prompt, char * buffer);
238 int parse_line (char *, char *[]);
239 void init_cmd_timeout(void);
240 void reset_cmd_timeout(void);
242 /* arch/$(ARCH)/lib/board.c */
243 void board_init_f (ulong) __attribute__ ((noreturn));
244 void board_init_r (gd_t *, ulong) __attribute__ ((noreturn));
245 int checkboard (void);
246 int checkflash (void);
247 int checkdram (void);
248 int last_stage_init(void);
249 extern ulong monitor_flash_len;
250 int mac_read_from_eeprom(void);
253 void flash_perror (int);
255 /* common/cmd_source.c */
256 int source (ulong addr, const char *fit_uname);
258 extern ulong load_addr; /* Default Load Address */
260 /* common/cmd_doc.c */
261 void doc_probe(unsigned long physadr);
263 /* common/cmd_nvedit.c */
265 void env_relocate (void);
266 int envmatch (uchar *, int);
267 char *getenv (char *);
268 int getenv_f (char *name, char *buf, unsigned len);
270 #ifdef CONFIG_PPC /* ARM version to be fixed! */
271 int inline setenv (char *, char *);
273 int setenv (char *, char *);
274 #endif /* CONFIG_PPC */
276 # include <asm/mach-types.h>
277 # include <asm/setup.h>
278 # include <asm/u-boot-arm.h> /* ARM version to be fixed! */
279 #endif /* CONFIG_ARM */
280 #ifdef CONFIG_I386 /* x86 version to be fixed! */
281 # include <asm/u-boot-i386.h>
282 #endif /* CONFIG_I386 */
284 #ifdef CONFIG_AUTO_COMPLETE
285 int env_complete(char *var, int maxv, char *cmdv[], int maxsz, char *buf);
287 int get_env_id (void);
289 void pci_init (void);
290 void pci_init_board(void);
291 void pciinfo (int, int);
293 #if defined(CONFIG_PCI) && (defined(CONFIG_4xx) && !defined(CONFIG_AP1000))
294 int pci_pre_init (struct pci_controller *);
295 int is_pci_host (struct pci_controller *);
298 #if defined(CONFIG_PCI) && (defined(CONFIG_440) || defined(CONFIG_405EX))
299 # if defined(CONFIG_SYS_PCI_TARGET_INIT)
300 void pci_target_init (struct pci_controller *);
302 # if defined(CONFIG_SYS_PCI_MASTER_INIT)
303 void pci_master_init (struct pci_controller *);
305 #if defined(CONFIG_440SPE) || \
306 defined(CONFIG_460EX) || defined(CONFIG_460GT) || \
307 defined(CONFIG_405EX)
308 void pcie_setup_hoses(int busno);
312 int misc_init_f (void);
313 int misc_init_r (void);
315 /* common/exports.c */
316 void jumptable_init(void);
318 /* common/kallsysm.c */
319 const char *symbol_lookup(unsigned long addr, unsigned long *caddr);
322 void api_init (void);
324 /* common/memsize.c */
325 long get_ram_size (volatile long *, long);
327 /* $(BOARD)/$(BOARD).c */
328 void reset_phy (void);
329 void fdc_hw_init (void);
331 /* $(BOARD)/eeprom.c */
332 void eeprom_init (void);
334 int eeprom_probe (unsigned dev_addr, unsigned offset);
336 int eeprom_read (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
337 int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cnt);
339 extern uchar pic_read (uchar reg);
340 extern void pic_write (uchar reg, uchar val);
344 * Set this up regardless of board
345 * type, to prevent errors.
347 #if defined(CONFIG_SPI) || !defined(CONFIG_SYS_I2C_EEPROM_ADDR)
348 # define CONFIG_SYS_DEF_EEPROM_ADDR 0
350 #if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
351 # define CONFIG_SYS_DEF_EEPROM_ADDR CONFIG_SYS_I2C_EEPROM_ADDR
353 #endif /* CONFIG_SPI || !defined(CONFIG_SYS_I2C_EEPROM_ADDR) */
355 #if defined(CONFIG_SPI)
356 extern void spi_init_f (void);
357 extern void spi_init_r (void);
358 extern ssize_t spi_read (uchar *, int, uchar *, int);
359 extern ssize_t spi_write (uchar *, int, uchar *, int);
362 #ifdef CONFIG_RPXCLASSIC
363 void rpxclassic_init (void);
366 void rpxlite_init (void);
369 /* $(BOARD)/mbx8xx.c */
370 void mbx_init (void);
371 void board_serial_init (void);
372 void board_ether_init (void);
376 /* $(BOARD)/hermes.c */
377 void hermes_start_lxt980 (int speed);
380 #ifdef CONFIG_EVB64260
381 void evb64260_init(void);
382 void debug_led(int, int);
383 void display_mem_map(void);
384 void perform_soft_reset(void);
387 /* $(BOARD)/$(BOARD).c */
388 int board_early_init_f (void);
389 int board_late_init (void);
390 int board_postclk_init (void); /* after clocks/timebase, before env/serial */
391 int board_early_init_r (void);
392 void board_poweroff (void);
394 #if defined(CONFIG_SYS_DRAM_TEST)
396 #endif /* CONFIG_SYS_DRAM_TEST */
399 #if defined(CONFIG_5xx) || \
401 uint get_immr (uint);
404 #if defined(CONFIG_MPC5xxx)
409 uint rd_ic_cst (void);
410 void wr_ic_cst (uint);
411 void wr_ic_adr (uint);
412 uint rd_dc_cst (void);
413 void wr_dc_cst (uint);
414 void wr_dc_adr (uint);
415 int icache_status (void);
416 void icache_enable (void);
417 void icache_disable(void);
418 int dcache_status (void);
419 void dcache_enable (void);
420 void dcache_disable(void);
421 void relocate_code (ulong, gd_t *, ulong) __attribute__ ((noreturn));
422 ulong get_endaddr (void);
423 void trap_init (ulong);
424 #if defined (CONFIG_4xx) || \
425 defined (CONFIG_MPC5xxx) || \
426 defined (CONFIG_74xx_7xx) || \
427 defined (CONFIG_74x) || \
428 defined (CONFIG_75x) || \
429 defined (CONFIG_74xx) || \
430 defined (CONFIG_MPC8220) || \
431 defined (CONFIG_MPC85xx) || \
432 defined (CONFIG_MPC86xx) || \
433 defined (CONFIG_MPC83xx)
434 unsigned char in8(unsigned int);
435 void out8(unsigned int, unsigned char);
436 unsigned short in16(unsigned int);
437 unsigned short in16r(unsigned int);
438 void out16(unsigned int, unsigned short value);
439 void out16r(unsigned int, unsigned short value);
440 unsigned long in32(unsigned int);
441 unsigned long in32r(unsigned int);
442 void out32(unsigned int, unsigned long value);
443 void out32r(unsigned int, unsigned long value);
444 void ppcDcbf(unsigned long value);
445 void ppcDcbi(unsigned long value);
447 void ppcDcbz(unsigned long value);
449 #if defined (CONFIG_MICROBLAZE)
450 unsigned short in16(unsigned int);
451 void out16(unsigned int, unsigned short value);
454 #if defined (CONFIG_MPC83xx)
455 void ppcDWload(unsigned int *addr, unsigned int *ret);
456 void ppcDWstore(unsigned int *addr, unsigned int *value);
460 int cpu_numcores (void);
463 int checkicache (void);
464 int checkdcache (void);
465 void upmconfig (unsigned int, unsigned int *, unsigned int);
466 ulong get_tbclk (void);
467 void reset_cpu (ulong addr);
468 #if defined (CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
469 void ft_cpu_setup(void *blob, bd_t *bd);
471 void ft_pci_setup(void *blob, bd_t *bd);
476 /* $(CPU)/serial.c */
477 int serial_init (void);
478 void serial_exit (void);
479 void serial_setbrg (void);
480 void serial_putc (const char);
481 void serial_putc_raw(const char);
482 void serial_puts (const char *);
483 int serial_getc (void);
484 int serial_tstc (void);
486 void _serial_setbrg (const int);
487 void _serial_putc (const char, const int);
488 void _serial_putc_raw(const char, const int);
489 void _serial_puts (const char *, const int);
490 int _serial_getc (const int);
491 int _serial_tstc (const int);
494 int get_clocks (void);
495 int get_clocks_866 (void);
496 int sdram_adjust_866 (void);
497 int adjust_sdram_tbs_8xx (void);
498 #if defined(CONFIG_8260)
499 int prt_8260_clks (void);
500 #elif defined(CONFIG_MPC5xxx)
501 int prt_mpc5xxx_clks (void);
503 #if defined(CONFIG_MPC512X)
504 int prt_mpc512xxx_clks (void);
506 #if defined(CONFIG_MPC8220)
507 int prt_mpc8220_clks (void);
510 ulong get_OPB_freq (void);
511 ulong get_PCI_freq (void);
513 #if defined(CONFIG_S3C24X0) || \
514 defined(CONFIG_LH7A40X) || \
515 defined(CONFIG_S3C6400) || \
516 defined(CONFIG_EP93XX)
517 ulong get_FCLK (void);
518 ulong get_HCLK (void);
519 ulong get_PCLK (void);
520 ulong get_UCLK (void);
522 #if defined(CONFIG_LH7A40X)
523 ulong get_PLLCLK (void);
525 #if defined CONFIG_INCA_IP
526 uint incaip_get_cpuclk (void);
528 #if defined(CONFIG_IMX)
529 ulong get_systemPLLCLK(void);
530 ulong get_FCLK(void);
531 ulong get_HCLK(void);
532 ulong get_BCLK(void);
533 ulong get_PERCLK1(void);
534 ulong get_PERCLK2(void);
535 ulong get_PERCLK3(void);
537 ulong get_bus_freq (ulong);
538 int get_serial_clock(void);
540 #if defined(CONFIG_MPC85xx)
541 typedef MPC85xx_SYS_INFO sys_info_t;
542 void get_sys_info ( sys_info_t * );
543 ulong get_ddr_freq (ulong);
545 #if defined(CONFIG_MPC86xx)
546 typedef MPC86xx_SYS_INFO sys_info_t;
547 void get_sys_info ( sys_info_t * );
550 #if defined(CONFIG_4xx) || defined(CONFIG_IOP480)
551 # if defined(CONFIG_440)
552 # if defined(CONFIG_440SPE)
553 unsigned long determine_sysper(void);
554 unsigned long determine_pci_clock_per(void);
557 typedef PPC4xx_SYS_INFO sys_info_t;
558 int ppc440spe_revB(void);
559 void get_sys_info ( sys_info_t * );
562 /* $(CPU)/cpu_init.c */
563 #if defined(CONFIG_8xx) || defined(CONFIG_8260)
564 void cpu_init_f (volatile immap_t *immr);
566 #if defined(CONFIG_4xx) || defined(CONFIG_MPC85xx) || defined(CONFIG_MCF52x2) ||defined(CONFIG_MPC86xx)
567 void cpu_init_f (void);
570 int cpu_init_r (void);
571 #if defined(CONFIG_8260)
572 int prt_8260_rsr (void);
573 #elif defined(CONFIG_MPC83xx)
574 int prt_83xx_rsr (void);
577 /* $(CPU)/interrupts.c */
578 int interrupt_init (void);
579 void timer_interrupt (struct pt_regs *);
580 void external_interrupt (struct pt_regs *);
581 void irq_install_handler(int, interrupt_handler_t *, void *);
582 void irq_free_handler (int);
583 void reset_timer (void);
584 ulong get_timer (ulong base);
585 void set_timer (ulong t);
586 void enable_interrupts (void);
587 int disable_interrupts (void);
589 /* $(CPU)/.../commproc.c */
590 int dpram_init (void);
591 uint dpram_base(void);
592 uint dpram_base_align(uint align);
593 uint dpram_alloc(uint size);
594 uint dpram_alloc_align(uint size,uint align);
595 void post_word_store (ulong);
596 ulong post_word_load (void);
597 void bootcount_store (ulong);
598 ulong bootcount_load (void);
599 #define BOOTCOUNT_MAGIC 0xB001C041
601 /* $(CPU)/.../<eth> */
602 void mii_init (void);
604 /* $(CPU)/.../lcd.c */
605 ulong lcd_setmem (ulong);
607 /* $(CPU)/.../vfd.c */
608 ulong vfd_setmem (ulong);
610 /* $(CPU)/.../video.c */
611 ulong video_setmem (ulong);
613 /* arch/$(ARCH)/lib/cache.c */
614 void flush_cache (unsigned long, unsigned long);
615 void flush_dcache_range(unsigned long start, unsigned long stop);
616 void invalidate_dcache_range(unsigned long start, unsigned long stop);
619 /* arch/$(ARCH)/lib/ticks.S */
620 unsigned long long get_ticks(void);
621 void wait_ticks (unsigned long);
623 /* arch/$(ARCH)/lib/time.c */
624 void __udelay (unsigned long);
625 ulong usec2ticks (unsigned long usec);
626 ulong ticks2usec (unsigned long ticks);
627 int init_timebase (void);
630 int gunzip(void *, int, unsigned char *, unsigned long *);
631 int zunzip(void *dst, int dstlen, unsigned char *src, unsigned long *lenp,
632 int stoponerr, int offset);
634 /* lib/net_utils.c */
636 static inline IPaddr_t getenv_IPaddr (char *var)
638 return (string_to_ip(getenv(var)));
642 void qsort(void *base, size_t nmemb, size_t size,
643 int(*compar)(const void *, const void *));
646 void udelay (unsigned long);
649 ulong simple_strtoul(const char *cp,char **endp,unsigned int base);
650 unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
651 long simple_strtol(const char *cp,char **endp,unsigned int base);
652 void panic(const char *fmt, ...)
653 __attribute__ ((format (__printf__, 1, 2)));
654 int sprintf(char * buf, const char *fmt, ...)
655 __attribute__ ((format (__printf__, 2, 3)));
656 int vsprintf(char *buf, const char *fmt, va_list args);
659 char * strmhz(char *buf, long hz);
662 #include <u-boot/crc.h>
664 /* common/console.c */
665 int console_init_f(void); /* Before relocation; uses the serial stuff */
666 int console_init_r(void); /* After relocation; uses the console stuff */
667 int console_assign (int file, char *devname); /* Assign the console */
669 int had_ctrlc (void); /* have we had a Control-C since last clear? */
670 void clear_ctrlc (void); /* clear the Control-C condition */
671 int disable_ctrlc (int); /* 1 to disable, 0 to enable Control-C detect */
674 * STDIO based functions (can always be used)
677 int serial_printf (const char *fmt, ...)
678 __attribute__ ((format (__printf__, 1, 2)));
684 void putc(const char c);
685 void puts(const char *s);
686 int printf(const char *fmt, ...)
687 __attribute__ ((format (__printf__, 1, 2)));
688 int vprintf(const char *fmt, va_list args);
691 #define eputc(c) fputc(stderr, c)
692 #define eputs(s) fputs(stderr, s)
693 #define eprintf(fmt,args...) fprintf(stderr,fmt ,##args)
696 * FILE based functions (can only be used AFTER relocation!)
703 int fprintf(int file, const char *fmt, ...)
704 __attribute__ ((format (__printf__, 2, 3)));
705 void fputs(int file, const char *s);
706 void fputc(int file, const char c);
711 * CONSOLE multiplexing.
713 #ifdef CONFIG_CONSOLE_MUX
717 int pcmcia_init (void);
719 #ifdef CONFIG_STATUS_LED
720 # include <status_led.h>
723 * Board-specific Platform code can reimplement show_boot_progress () if needed
725 void show_boot_progress(int val);
727 /* Multicore arch functions */
729 int cpu_status(int nr);
730 int cpu_reset(int nr);
731 int cpu_disable(int nr);
732 int cpu_release(int nr, int argc, char * const argv[]);
735 #endif /* __ASSEMBLY__ */
737 /* Put only stuff here that the assembler can digest */
740 #define CONFIG_HAS_POST
743 #ifdef CONFIG_INIT_CRITICAL
744 #error CONFIG_INIT_CRITICAL is deprecated!
745 #error Read section CONFIG_SKIP_LOWLEVEL_INIT in README.
748 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
750 #define ROUND(a,b) (((a) + (b)) & ~((b) - 1))
751 #define DIV_ROUND(n,d) (((n) + ((d)/2)) / (d))
752 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
753 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
755 #define ALIGN(x,a) __ALIGN_MASK((x),(typeof(x))(a)-1)
756 #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
758 #endif /* __COMMON_H_ */