Annotation of htdocs/docs/kernel/programming.html, revision 1.75

1.69      nia         1: <!DOCTYPE html>
1.1       dsieger     2: <html>
                      3: <head>
                      4: <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
                      5: <meta name="generator" content="Website XSL Stylesheet V2.6.0">
                      6: <link rel="home" href="../../." title="Welcome to The NetBSD Project: Of course it runs NetBSD.">
                      7: <link rel="up" href="../../docs/kernel/." title="NetBSD Documentation: Kernel">
                      8: <link rel="previous" href="../../docs/kernel/pseudo/." title="NetBSD Documentation: Writing a pseudo device">
                      9: <link rel="next" href="../../docs/kernel/uvm.html" title="NetBSD Documentation: UVM, the new Virtual Memory system">
                     10: <link rel="first" href="../../docs/kernel/lazyfpu.html" title="NetBSD Documentation: How lazy FPU context switch works">
                     11: <link rel="last" href="../../docs/kernel/elf-notes.html" title="NetBSD Documentation: Vendor-specific ELF Note Elements">
1.10      dsieger    12: <link rel="stylesheet" href="../../global.css" type="text/css">
1.58      maya       13: <link rel="stylesheet" href="../../donations/thermo/fundraiser.css" type="text/css">
1.1       dsieger    14: 
                     15:     
                     16:     
                     17:     <title>NetBSD Documentation: Kernel Programming FAQ</title>
                     18:   </head>
1.59      maya       19: <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
1.1       dsieger    20: <body class="website"><div class="webpage">
1.50      maya       21: <a name="docs-kernel-programming"></a><div id="top"><a href="#mainContent" id="skiplink" tabindex="1">Skip to main content.</a></div>
1.59      maya       22: <input id="hamburger" type="checkbox"><label class="menuicon" for="hamburger"><span></span><span></span><span></span></label><div id="navBar" role="navigation">
1.34      maya       23: <div id="centralHeader"><div id="logo">
1.60      maya       24: <a href="../../"><img id="projectLogo" alt="" height="120" src="../../images/NetBSD-smaller-tb.png"></a><a href="/"><div id="fundraiser">
1.58      maya       25: <br><div id="fundraiser-amount"><div id="fundraiser-raised"></div></div>
                     26: </div></a>
1.34      maya       27: </div></div>
1.6       dsieger    28: <span class="doNotDisplay">
                     29:          Navigation:
1.17      jym        30:        </span><ul>
                     31: <li>
                     32: <a href="../../">
1.61      maya       33:          Home</a><ul>
1.17      jym        34: <li><a href="../../changes/">
                     35:            Recent changes</a></li>
1.37      maya       36: <li><a href="//blog.NetBSD.org/">
1.17      jym        37:            NetBSD blog</a></li>
1.56      maya       38: <li><a href="../../gallery/presentations/">
                     39:            Presentations</a></li>
1.17      jym        40: </ul>
                     41: </li>
                     42: <li>
                     43: <a href="../../about/">
                     44:          About</a><ul>
1.45      maya       45: <li><a href="../../people/developers.html">
1.61      maya       46:            Developers</a></li>
1.17      jym        47: <li><a href="../../gallery/">
1.53      leot       48:            Gallery</a></li>
1.61      maya       49: <li><a href="//wiki.NetBSD.org/ports/">
                     50:            Ports</a></li>
1.68      nia        51: <li><a href="//www.pkgsrc.org/">
1.61      maya       52:            Packages</a></li>
1.17      jym        53: </ul>
                     54: </li>
                     55: <li>
                     56: <a href="../../docs/">
                     57:          Documentation</a><ul>
                     58: <li><a href="../../docs/misc/index.html">
                     59:            FAQ &amp; HOWTOs</a></li>
                     60: <li><a href="../../docs/guide/en/">
                     61:            The Guide</a></li>
1.65      nia        62: <li><a href="//man.NetBSD.org/">
1.17      jym        63:            Manual pages</a></li>
1.37      maya       64: <li><a href="//wiki.NetBSD.org/">
1.17      jym        65:            Wiki</a></li>
                     66: </ul>
                     67: </li>
                     68: <li>
                     69: <a href="../../support/">
                     70:          Support</a><ul>
1.62      leot       71: <li><a href="/community/">
1.61      maya       72:            Community</a></li>
1.62      leot       73: <li><a href="/mailinglists/">
                     74:            Mailing lists</a></li>
1.17      jym        75: <li><a href="../../support/send-pr.html">
1.61      maya       76:            Bug reports</a></li>
1.17      jym        77: <li><a href="../../support/security/">
                     78:            Security</a></li>
                     79: </ul>
                     80: </li>
                     81: <li>
                     82: <a href="../../developers/">
                     83:          Developers</a><ul>
1.40      maya       84: <li><a href="http://cvsweb.NetBSD.org/">
1.61      maya       85:            CVSWeb</a></li>
                     86: <li><a href="//anonhg.NetBSD.org/">
                     87:            Mercurial</a></li>
1.37      maya       88: <li><a href="//nxr.NetBSD.org/">
1.17      jym        89:            Cross-reference</a></li>
1.37      maya       90: <li><a href="//releng.NetBSD.org/">
1.17      jym        91:            Release engineering</a></li>
1.37      maya       92: <li><a href="//wiki.NetBSD.org/projects/">
1.17      jym        93:            Projects list</a></li>
                     94: </ul>
                     95: </li>
                     96: </ul>
1.3       dsieger    97: </div>
1.49      maya       98: <div id="content"><div id="mainContent" class="fullWidth"><div class="rowOfBoxes">
1.3       dsieger    99: <h1>NetBSD Documentation: Kernel Programming FAQ</h1>
1.1       dsieger   100: <h3 class="title"><a name="misc">Misc</a></h3>
                    101: <ul>
                    102: <li><a href="#knf">What is KNF</a></li>
                    103: <li><a href="#packed-attribute">Using the `packed' attribute</a></li>
                    104: <li><a href="#printf">Using printf() for debugging</a></li>
                    105: <li><a href="#forcing-ddb">Forcing code to enter DDB</a></li>
                    106: <li><a href="#adding_a_new_driver">Adding a new driver to the kernel</a></li>
                    107: <li><a href="#autoconf">How does all this autoconf stuff work?</a></li>
                    108: <li><a href="#adding_a_system_call">Adding a system call</a></li>
                    109: <li><a href="#adding_a_sysctl">Adding a sysctl</a></li>
                    110: <li><a href="#mmap_in_pseudo-device">How to implement mmap(2) in a pseudo-device</a></li>
                    111: <li><a href="#accessing_a_kernel_structure_from_userland">Accessing a kernel structure from userland</a></li>
                    112: <li><a href="#sample_driver">Is there a simple PCI driver I can use as an example?</a></li>
                    113: <li><a href="#other-related-links">Other related links</a></li>
                    114: </ul>
                    115: <hr>
                    116: <h3 class="title">Misc</h3>
                    117:        <h4 class="title">
1.46      maya      118: <a name="knf"></a>What is KNF</h4>
1.1       dsieger   119: 
                    120:        <p>KNF stands for "Kernel Normal Form" - it's a C coding
                    121:          style documented in
                    122:          <code class="filename">/usr/share/misc/style</code>, which is
                    123:          included in the source tree as <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/share/misc/style?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/share/misc/style</code></a>.</p>
                    124:       
                    125:        <h4 class="title">
1.46      maya      126: <a name="packed-attribute"></a>Using the `packed' attribute</h4>
1.1       dsieger   127:        
                    128:        <p>Always use the <code class="code">`packed'</code> attribute in
                    129:          structures which describe wire protocol data formats.</p>
                    130:       
                    131:        <h4 class="title">
1.46      maya      132: <a name="printf"></a>Using <code class="code">printf()</code> for debugging</h4>
1.1       dsieger   133: 
                    134:        <p>Probably the simplest way of generating debugging
                    135:          information from a kernel driver is to use
                    136:          <code class="code">printf()</code>. The kernel printf will send output to
                    137:          the console, so beware of generating too much output and
                    138:          making the system unusable.</p>
                    139:       
                    140:        <h4 class="title">
1.46      maya      141: <a name="forcing-ddb"></a>Forcing code to enter DDB</h4>
1.1       dsieger   142: 
                    143:        <p>Ensure your kernel config file contains
                    144:          '<code class="code">options DDB</code>', the file has
                    145:          '<code class="code">#include "opt_ddb.h"</code>', then use
                    146:          '<code class="code">Debugger()</code>'.</p>
                    147:       
                    148:        <h4 class="title">
1.46      maya      149: <a name="adding_a_new_driver"></a>Adding a new driver to the kernel</h4>
1.1       dsieger   150: 
                    151:        <p>Every driver needs at least:
                    152:          </p>
1.23      tron      153: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.15      spz       154: <li class="listitem">
1.1       dsieger   155: <code class="code"><span class="emphasis"><em>xxx</em></span>probe()</code> (
                    156:              during which NetBSD will attempt to determine if the
                    157:              device is present)</li>
1.15      spz       158: <li class="listitem">
1.1       dsieger   159: <code class="code"><span class="emphasis"><em>xxx</em></span>attach()</code>
                    160:              routine which will configure and attach the
                    161:              device.</li>
                    162: </ul></div>
                    163: <p>
                    164:        </p>
                    165: 
                    166:        <p>Once probe and attach routines have been written, add
                    167:          an entry to 
                    168:          <code class="filename">/usr/src/sys/arch/&lt;your-arch&gt;/&lt;your-arch&gt;/conf.c</code>.</p>
                    169:        
                    170:        <p>There are two tables:
                    171:          </p>
1.23      tron      172: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.15      spz       173: <li class="listitem">
1.1       dsieger   174: <code class="code">cdevsw</code> for character devices.</li>
1.15      spz       175: <li class="listitem">
1.1       dsieger   176: <code class="code">bdevsw</code> for block devices (for those
                    177:              that also perform "block" I/O and use a strategy
                    178:              routine).</li>
                    179: </ul></div>
                    180: 
                    181:        <p>Most entries will be of the form
                    182:          <code class="code">cdev_<span class="emphasis"><em>xxx</em></span>_init()</code>, which
                    183:          is a macro handling prototyping of the standard Unix
                    184:          device switch routines.</p>
                    185: 
                    186:        <p>The probe/attach routines are called at boot time.  The
                    187:          <code class="code">open()</code>, <code class="code">close()</code>,
                    188:          <code class="code">read()</code>, and <code class="code">write()</code> routines are
                    189:          called when you open up the device special file who's major
                    190:          number corresponds to the index into that table.  For
                    191:          example, if you open up a device who's major number is 18,
                    192:          the "open" routine for device number 18 in
                    193:          <code class="code">cdevsw[]/bdevsw</code> will be called.</p>
                    194: 
                    195:        <p>Most drivers are split between bus specific attach code, and
                    196:          a machine independent core. As an example, the driver for
                    197:          the PCI lance ethernet chip has entries in the following files:
                    198: 
                    199:          </p>
1.23      tron      200: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.15      spz       201: <li class="listitem">
1.1       dsieger   202: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/dev/pci/files.pci?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/dev/pci/files.pci</code></a>
                    203:              - attach information (look for 'le at pci').</li>
1.15      spz       204: <li class="listitem">
1.1       dsieger   205: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/dev/pci/if_le_pci.c?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/dev/pci/if_le_pci.c</code></a> 
                    206:              - PCI bus attach code for the driver.</li>
                    207: </ul></div>
                    208: <p>
                    209:        </p>
                    210:        
                    211:        <p>
                    212:          </p>
1.23      tron      213: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.15      spz       214: <li class="listitem">
1.1       dsieger   215: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/conf/files?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/conf/files</code></a>
                    216:              - MI core attach information (look for 'le:').</li>
1.15      spz       217: <li class="listitem">
1.1       dsieger   218: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/dev/ic/am7990.c?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/dev/ic/am7990.c</code></a>
                    219:              - MI driver 24bit access code.</li>
1.15      spz       220: <li class="listitem">
1.1       dsieger   221: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/dev/ic/am79900.c?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/dev/ic/am79900.c</code></a>
                    222:              - MI driver 32bit access code.</li>
1.15      spz       223: <li class="listitem">
1.1       dsieger   224: <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/sys/dev/ic/lance.c?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/sys/dev/ic/lance.c</code></a>
                    225:              - MI core driver code.</li>
                    226: </ul></div>
                    227: <p>
                    228:        </p>
                    229: 
1.12      hubertf   230:        <p>See also <a class="ulink" href="#autoconf" target="_top">the autoconf explanation</a>.</p>
1.1       dsieger   231:       
                    232:        <h4 class="title">
1.46      maya      233: <a name="autoconf"></a>How does all this autoconf stuff work?</h4>
1.1       dsieger   234:        
                    235:        <p>The autoconf machinery is quite simple once you figure
                    236:          out the way it works. If you want to ignore the exact
                    237:          details of how the device probe tree is built and walked
                    238:            on runtime, the bits needed for each individual
1.15      spz       239:          <span class="quote">&#8220;<span class="quote">leaf</span>&#8221;</span> driver are like this:
1.1       dsieger   240:          
                    241:          </p>
1.15      spz       242: <div class="orderedlist"><ol class="orderedlist" type="1">
                    243: <li class="listitem">each driver specifies a structure holding
1.1       dsieger   244:              three things - size of its private structure, probe
                    245:              function and attach function; this is compiled in and
                    246:              used in runtime - example:
                    247:              <pre class="programlisting">
                    248: struct cfattach foo_baz_ca = {
                    249:     sizeof(struct foo_baz_softc), foo_baz_match, foo_baz_attach
                    250: };</pre>
                    251: </li>
1.15      spz       252: <li class="listitem">on kernel startup, once the time comes to
1.1       dsieger   253:              attach the device, autoconf code calls device's
                    254:              probe routine and passes it pointer to parent
                    255:              (<code class="code">struct device *parent</code>), pointer
                    256:              to attach tag structure (<code class="code">void *aux</code>),
                    257:              and appropriate   autoconf node (<code class="code">struct cfdata
                    258:                *cf</code>). The driver is expected to find out if
                    259:              it's where it's supposed to be (commonly, the location
                    260:              and configuration information is passed by the attach
                    261:              tag). If yes, the probe routine should return 1. If
                    262:              device is not there, probe routine has to return 0.
                    263:              <span class="bold"><strong>NO STATE SHOULD BE KEPT</strong></span>
                    264:              in either case.</li>
1.15      spz       265: <li class="listitem">if probe returned success, autoconf allocates
1.1       dsieger   266:              chunk of memory sized as specified in device's *_ca
                    267:              and calls its attach routine, passing it pointer to
                    268:              parent (<code class="code">struct device *parent</code>), 
                    269:              pointer to the freshly allocated memory
                    270:              (<code class="code">struct device *self</code>) and the attach tag
                    271:              (<code class="code">void *aux</code>). Driver is expected to find
                    272:              out exact ports and memory, allocate resources and
                    273:              initialize its internal structure
                    274:              accordingly. Preferably, all driver instance specific
                    275:              information should be kept in the allocated
                    276:              memory.</li>
                    277: </ol></div>
                    278: <p>
                    279:        </p>
                    280:        
                    281:        <p>Example: Let's have a PCI ethernet device 'baz',
                    282:          kernel config chunk looks like this:
                    283:          </p>
                    284: <pre class="programlisting">
                    285: pci*    at mainbus?
                    286: baz*    at pci? dev ? function ?</pre>
                    287: <p>
                    288: 
                    289:          At runtime, autoconf iterates over all physical devices
                    290:          present on machine's PCI bus. For each physical device, it
                    291:          iterates over all devices registered in kernel to be on
                    292:          pci bus, and calls drivers' probe routine. If any probe
                    293:          routine claims the device by returning 1, autoconf stops
                    294:          iterating and does the job described under 3). Once the
                    295:          attach function returns, autoconf continues with next
                    296:          physical device.</p>
                    297:        
1.12      hubertf   298:        <p>See also <a class="ulink" href="#adding_a_new_driver" target="_top">Adding a new driver</a>.</p>
1.1       dsieger   299:       
                    300:        <h4 class="title">
1.46      maya      301: <a name="adding_a_system_call"></a>Adding a system call</h4>
1.1       dsieger   302:        
                    303:        <p>Add an entry in <code class="code">syscalls.master</code>, and add
                    304:          the syscall stub to the appropriate place in 
                    305:          <code class="code"><a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/lib/libc/sys/Makefile.inc?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/lib/libc/sys/Makefile.inc</code></a></code>.</p>
1.12      hubertf   306:        <p>See the <a class="ulink" href="../internals/en/chap-processes.html#syscall_howto" target="_top">
                    307:             HOWTO</a> and related documentation in the <a class="ulink" href="../internals/en/" target="_top">
1.1       dsieger   308:            NetBSD Internals Guide</a> for more information.
                    309:        </p>
                    310:       
                    311:        <h4 class="title">
1.46      maya      312: <a name="adding_a_sysctl"></a>Adding a sysctl</h4>
1.1       dsieger   313:        
1.12      hubertf   314:        <p>See a <a class="ulink" href="http://mail-index.NetBSD.org/tech-kern/2001/06/24/0000.html" target="_top">posting</a>
                    315:          answering this question on  <a class="ulink" href="http://mail-index.NetBSD.org/tech-kern/" target="_top">tech-kern</a>.</p>
1.1       dsieger   316:        
                    317:        <p>Note that NetBSD 1.6 and up has a special
1.15      spz       318:          <span class="quote">&#8220;<span class="quote">vendor</span>&#8221;</span> sysctl category that is reserved for vendor
1.75    ! martin    319:          specific entries. See <a href="//man.NetBSD.org/NetBSD-10.0/sysctl.8">sysctl(8)</a> for more
1.1       dsieger   320:          information.</p>
                    321:       
                    322:        <h4 class="title">
1.75    ! martin    323: <a name="mmap_in_pseudo-device"></a>How to implement <a href="//man.NetBSD.org/NetBSD-10.0/mmap.2">mmap(2)</a> in a pseudo-device</h4>
1.1       dsieger   324:        
                    325:        <p>Your device is most likely a character device, so
                    326:          you will be using the device pager (the VM system hides
                    327:          all of this from you, don't worry).</p>
                    328:        
                    329:        <p>The first thing you need to do is pick some
                    330:          arbitrary offsets for your mmap interface.  Something
                    331:          like "mmap offset 0-M gives object A, N-O gives object
                    332:          B", etc.</p>
                    333:        
                    334:        <p>After that, your mmap routine would look something
                    335:          like this:
                    336:          </p>
                    337: <pre class="programlisting">
                    338: int
                    339: foommap(dev_t dev, int off, int prot)
                    340: {
                    341: 
                    342:         if (off &amp; PAGE_MASK)
                    343:                 panic("foommap");
                    344: 
                    345:         if ((u_int)off &gt;= FOO_REGION1_MMAP_OFFSET &amp;&amp;
                    346:             (u_int)off &lt; (FOO_REGION1_MMAP_OFFSET + FOO_REGION1_SIZE))
                    347:                 return (atop(FOO_REGION1_ADDR + ((u_int)off -
                    348:                     FOO_REGION1_MMAP_OFFSET)));
                    349: 
                    350:         if ((u_int)off &gt;= FOO_REGION2_MMAP_OFFSET &amp;&amp;
                    351:             (u_int)off &lt; (FOO_REGION2_MMAP_OFFSET + FOO_REGION2_SIZE))
                    352:                 return (atop(FOO_REGION1_ADDR + ((u_int)off -
                    353:                     FOO_REGION2_MMAP_OFFSET)));
                    354: 
                    355:         /* Page not found. */
                    356:         return (-1);
                    357: }</pre>
                    358: 
                    359:          <p>Now, this is slightly more complicated by the fact
                    360:            that you are going to be mmap'ing what are simply
                    361:            kernel memory objects (it is a pseudo-device after
                    362:            all).</p>
                    363:          
                    364:          <p>In order to make this work, you're going to want
                    365:            to make sure you allocate the memory objects to be
                    366:            mmap'd on page-aligned boundaries.  If you are
                    367:            allocating something &gt;= <code class="code">PAGE_SIZE</code> in
                    368:            size, this is guaranteed. Otherwise, you are going to
                    369:            have to use <code class="code">uvm_km_alloc()</code>, and round
                    370:            your allocation size up to page size.</p>
                    371:          
                    372:          <p>Then it would look a bit more like this:
                    373:            </p>
                    374: <pre class="programlisting">
                    375: int
                    376: foommap(dev_t dev, int off, int prot)
                    377: {
                    378:         paddr_t pa;
                    379: 
                    380:         if (off &amp; PAGE_MASK)
                    381:                 panic("foommap: offset not page aligned");
                    382: 
                    383:         if ((u_int)off &gt;= FOO_REGION1_MMAP_OFFSET &amp;&amp;
                    384:             (u_int)off &lt; (FOO_REGION1_MMAP_OFFSET + FOO_REGION1_SIZE)) {
                    385:                 if ((vaddr_t)foo_object1 &amp; PAGE_MASK)
                    386:                         panic("foommap: foo_object1 not page aligned");
                    387:                 if (pmap_extract(pmap_kernel(), foo_object1 +
                    388:                     (u_int)off - FOO_REGION1_MMAP_OFFSET, &amp;pa) == FALSE)
                    389:                         panic("foommap: foo_object1 page not mapped");
                    390:                 return (atop(pa));
                    391:         }
                    392: 
                    393:         if ((u_int)off &gt;= FOO_REGION2_MMAP_OFFSET &amp;&amp;
                    394:             (u_int)off &lt; (FOO_REGION2_MMAP_OFFSET + FOO_REGION2_SIZE)) {
                    395:                 if ((vaddr_t)foo_object2 &amp; PAGE_MASK)
                    396:                         panic("foommap: foo_object2 not page aligned");
                    397:                 if (pmap_extract(pmap_kernel(), foo_object2 +
                    398:                     (u_int)off - FOO_REGION2_MMAP_OFFSET, &amp;pa) == FALSE)
                    399:                         panic("foommap: foo_object2 page not mapped");
                    400:                 return (atop(pa));
                    401:         }
                    402: 
                    403:         /* Page not found. */
                    404:         return (-1);
                    405: }</pre>
                    406:       
                    407:        <h4 class="title">
1.46      maya      408: <a name="accessing_a_kernel_structure_from_userland"></a>Accessing a kernel structure from userland</h4>
1.1       dsieger   409:        
                    410:        <p>The canonical example for this is:  <code class="code">
                    411:            <a href="http://cvsweb.NetBSD.org/bsdweb.cgi/src/usr.bin/vmstat/dkstats.c?rev=HEAD&amp;content-type=text/x-cvsweb-markup" target="_top"><code class="filename">src/usr.bin/vmstat/dkstats.c</code></a></code>
                    412:          , which reads disk statistics.</p>
                    413:       
                    414:        <h4 class="title">
1.46      maya      415: <a name="sample_driver"></a>Is there a simple PCI driver I can use as an example?</h4>
1.1       dsieger   416:        <p>You can look at
                    417:          <code class="filename">sys/dev/pci/puc.c</code>, which is one of
                    418:          the simplest drivers. PUCs are devices with one or more
                    419:          serial or parallel ports on it, usually using standard
                    420:          chips (e.g. 16550 UART for serial). This driver just
                    421:          locates the I/O addresses of the registers of the serial or
                    422:          parallel controller and passes it to the serial or
                    423:          parallel driver.</p> 
                    424:       
                    425:        <h4 class="title">
1.46      maya      426: <a name="other-related-links"></a>Other related links</h4>
1.1       dsieger   427:        
1.23      tron      428: <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
1.15      spz       429: <li class="listitem">
1.75    ! martin    430: <a href="//man.NetBSD.org/NetBSD-10.0/driver.9">driver(9)</a> - NetBSD autoconfiguration
1.1       dsieger   431:            interface utilised by device drivers</li>
1.15      spz       432: <li class="listitem">
1.75    ! martin    433: <a href="//man.NetBSD.org/NetBSD-10.0/autoconf.9">autoconf(9)</a> - General description on the
1.1       dsieger   434:            NetBSD autoconfiguration framework</li>
1.15      spz       435: <li class="listitem">
1.75    ! martin    436: <a href="//man.NetBSD.org/NetBSD-10.0/config.9">config(9)</a> - The autoconfiguration
1.1       dsieger   437:            framework ``device definition'' language</li>
1.15      spz       438: <li class="listitem">
1.75    ! martin    439: <a href="//man.NetBSD.org/NetBSD-10.0/bus_dma.9">bus_dma(9)</a> - NetBSD's bus and machine
1.12      hubertf   440:            independent DMA framework, described in its own <a class="ulink" href="bus_dma.pdf" target="_top">paper</a> (64k, PDF)</li>
1.15      spz       441: <li class="listitem">
1.75    ! martin    442: <a href="//man.NetBSD.org/NetBSD-10.0/bus_space.9">bus_space(9)</a> - NetBSD's bus space
1.1       dsieger   443:            manipulation interface</li>
1.15      spz       444: <li class="listitem">
1.12      hubertf   445: <a class="ulink" href="scsidma.html" target="_top">How SCSI DMA
1.1       dsieger   446:              works</a> - by Tohru Nishimura</li>
1.15      spz       447: <li class="listitem">
1.12      hubertf   448: <a class="ulink" href="lazyfpu.html" target="_top">How lazy FPU context
1.1       dsieger   449:              switch works</a> - by Tohru Nishimura</li>
1.15      spz       450: <li class="listitem"><a class="ulink" href="converting-ethernet-drivers.html" target="_top">Converting ancient BSD Ethernet drivers to NetBSD-1.2D and later</a></li>
                    451: <li class="listitem"><a class="ulink" href="porting-freebsd-net.html" target="_top">Notes on porting FreeBSD network drivers to NetBSD</a></li>
1.1       dsieger   452: </ul></div>
1.3       dsieger   453:       <hr>Back to  <em><a href="./">NetBSD Documentation: Kernel</a></em>
                    454: </div></div></div>
                    455: <div class="navfoot"></div>
1.13      mishka    456: <div id="footer"><div id="footerContent"><center>
1.37      maya      457: <span class="footfeed"><a href="//www.NetBSD.org/cgi-bin/feedback.cgi">
1.3       dsieger   458:          Contact</a> |
1.9       kano      459:       </span><span class="footcopy"><a href="../../about/disclaimer.html">
1.3       dsieger   460:       Disclaimer</a> |
                    461: 
1.74      martin    462:       <span class="copyright">Copyright © 1994-2024 The NetBSD Foundation, Inc. </span>ALL RIGHTS RESERVED.<br>NetBSD<sup>®</sup> is a registered trademark of The NetBSD
1.3       dsieger   463:        Foundation, Inc.</span>
1.13      mishka    464: </center></div></div>
1.1       dsieger   465: </div></body>
                    466: </html>

CVSweb <webmaster@jp.NetBSD.org>