drivers/usb/misc/sisusbvga/sisusb.c:1878:12: warning: stack frame size (16672) exceeds limit (8192) in function 'sisusb_init_gfxcore'

From: kernel test robot
Date: Wed Jul 14 2021 - 13:09:13 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 40226a3d96ef8ab8980f032681c8bfd46d63874e
commit: 02c587733c8161355a43e6e110c2e29bd0acff72 kasan: remove redundant config option
date: 3 months ago
config: powerpc-randconfig-r022-20210714 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 8d69635ed9ecf36fd0ca85906bfde17949671cbe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=02c587733c8161355a43e6e110c2e29bd0acff72
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 02c587733c8161355a43e6e110c2e29bd0acff72
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/usb/misc/sisusbvga/sisusb.c:50:
In file included from include/linux/usb.h:16:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:216:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/usb/misc/sisusbvga/sisusb.c:50:
In file included from include/linux/usb.h:16:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:218:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/usb/misc/sisusbvga/sisusb.c:50:
In file included from include/linux/usb.h:16:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:220:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/usb/misc/sisusbvga/sisusb.c:50:
In file included from include/linux/usb.h:16:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:222:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/usb/misc/sisusbvga/sisusb.c:50:
In file included from include/linux/usb.h:16:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:10:
In file included from arch/powerpc/include/asm/hardirq.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:224:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> drivers/usb/misc/sisusbvga/sisusb.c:1878:12: warning: stack frame size (16672) exceeds limit (8192) in function 'sisusb_init_gfxcore' [-Wframe-larger-than]
static int sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
^
>> drivers/usb/misc/sisusbvga/sisusb.c:1750:13: warning: stack frame size (8224) exceeds limit (8192) in function 'sisusb_set_default_mode' [-Wframe-larger-than]
static void sisusb_set_default_mode(struct sisusb_usb_data *sisusb,
^
9 warnings generated.


vim +/sisusb_init_gfxcore +1878 drivers/usb/misc/sisusbvga/sisusb.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1749
a3fe2605a60d1d Hariprasad Kelam 2019-06-09 @1750 static void sisusb_set_default_mode(struct sisusb_usb_data *sisusb,
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1751 int touchengines)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1752 {
a3fe2605a60d1d Hariprasad Kelam 2019-06-09 1753 int i, j, modex, bpp, du;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1754 u8 sr31, cr63, tmp8;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1755 static const char attrdata[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1756 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1757 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1758 0x01, 0x00, 0x00, 0x00
^1da177e4c3f41 Linus Torvalds 2005-04-16 1759 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1760 static const char crtcrdata[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1761 0x5f, 0x4f, 0x50, 0x82, 0x54, 0x80, 0x0b, 0x3e,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1762 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1763 0xea, 0x8c, 0xdf, 0x28, 0x40, 0xe7, 0x04, 0xa3,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1764 0xff
^1da177e4c3f41 Linus Torvalds 2005-04-16 1765 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1766 static const char grcdata[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1767 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x05, 0x0f,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1768 0xff
^1da177e4c3f41 Linus Torvalds 2005-04-16 1769 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1770 static const char crtcdata[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1771 0x5f, 0x4f, 0x4f, 0x83, 0x55, 0x81, 0x0b, 0x3e,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1772 0xe9, 0x8b, 0xdf, 0xe8, 0x0c, 0x00, 0x00, 0x05,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1773 0x00
^1da177e4c3f41 Linus Torvalds 2005-04-16 1774 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1775
795a8075e9a53f Colin Ian King 2018-07-13 1776 modex = 640; bpp = 2;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1777
^1da177e4c3f41 Linus Torvalds 2005-04-16 1778 GETIREG(SISSR, 0x31, &sr31);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1779 GETIREG(SISCR, 0x63, &cr63);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1780 SETIREGOR(SISSR, 0x01, 0x20);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1781 SETIREG(SISCR, 0x63, cr63 & 0xbf);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1782 SETIREGOR(SISCR, 0x17, 0x80);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1783 SETIREGOR(SISSR, 0x1f, 0x04);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1784 SETIREGAND(SISSR, 0x07, 0xfb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1785 SETIREG(SISSR, 0x00, 0x03); /* seq */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1786 SETIREG(SISSR, 0x01, 0x21);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1787 SETIREG(SISSR, 0x02, 0x0f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1788 SETIREG(SISSR, 0x03, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1789 SETIREG(SISSR, 0x04, 0x0e);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1790 SETREG(SISMISCW, 0x23); /* misc */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1791 for (i = 0; i <= 0x18; i++) { /* crtc */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1792 SETIREG(SISCR, i, crtcrdata[i]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1793 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1794 for (i = 0; i <= 0x13; i++) { /* att */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1795 GETREG(SISINPSTAT, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1796 SETREG(SISAR, i);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1797 SETREG(SISAR, attrdata[i]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1798 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1799 GETREG(SISINPSTAT, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1800 SETREG(SISAR, 0x14);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1801 SETREG(SISAR, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1802 GETREG(SISINPSTAT, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1803 SETREG(SISAR, 0x20);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1804 GETREG(SISINPSTAT, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1805 for (i = 0; i <= 0x08; i++) { /* grc */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1806 SETIREG(SISGR, i, grcdata[i]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1807 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1808 SETIREGAND(SISGR, 0x05, 0xbf);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1809 for (i = 0x0A; i <= 0x0E; i++) { /* clr ext */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1810 SETIREG(SISSR, i, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1811 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1812 SETIREGAND(SISSR, 0x37, 0xfe);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1813 SETREG(SISMISCW, 0xef); /* sync */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1814 SETIREG(SISCR, 0x11, 0x00); /* crtc */
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1815 for (j = 0x00, i = 0; i <= 7; i++, j++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1816 SETIREG(SISCR, j, crtcdata[i]);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1817
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1818 for (j = 0x10; i <= 10; i++, j++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1819 SETIREG(SISCR, j, crtcdata[i]);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1820
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1821 for (j = 0x15; i <= 12; i++, j++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1822 SETIREG(SISCR, j, crtcdata[i]);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1823
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1824 for (j = 0x0A; i <= 15; i++, j++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1825 SETIREG(SISSR, j, crtcdata[i]);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1826
^1da177e4c3f41 Linus Torvalds 2005-04-16 1827 SETIREG(SISSR, 0x0E, (crtcdata[16] & 0xE0));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1828 SETIREGANDOR(SISCR, 0x09, 0x5f, ((crtcdata[16] & 0x01) << 5));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1829 SETIREG(SISCR, 0x14, 0x4f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1830 du = (modex / 16) * (bpp * 2); /* offset/pitch */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1831 SETIREGANDOR(SISSR, 0x0e, 0xf0, ((du >> 8) & 0x0f));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1832 SETIREG(SISCR, 0x13, (du & 0xff));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1833 du <<= 5;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1834 tmp8 = du >> 8;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1835 SETIREG(SISSR, 0x10, tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1836 SETIREG(SISSR, 0x31, 0x00); /* VCLK */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1837 SETIREG(SISSR, 0x2b, 0x1b);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1838 SETIREG(SISSR, 0x2c, 0xe1);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1839 SETIREG(SISSR, 0x2d, 0x01);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1840 SETIREGAND(SISSR, 0x3d, 0xfe); /* FIFO */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1841 SETIREG(SISSR, 0x08, 0xae);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1842 SETIREGAND(SISSR, 0x09, 0xf0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1843 SETIREG(SISSR, 0x08, 0x34);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1844 SETIREGOR(SISSR, 0x3d, 0x01);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1845 SETIREGAND(SISSR, 0x1f, 0x3f); /* mode regs */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1846 SETIREGANDOR(SISSR, 0x06, 0xc0, 0x0a);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1847 SETIREG(SISCR, 0x19, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1848 SETIREGAND(SISCR, 0x1a, 0xfc);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1849 SETIREGAND(SISSR, 0x0f, 0xb7);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1850 SETIREGAND(SISSR, 0x31, 0xfb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1851 SETIREGANDOR(SISSR, 0x21, 0x1f, 0xa0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1852 SETIREGAND(SISSR, 0x32, 0xf3);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1853 SETIREGANDOR(SISSR, 0x07, 0xf8, 0x03);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1854 SETIREG(SISCR, 0x52, 0x6c);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1855
^1da177e4c3f41 Linus Torvalds 2005-04-16 1856 SETIREG(SISCR, 0x0d, 0x00); /* adjust frame */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1857 SETIREG(SISCR, 0x0c, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1858 SETIREG(SISSR, 0x0d, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1859 SETIREGAND(SISSR, 0x37, 0xfe);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1860
^1da177e4c3f41 Linus Torvalds 2005-04-16 1861 SETIREG(SISCR, 0x32, 0x20);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1862 SETIREGAND(SISSR, 0x01, 0xdf); /* enable display */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1863 SETIREG(SISCR, 0x63, (cr63 & 0xbf));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1864 SETIREG(SISSR, 0x31, (sr31 & 0xfb));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1865
^1da177e4c3f41 Linus Torvalds 2005-04-16 1866 if (touchengines) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1867 SETIREG(SISSR, 0x20, 0xa1); /* enable engines */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1868 SETIREGOR(SISSR, 0x1e, 0x5a);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1869
^1da177e4c3f41 Linus Torvalds 2005-04-16 1870 SETIREG(SISSR, 0x26, 0x01); /* disable cmdqueue */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1871 SETIREG(SISSR, 0x27, 0x1f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1872 SETIREG(SISSR, 0x26, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1873 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1874
^1da177e4c3f41 Linus Torvalds 2005-04-16 1875 SETIREG(SISCR, 0x34, 0x44); /* we just set std mode #44 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1876 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1877
06e21efa2d344b Peter Senna Tschudin 2016-01-15 @1878 static int sisusb_init_gfxcore(struct sisusb_usb_data *sisusb)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1879 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1880 int ret = 0, i, j, bw, chab, iret, retry = 3;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1881 u8 tmp8, ramtype;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1882 u32 tmp32;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1883 static const char mclktable[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1884 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1885 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1886 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1887 0x3b, 0x22, 0x01, 143
^1da177e4c3f41 Linus Torvalds 2005-04-16 1888 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1889 static const char eclktable[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1890 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1891 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1892 0x3b, 0x22, 0x01, 143,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1893 0x3b, 0x22, 0x01, 143
^1da177e4c3f41 Linus Torvalds 2005-04-16 1894 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1895 static const char ramtypetable1[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1896 0x00, 0x04, 0x60, 0x60,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1897 0x0f, 0x0f, 0x1f, 0x1f,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1898 0xba, 0xba, 0xba, 0xba,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1899 0xa9, 0xa9, 0xac, 0xac,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1900 0xa0, 0xa0, 0xa0, 0xa8,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1901 0x00, 0x00, 0x02, 0x02,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1902 0x30, 0x30, 0x40, 0x40
^1da177e4c3f41 Linus Torvalds 2005-04-16 1903 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1904 static const char ramtypetable2[] = {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1905 0x77, 0x77, 0x44, 0x44,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1906 0x77, 0x77, 0x44, 0x44,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1907 0x00, 0x00, 0x00, 0x00,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1908 0x5b, 0x5b, 0xab, 0xab,
^1da177e4c3f41 Linus Torvalds 2005-04-16 1909 0x00, 0x00, 0xf0, 0xf8
^1da177e4c3f41 Linus Torvalds 2005-04-16 1910 };
^1da177e4c3f41 Linus Torvalds 2005-04-16 1911
^1da177e4c3f41 Linus Torvalds 2005-04-16 1912 while (retry--) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 1913
^1da177e4c3f41 Linus Torvalds 2005-04-16 1914 /* Enable VGA */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1915 ret = GETREG(SISVGAEN, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1916 ret |= SETREG(SISVGAEN, (tmp8 | 0x01));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1917
^1da177e4c3f41 Linus Torvalds 2005-04-16 1918 /* Enable GPU access to VRAM */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1919 ret |= GETREG(SISMISCR, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1920 ret |= SETREG(SISMISCW, (tmp8 | 0x01));
^1da177e4c3f41 Linus Torvalds 2005-04-16 1921
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1922 if (ret)
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1923 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1924
^1da177e4c3f41 Linus Torvalds 2005-04-16 1925 /* Reset registers */
^1da177e4c3f41 Linus Torvalds 2005-04-16 1926 ret |= SETIREGAND(SISCR, 0x5b, 0xdf);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1927 ret |= SETIREG(SISSR, 0x05, 0x86);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1928 ret |= SETIREGOR(SISSR, 0x20, 0x01);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1929
^1da177e4c3f41 Linus Torvalds 2005-04-16 1930 ret |= SETREG(SISMISCW, 0x67);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1931
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1932 for (i = 0x06; i <= 0x1f; i++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1933 ret |= SETIREG(SISSR, i, 0x00);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1934
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1935 for (i = 0x21; i <= 0x27; i++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1936 ret |= SETIREG(SISSR, i, 0x00);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1937
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1938 for (i = 0x31; i <= 0x3d; i++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1939 ret |= SETIREG(SISSR, i, 0x00);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1940
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1941 for (i = 0x12; i <= 0x1b; i++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1942 ret |= SETIREG(SISSR, i, 0x00);
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1943
f996c49d4fa4e8 Peter Senna Tschudin 2016-01-15 1944 for (i = 0x79; i <= 0x7c; i++)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1945 ret |= SETIREG(SISCR, i, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1946
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1947 if (ret)
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1948 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1949
^1da177e4c3f41 Linus Torvalds 2005-04-16 1950 ret |= SETIREG(SISCR, 0x63, 0x80);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1951
^1da177e4c3f41 Linus Torvalds 2005-04-16 1952 ret |= GETIREG(SISSR, 0x3a, &ramtype);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1953 ramtype &= 0x03;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1954
^1da177e4c3f41 Linus Torvalds 2005-04-16 1955 ret |= SETIREG(SISSR, 0x28, mclktable[ramtype * 4]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1956 ret |= SETIREG(SISSR, 0x29, mclktable[(ramtype * 4) + 1]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1957 ret |= SETIREG(SISSR, 0x2a, mclktable[(ramtype * 4) + 2]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1958
^1da177e4c3f41 Linus Torvalds 2005-04-16 1959 ret |= SETIREG(SISSR, 0x2e, eclktable[ramtype * 4]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1960 ret |= SETIREG(SISSR, 0x2f, eclktable[(ramtype * 4) + 1]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1961 ret |= SETIREG(SISSR, 0x30, eclktable[(ramtype * 4) + 2]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1962
^1da177e4c3f41 Linus Torvalds 2005-04-16 1963 ret |= SETIREG(SISSR, 0x07, 0x18);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1964 ret |= SETIREG(SISSR, 0x11, 0x0f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1965
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1966 if (ret)
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1967 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1968
^1da177e4c3f41 Linus Torvalds 2005-04-16 1969 for (i = 0x15, j = 0; i <= 0x1b; i++, j++) {
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1970 ret |= SETIREG(SISSR, i,
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1971 ramtypetable1[(j*4) + ramtype]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1972 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1973 for (i = 0x40, j = 0; i <= 0x44; i++, j++) {
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1974 ret |= SETIREG(SISCR, i,
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1975 ramtypetable2[(j*4) + ramtype]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1976 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1977
^1da177e4c3f41 Linus Torvalds 2005-04-16 1978 ret |= SETIREG(SISCR, 0x49, 0xaa);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1979
^1da177e4c3f41 Linus Torvalds 2005-04-16 1980 ret |= SETIREG(SISSR, 0x1f, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1981 ret |= SETIREG(SISSR, 0x20, 0xa0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1982 ret |= SETIREG(SISSR, 0x23, 0xf6);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1983 ret |= SETIREG(SISSR, 0x24, 0x0d);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1984 ret |= SETIREG(SISSR, 0x25, 0x33);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1985
^1da177e4c3f41 Linus Torvalds 2005-04-16 1986 ret |= SETIREG(SISSR, 0x11, 0x0f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1987
^1da177e4c3f41 Linus Torvalds 2005-04-16 1988 ret |= SETIREGOR(SISPART1, 0x2f, 0x01);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1989
^1da177e4c3f41 Linus Torvalds 2005-04-16 1990 ret |= SETIREGAND(SISCAP, 0x3f, 0xef);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1991
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1992 if (ret)
06e21efa2d344b Peter Senna Tschudin 2016-01-15 1993 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1994
^1da177e4c3f41 Linus Torvalds 2005-04-16 1995 ret |= SETIREG(SISPART1, 0x00, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1996
^1da177e4c3f41 Linus Torvalds 2005-04-16 1997 ret |= GETIREG(SISSR, 0x13, &tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 1998 tmp8 >>= 4;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1999
^1da177e4c3f41 Linus Torvalds 2005-04-16 2000 ret |= SETIREG(SISPART1, 0x02, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2001 ret |= SETIREG(SISPART1, 0x2e, 0x08);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2002
^1da177e4c3f41 Linus Torvalds 2005-04-16 2003 ret |= sisusb_read_pci_config(sisusb, 0x50, &tmp32);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2004 tmp32 &= 0x00f00000;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2005 tmp8 = (tmp32 == 0x100000) ? 0x33 : 0x03;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2006 ret |= SETIREG(SISSR, 0x25, tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2007 tmp8 = (tmp32 == 0x100000) ? 0xaa : 0x88;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2008 ret |= SETIREG(SISCR, 0x49, tmp8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2009
^1da177e4c3f41 Linus Torvalds 2005-04-16 2010 ret |= SETIREG(SISSR, 0x27, 0x1f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2011 ret |= SETIREG(SISSR, 0x31, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2012 ret |= SETIREG(SISSR, 0x32, 0x11);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2013 ret |= SETIREG(SISSR, 0x33, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2014
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2015 if (ret)
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2016 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2017
^1da177e4c3f41 Linus Torvalds 2005-04-16 2018 ret |= SETIREG(SISCR, 0x83, 0x00);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2019
a3fe2605a60d1d Hariprasad Kelam 2019-06-09 2020 sisusb_set_default_mode(sisusb, 0);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2021
^1da177e4c3f41 Linus Torvalds 2005-04-16 2022 ret |= SETIREGAND(SISSR, 0x21, 0xdf);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2023 ret |= SETIREGOR(SISSR, 0x01, 0x20);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2024 ret |= SETIREGOR(SISSR, 0x16, 0x0f);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2025
^1da177e4c3f41 Linus Torvalds 2005-04-16 2026 ret |= sisusb_triggersr16(sisusb, ramtype);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2027
^1da177e4c3f41 Linus Torvalds 2005-04-16 2028 /* Disable refresh */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2029 ret |= SETIREGAND(SISSR, 0x17, 0xf8);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2030 ret |= SETIREGOR(SISSR, 0x19, 0x03);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2031
^1da177e4c3f41 Linus Torvalds 2005-04-16 2032 ret |= sisusb_getbuswidth(sisusb, &bw, &chab);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2033 ret |= sisusb_verify_mclk(sisusb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2034
^1da177e4c3f41 Linus Torvalds 2005-04-16 2035 if (ramtype <= 1) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 2036 ret |= sisusb_get_sdram_size(sisusb, &iret, bw, chab);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2037 if (iret) {
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2038 dev_err(&sisusb->sisusb_dev->dev,
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2039 "RAM size detection failed, assuming 8MB video RAM\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 2040 ret |= SETIREG(SISSR, 0x14, 0x31);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2041 /* TODO */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2042 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2043 } else {
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2044 dev_err(&sisusb->sisusb_dev->dev,
06e21efa2d344b Peter Senna Tschudin 2016-01-15 2045 "DDR RAM device found, assuming 8MB video RAM\n");
^1da177e4c3f41 Linus Torvalds 2005-04-16 2046 ret |= SETIREG(SISSR, 0x14, 0x31);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2047 /* *** TODO *** */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2048 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2049
^1da177e4c3f41 Linus Torvalds 2005-04-16 2050 /* Enable refresh */
^1da177e4c3f41 Linus Torvalds 2005-04-16 2051 ret |= SETIREG(SISSR, 0x16, ramtypetable1[4 + ramtype]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2052 ret |= SETIREG(SISSR, 0x17, ramtypetable1[8 + ramtype]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2053 ret |= SETIREG(SISSR, 0x19, ramtypetable1[16 + ramtype]);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2054
^1da177e4c3f41 Linus Torvalds 2005-04-16 2055 ret |= SETIREGOR(SISSR, 0x21, 0x20);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2056
^1da177e4c3f41 Linus Torvalds 2005-04-16 2057 ret |= SETIREG(SISSR, 0x22, 0xfb);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2058 ret |= SETIREG(SISSR, 0x21, 0xa5);
^1da177e4c3f41 Linus Torvalds 2005-04-16 2059
^1da177e4c3f41 Linus Torvalds 2005-04-16 2060 if (ret == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 2061 break;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2062 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2063
^1da177e4c3f41 Linus Torvalds 2005-04-16 2064 return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 2065 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 2066

:::::: The code at line 1878 was first introduced by commit
:::::: 06e21efa2d344b5e29bf680e623fa76dbcb62580 usb-misc: sisusbvga: Fix coding style: vertical whitespace changes

:::::: TO: Peter Senna Tschudin <peter.senna@xxxxxxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip