Author: jkim
Date: Wed Jun 23 17:20:51 2010
New Revision: 209472
URL: http://svn.freebsd.org/changeset/base/209472

Log:
  Let x86bios_alloc() pass contigmalloc(9) flags.  Use it to set M_WAITOK
  from VESA BIOS initialization.  All other malloc(9) uses in the function is
  blocking any way.

Modified:
  head/sys/compat/x86bios/x86bios.c
  head/sys/compat/x86bios/x86bios.h
  head/sys/dev/fb/vesa.c

Modified: head/sys/compat/x86bios/x86bios.c
==============================================================================
--- head/sys/compat/x86bios/x86bios.c   Wed Jun 23 17:04:42 2010        
(r209471)
+++ head/sys/compat/x86bios/x86bios.c   Wed Jun 23 17:20:51 2010        
(r209472)
@@ -353,14 +353,14 @@ x86bios_emu_get_intr(struct x86emu *emu,
 }
 
 void *
-x86bios_alloc(uint32_t *offset, size_t size)
+x86bios_alloc(uint32_t *offset, size_t size, int flags)
 {
        void *vaddr;
 
        if (offset == NULL || size == 0)
                return (NULL);
 
-       vaddr = contigmalloc(size, M_DEVBUF, M_NOWAIT, X86BIOS_RAM_BASE,
+       vaddr = contigmalloc(size, M_DEVBUF, flags, X86BIOS_RAM_BASE,
            x86bios_rom_phys, X86BIOS_PAGE_SIZE, 0);
        if (vaddr != NULL) {
                *offset = vtophys(vaddr);

Modified: head/sys/compat/x86bios/x86bios.h
==============================================================================
--- head/sys/compat/x86bios/x86bios.h   Wed Jun 23 17:04:42 2010        
(r209471)
+++ head/sys/compat/x86bios/x86bios.h   Wed Jun 23 17:20:51 2010        
(r209472)
@@ -142,7 +142,7 @@ typedef struct x86regs      x86regs_t;
 #define        X86BIOS_PHYSTOOFF(x)    ((x) & 0x000f)
 
 __BEGIN_DECLS
-void   *x86bios_alloc(uint32_t *offset, size_t size);
+void   *x86bios_alloc(uint32_t *offset, size_t size, int flags);
 void    x86bios_call(struct x86regs *regs, uint16_t seg, uint16_t off);
 void    x86bios_free(void *addr, size_t size);
 uint32_t x86bios_get_intr(int intno);

Modified: head/sys/dev/fb/vesa.c
==============================================================================
--- head/sys/dev/fb/vesa.c      Wed Jun 23 17:04:42 2010        (r209471)
+++ head/sys/dev/fb/vesa.c      Wed Jun 23 17:20:51 2010        (r209472)
@@ -284,7 +284,7 @@ vesa_bios_get_mode(int mode, struct vesa
        uint32_t offs;
        void *buf;
 
-       buf = x86bios_alloc(&offs, sizeof(*vmode));
+       buf = x86bios_alloc(&offs, sizeof(*vmode), M_NOWAIT);
        if (buf == NULL)
                return (1);
 
@@ -367,7 +367,7 @@ vesa_bios_save_palette(int start, int co
        u_char *p;
        int i;
 
-       p = (u_char *)x86bios_alloc(&offs, colors * 4);
+       p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
        if (p == NULL)
                return (1);
 
@@ -407,7 +407,7 @@ vesa_bios_save_palette2(int start, int c
        u_char *p;
        int i;
 
-       p = (u_char *)x86bios_alloc(&offs, colors * 4);
+       p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
        if (p == NULL)
                return (1);
 
@@ -446,7 +446,7 @@ vesa_bios_load_palette(int start, int co
        u_char *p;
        int i;
 
-       p = (u_char *)x86bios_alloc(&offs, colors * 4);
+       p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
        if (p == NULL)
                return (1);
 
@@ -481,7 +481,7 @@ vesa_bios_load_palette2(int start, int c
        u_char *p;
        int i;
 
-       p = (u_char *)x86bios_alloc(&offs, colors * 4);
+       p = (u_char *)x86bios_alloc(&offs, colors * 4, M_NOWAIT);
        if (p == NULL)
                return (1);
 
@@ -535,7 +535,7 @@ vesa_bios_save_restore(int code, void *p
        if (code != STATE_SAVE && code != STATE_LOAD)
                return (1);
 
-       buf = x86bios_alloc(&offs, size);
+       buf = x86bios_alloc(&offs, size, M_NOWAIT);
 
        x86bios_init_regs(&regs);
        regs.R_AX = 0x4f04;
@@ -800,9 +800,7 @@ vesa_bios_init(void)
        x86bios_init_regs(&regs);
        regs.R_AX = 0x4f00;
 
-       vmbuf = x86bios_alloc(&offs, sizeof(*buf));
-       if (vmbuf == NULL)
-               return (1);
+       vmbuf = x86bios_alloc(&offs, sizeof(*buf), M_WAITOK);
 
        regs.R_ES = X86BIOS_PHYSTOSEG(offs);
        regs.R_DI = X86BIOS_PHYSTOOFF(offs);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to