svn commit: r349714 - head/sys/dev/proto
Author: marcel Date: Thu Jul 4 02:51:34 2019 New Revision: 349714 URL: https://svnweb.freebsd.org/changeset/base/349714 Log: Lock busdma operations and serialize detach against open/close Use sx to allow M_WAITOK allocations (suggested by markj). admbugs: 782 Reviewed by: markj Modified: head/sys/dev/proto/proto.h head/sys/dev/proto/proto_busdma.c head/sys/dev/proto/proto_busdma.h head/sys/dev/proto/proto_core.c Modified: head/sys/dev/proto/proto.h == --- head/sys/dev/proto/proto.h Wed Jul 3 22:41:54 2019(r349713) +++ head/sys/dev/proto/proto.h Thu Jul 4 02:51:34 2019(r349714) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014, 2015 Marcel Moolenaar + * Copyright (c) 2014, 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,7 +36,8 @@ #definePROTO_RES_BUSDMA11 struct proto_res { - int r_type; + u_int r_type:8; + u_int r_opened:1; int r_rid; union { struct resource *res; @@ -47,13 +48,14 @@ struct proto_res { void*cookie; struct cdev *cdev; } r_u; - uintptr_t r_opened; }; struct proto_softc { device_tsc_dev; struct proto_res sc_res[PROTO_RES_MAX]; int sc_rescnt; + int sc_opencnt; + struct mtx sc_mtx; }; extern devclass_t proto_devclass; Modified: head/sys/dev/proto/proto_busdma.c == --- head/sys/dev/proto/proto_busdma.c Wed Jul 3 22:41:54 2019 (r349713) +++ head/sys/dev/proto/proto_busdma.c Thu Jul 4 02:51:34 2019 (r349714) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Marcel Moolenaar + * Copyright (c) 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -355,6 +356,7 @@ proto_busdma_attach(struct proto_softc *sc) struct proto_busdma *busdma; busdma = malloc(sizeof(*busdma), M_PROTO_BUSDMA, M_WAITOK | M_ZERO); + sx_init(&busdma->sxlck, "proto-busdma"); return (busdma); } @@ -363,6 +365,7 @@ proto_busdma_detach(struct proto_softc *sc, struct pro { proto_busdma_cleanup(sc, busdma); + sx_destroy(&busdma->sxlck); free(busdma, M_PROTO_BUSDMA); return (0); } @@ -373,10 +376,12 @@ proto_busdma_cleanup(struct proto_softc *sc, struct pr struct proto_md *md, *md1; struct proto_tag *tag, *tag1; + sx_xlock(&busdma->sxlck); LIST_FOREACH_SAFE(md, &busdma->mds, mds, md1) proto_busdma_md_destroy_internal(busdma, md); LIST_FOREACH_SAFE(tag, &busdma->tags, tags, tag1) proto_busdma_tag_destroy(busdma, tag); + sx_xunlock(&busdma->sxlck); return (0); } @@ -388,6 +393,8 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot struct proto_md *md; int error; + sx_xlock(&busdma->sxlck); + error = 0; switch (ioc->request) { case PROTO_IOC_BUSDMA_TAG_CREATE: @@ -470,6 +477,9 @@ proto_busdma_ioctl(struct proto_softc *sc, struct prot error = EINVAL; break; } + + sx_xunlock(&busdma->sxlck); + return (error); } @@ -477,11 +487,20 @@ int proto_busdma_mmap_allowed(struct proto_busdma *busdma, vm_paddr_t physaddr) { struct proto_md *md; + int result; + sx_xlock(&busdma->sxlck); + + result = 0; LIST_FOREACH(md, &busdma->mds, mds) { if (physaddr >= trunc_page(md->physaddr) && - physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) - return (1); + physaddr <= trunc_page(md->physaddr + md->tag->maxsz)) { + result = 1; + break; + } } - return (0); + + sx_xunlock(&busdma->sxlck); + + return (result); } Modified: head/sys/dev/proto/proto_busdma.h == --- head/sys/dev/proto/proto_busdma.h Wed Jul 3 22:41:54 2019 (r349713) +++ head/sys/dev/proto/proto_busdma.h Thu Jul 4 02:51:34 2019 (r349714) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2015 Marcel Moolenaar + * Copyright (c) 2015, 2019 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -60,6 +60,7 @@ s
svn commit: r349551 - in head/tools/bus_space: Python examples
Author: marcel Date: Sun Jun 30 02:29:12 2019 New Revision: 349551 URL: https://svnweb.freebsd.org/changeset/base/349551 Log: Add support for Python 3 and make it the default. Python 2.7 will retire on Januari 1, 2020. Modified: head/tools/bus_space/Python/Makefile head/tools/bus_space/Python/lang.c head/tools/bus_space/examples/am79c900_diag.py Modified: head/tools/bus_space/Python/Makefile == --- head/tools/bus_space/Python/MakefileSun Jun 30 02:08:13 2019 (r349550) +++ head/tools/bus_space/Python/MakefileSun Jun 30 02:29:12 2019 (r349551) @@ -3,7 +3,11 @@ SHLIB_NAME=bus.so SRCS= lang.c -CFLAGS+= -I${.CURDIR}/.. -I/usr/local/include/python2.7 -LDFLAGS+= -L/usr/local/lib -lpython2.7 +# Set PYTHON to the version to compile against. +# E.g. "python2.7", "python3.6", etc... +PYTHON=python3.6m + +CFLAGS+= -I${.CURDIR}/.. -I/usr/local/include/${PYTHON} +LDFLAGS+= -L/usr/local/lib -l${PYTHON} .include Modified: head/tools/bus_space/Python/lang.c == --- head/tools/bus_space/Python/lang.c Sun Jun 30 02:08:13 2019 (r349550) +++ head/tools/bus_space/Python/lang.c Sun Jun 30 02:29:12 2019 (r349551) @@ -412,6 +412,12 @@ busdma_sync_range(PyObject *self, PyObject *args) Py_RETURN_NONE; } +/* + * Module methods and initialization. + */ + +static char bus_docstr[] = "Access to H/W bus memory and register areas."; + static PyMethodDef bus_methods[] = { { "read_1", bus_read_1, METH_VARARGS, "Read a 1-byte data item." }, { "read_2", bus_read_2, METH_VARARGS, "Read a 2-byte data item." }, @@ -431,6 +437,9 @@ static PyMethodDef bus_methods[] = { { NULL, NULL, 0, NULL } }; +static char busdma_docstr[] = "A bus- and device-independent interface" +" to Direct Memory Access (DMA) mechanisms."; + static PyMethodDef busdma_methods[] = { { "tag_create", busdma_tag_create, METH_VARARGS, "Create a root tag." }, @@ -470,18 +479,12 @@ static PyMethodDef busdma_methods[] = { { NULL, NULL, 0, NULL } }; -PyMODINIT_FUNC -initbus(void) +static PyObject * +module_initialize(PyObject *bus, PyObject *busdma) { - PyObject *bus, *busdma; - bus = Py_InitModule("bus", bus_methods); - if (bus == NULL) - return; - busdma = Py_InitModule("busdma", busdma_methods); - if (busdma == NULL) - return; - PyModule_AddObject(bus, "dma", busdma); + if (bus == NULL || busdma == NULL) + return (NULL); PyModule_AddObject(busdma, "MD_BUS_SPACE", Py_BuildValue("i", 0)); PyModule_AddObject(busdma, "MD_PHYS_SPACE", Py_BuildValue("i", 1)); @@ -491,4 +494,49 @@ initbus(void) PyModule_AddObject(busdma, "SYNC_POSTREAD", Py_BuildValue("i", 2)); PyModule_AddObject(busdma, "SYNC_PREWRITE", Py_BuildValue("i", 4)); PyModule_AddObject(busdma, "SYNC_POSTWRITE", Py_BuildValue("i", 8)); + + PyModule_AddObject(bus, "dma", busdma); + return (bus); } + +#if PY_MAJOR_VERSION >= 3 + +static struct PyModuleDef bus_module = { + PyModuleDef_HEAD_INIT, + "bus", + bus_docstr, +-1, + bus_methods, +}; + +static struct PyModuleDef busdma_module = { + PyModuleDef_HEAD_INIT, + "busdma", + busdma_docstr, +-1, + busdma_methods, +}; + +PyMODINIT_FUNC +PyInit_bus(void) +{ + PyObject *bus, *busdma; + + bus = PyModule_Create(&bus_module); + busdma = PyModule_Create(&busdma_module); + return (module_initialize(bus, busdma)); +} + +#else /* PY_MAJOR_VERSION >= 3 */ + +PyMODINIT_FUNC +initbus(void) +{ + PyObject *bus, *busdma; + + bus = Py_InitModule3("bus", bus_methods, bus_docstr); + busdma = Py_InitModule3("busdma", busdma_methods, busdma_docstr); + (void)module_initialize(bus, busdma); +} + +#endif /* PY_MAJOR_VERSION >= 3 */ Modified: head/tools/bus_space/examples/am79c900_diag.py == --- head/tools/bus_space/examples/am79c900_diag.py Sun Jun 30 02:08:13 2019(r349550) +++ head/tools/bus_space/examples/am79c900_diag.py Sun Jun 30 02:29:12 2019(r349551) @@ -54,7 +54,7 @@ import time sys.path.append('/usr/lib') import bus -import busdma +from bus import dma as busdma # ILACC initialization block definition @@ -161,7 +161,7 @@ def ip_str(a): def mac_is(l, r): -for i in xrange(6): +for i in range(6): if l[i] != r[i]: return False return True @@ -203,7 +203,7 @@ def stop(): mac = () bcast = () -for o in xrange(6): +for o in range(6): mac += (bus.read_1(io, o),) bcast += (0xff,) logging.info('ethernet address = ' + MACFMT % mac) @@ -237,23 +237,23 @@ addr_txbufs = addr_rxbufs + bufsize * nrxbu
svn commit: r345436 - in stable/11/usr.bin/mkimg: . tests
Author: marcel Date: Sat Mar 23 03:37:08 2019 New Revision: 345436 URL: https://svnweb.freebsd.org/changeset/base/345436 Log: MFC 344826: Round # partitions up to fill the last GPT table sector Set the number of partitions entries in the GPT header to a multiple of the number of entries that fit in a sector. PR: 236238 Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D19465 Modified: stable/11/usr.bin/mkimg/gpt.c stable/11/usr.bin/mkimg/tests/Makefile stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu stable/11/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu stable/11/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mkimg/gpt.c == --- stable/11/usr.bin/mkimg/gpt.c Sat Mar 23 03:23:20 2019 (r345435) +++ stable/11/usr.bin/mkimg/gpt.c Sat Mar 23 03:37:08 2019 (r345436) @@ -265,9 +265,9 @@ gpt_write(lba_t imgsz, void *bootcode) le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); mkimg_uuid(&uuid); mkimg_uuid_enc(&hdr->hdr_uuid, &uuid); - le32enc(&hdr->hdr_entries, nparts); + le32enc(&hdr->hdr_entries, tblsz * secsz / sizeof(struct gpt_ent)); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); - crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); + crc = crc32(tbl, tblsz * secsz); le32enc(&hdr->hdr_crc_table, crc); error = gpt_write_hdr(hdr, 1, imgsz - 1, 2); if (!error) Modified: stable/11/usr.bin/mkimg/tests/Makefile == --- stable/11/usr.bin/mkimg/tests/Makefile Sat Mar 23 03:23:20 2019 (r345435) +++ stable/11/usr.bin/mkimg/tests/Makefile Sat Mar 23 03:37:08 2019 (r345436) @@ -18,6 +18,6 @@ $f: $f.gz.uu CLEANFILES+= ${${PACKAGE}FILES}} rebase: .PHONY - (cd ${.CURDIR}; atf-sh ${_REBASE_SCRIPT}.sh rebase) + (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase) .include Modified: stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu == --- stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu Sat Mar 23 03:23:20 2019(r345435) +++ stable/11/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu Sat Mar 23 03:37:08 2019(r345436) @@ -1,132 +1,132 @@ # $FreeBSD$ begin 644 img-1x1-4096-gpt.qcow.gz -M'XL(",]Q+ED``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W+CAS7L47G -M^HKDFVR2S8J(S*Q,OFW`!CR3C7MG]P+.Y]`HS_GQ[NH^C^ZHO1D6V!(A4"!R -MH^IP]2I*6CH\'.[^:)I.FK9OVK'9Y^;F[],W:>[]S<-OS8^___5OU_?_^/'; -MW9@Y`3Y%N).0NQ$^1;B3D+L)/D6XDY"[ -M&3Y%N).0NP4^1;B3D+L5/D6XTY"[#3Y%N".?%_>XV^%3A#N-N!/\%.%.(^X$ -M^4X9=QIQ)\AWRKC3B#M!OE/&G4;<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D -M.V/<6<@=\ITQ[BSD#OG.&'<6*GR+]:QET;<:?(=RWCKHNX4^2[CG'71=PI\EW'N.M"[I#O.L9=%W*'?-' -MW"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;&W1)R -MAWRW,.Z6D#ODNX5QMT3<]?@IPMT2<=^6QAW2\1=CWRW,.Z6 -MB+L>^6YAW"T1=SWRW<*X6R/N>N2[E7&W1MSUR'2O\/G@._D0+B30\@=\)T<"'=RB+@;\%.8 -M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2 -M]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO -M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\AWK[R3L[P;D.];?2=C?C?@I -MPEW8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[ -M$?F.]7<2]G]8?R=A?SOO).SO)OP4X2[L[R;D -M.];?2=C?3OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'? -ML?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W,WZ*OO).SO -M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z -M.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W
svn commit: r345434 - stable/11/sys/geom/part
Author: marcel Date: Sat Mar 23 03:10:23 2019 New Revision: 345434 URL: https://svnweb.freebsd.org/changeset/base/345434 Log: MFC 344790: Revert revision 254095 In revision 254095, gpt_entries is not set to match the on-disk hdr_entries, but rather is computed based on available space. There are 2 problems with this: 1. The GPT backend respects hdr_entries and only reads and writes that number of partition entries. On top of that, CRC32 is computed over the table that has hdr_entries elements. When the common code works on what is possibly a larger number, the behaviour becomes inconsistent and problematic. In particular, it would be possible to add a new partition that on a reboot isn't there anymore. 2. The calculation of gpt_entries is based on flawed assumptions. The GPT specification does not dictate that sectors are layed out in a particular way that the available space can be determined by looking at LBAs. In practice, implementations do the same thing, because there's no reason to do it any other way. Still, GPT allows certain freedoms that can be exploited in some form or shape if the need arises. PR: 229977 Differential Revision:https://reviews.freebsd.org/D19438 Modified: stable/11/sys/geom/part/g_part_gpt.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/geom/part/g_part_gpt.c == --- stable/11/sys/geom/part/g_part_gpt.cSat Mar 23 02:53:47 2019 (r345433) +++ stable/11/sys/geom/part/g_part_gpt.cSat Mar 23 03:10:23 2019 (r345434) @@ -978,10 +978,9 @@ g_part_gpt_read(struct g_part_table *basetable, struct basetable->gpt_first = table->hdr->hdr_lba_start; basetable->gpt_last = table->hdr->hdr_lba_end; - basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) * - pp->sectorsize / table->hdr->hdr_entsz; + basetable->gpt_entries = table->hdr->hdr_entries; - for (index = table->hdr->hdr_entries - 1; index >= 0; index--) { + for (index = basetable->gpt_entries - 1; index >= 0; index--) { if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused)) continue; entry = (struct g_part_gpt_entry *)g_part_new_entry( ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r345428 - in stable/12/usr.bin/mkimg: . tests
Author: marcel Date: Fri Mar 22 23:55:35 2019 New Revision: 345428 URL: https://svnweb.freebsd.org/changeset/base/345428 Log: MFC 344826: Round # partitions up to fill the last GPT table sector Set the number of partitions entries in the GPT header to a multiple of the number of entries that fit in a sector. PR: 236238 Reviewed by: imp Differential Revision:https://reviews.freebsd.org/D19465 Modified: stable/12/usr.bin/mkimg/gpt.c stable/12/usr.bin/mkimg/tests/Makefile stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu stable/12/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu stable/12/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/mkimg/gpt.c == --- stable/12/usr.bin/mkimg/gpt.c Fri Mar 22 23:39:16 2019 (r345427) +++ stable/12/usr.bin/mkimg/gpt.c Fri Mar 22 23:55:35 2019 (r345428) @@ -259,9 +259,9 @@ gpt_write(lba_t imgsz, void *bootcode) le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); mkimg_uuid(&uuid); mkimg_uuid_enc(&hdr->hdr_uuid, &uuid); - le32enc(&hdr->hdr_entries, nparts); + le32enc(&hdr->hdr_entries, tblsz * secsz / sizeof(struct gpt_ent)); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); - crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); + crc = crc32(tbl, tblsz * secsz); le32enc(&hdr->hdr_crc_table, crc); error = gpt_write_hdr(hdr, 1, imgsz - 1, 2); if (!error) Modified: stable/12/usr.bin/mkimg/tests/Makefile == --- stable/12/usr.bin/mkimg/tests/Makefile Fri Mar 22 23:39:16 2019 (r345427) +++ stable/12/usr.bin/mkimg/tests/Makefile Fri Mar 22 23:55:35 2019 (r345428) @@ -18,6 +18,6 @@ $f: $f.gz.uu CLEANFILES+= ${${PACKAGE}FILES}} rebase: .PHONY - (cd ${.CURDIR}; atf-sh ${_REBASE_SCRIPT}.sh rebase) + (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase) .include Modified: stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu == --- stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu Fri Mar 22 23:39:16 2019(r345427) +++ stable/12/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu Fri Mar 22 23:55:35 2019(r345428) @@ -1,132 +1,132 @@ # $FreeBSD$ begin 644 img-1x1-4096-gpt.qcow.gz -M'XL(",]Q+ED``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W+CAS7L47G -M^HKDFVR2S8J(S*Q,OFW`!CR3C7MG]P+.Y]`HS_GQ[NH^C^ZHO1D6V!(A4"!R -MH^IP]2I*6CH\'.[^:)I.FK9OVK'9Y^;F[],W:>[]S<-OS8^___5OU_?_^/'; -MW9@Y`3Y%N).0NQ$^1;B3D+L)/D6XDY"[ -M&3Y%N).0NP4^1;B3D+L5/D6XTY"[#3Y%N".?%_>XV^%3A#N-N!/\%.%.(^X$ -M^4X9=QIQ)\AWRKC3B#M!OE/&G4;<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D -M.V/<6<@=\ITQ[BSD#OG.&'<6*GR+]:QET;<:?(=RWCKHNX4^2[CG'71=PI\EW'N.M"[I#O.L9=%W*'?-' -MW"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;&W1)R -MAWRW,.Z6D#ODNX5QMT3<]?@IPMT2<=^6QAW2\1=CWRW,.Z6 -MB+L>^6YAW"T1=SWRW<*X6R/N>N2[E7&W1MSUR'2O\/G@._D0+B30\@=\)T<"'=RB+@;\%.8 -M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2 -M]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO -M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\AWK[R3L[P;D.];?2=C?C?@I -MPEW8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[ -M$?F.]7<2]G]8?R=A?SOO).SO)OP4X2[L[R;D -M.];?2=C?3OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'? -ML?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W,WZ*OO).SO -M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z -M.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W
svn commit: r345427 - stable/12/sys/geom/part
Author: marcel Date: Fri Mar 22 23:39:16 2019 New Revision: 345427 URL: https://svnweb.freebsd.org/changeset/base/345427 Log: MFC 344790: Revert revision 254095 In revision 254095, gpt_entries is not set to match the on-disk hdr_entries, but rather is computed based on available space. There are 2 problems with this: 1. The GPT backend respects hdr_entries and only reads and writes that number of partition entries. On top of that, CRC32 is computed over the table that has hdr_entries elements. When the common code works on what is possibly a larger number, the behaviour becomes inconsistent and problematic. In particular, it would be possible to add a new partition that on a reboot isn't there anymore. 2. The calculation of gpt_entries is based on flawed assumptions. The GPT specification does not dictate that sectors are layed out in a particular way that the available space can be determined by looking at LBAs. In practice, implementations do the same thing, because there's no reason to do it any other way. Still, GPT allows certain freedoms that can be exploited in some form or shape if the need arises. PR: 229977 Differential Revision:https://reviews.freebsd.org/D19438 Modified: stable/12/sys/geom/part/g_part_gpt.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/geom/part/g_part_gpt.c == --- stable/12/sys/geom/part/g_part_gpt.cFri Mar 22 22:14:14 2019 (r345426) +++ stable/12/sys/geom/part/g_part_gpt.cFri Mar 22 23:39:16 2019 (r345427) @@ -990,10 +990,9 @@ g_part_gpt_read(struct g_part_table *basetable, struct basetable->gpt_first = table->hdr->hdr_lba_start; basetable->gpt_last = table->hdr->hdr_lba_end; - basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) * - pp->sectorsize / table->hdr->hdr_entsz; + basetable->gpt_entries = table->hdr->hdr_entries; - for (index = table->hdr->hdr_entries - 1; index >= 0; index--) { + for (index = basetable->gpt_entries - 1; index >= 0; index--) { if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused)) continue; entry = (struct g_part_gpt_entry *)g_part_new_entry( ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r344957 - head/usr.bin/mkimg/tests
Author: marcel Date: Sat Mar 9 02:03:07 2019 New Revision: 344957 URL: https://svnweb.freebsd.org/changeset/base/344957 Log: Don't compress and uuencode the "hexdump -C" output files. Just save them with the $FreeBSD$ tag prepended. Changes to these files are now a lot easier to comprehend, which makes diffs also reviewable. Added: head/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-apm.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-apm.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-apm.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-apm.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-bsd.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-ebr.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-mbr.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-4096-vtoc8.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-apm.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-bsd.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhd.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.vhdf.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-ebr.vmdk.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.hex (contents, props changed) head/usr.bin/mkimg/tests/img-1x1-512-gpt
svn commit: r344826 - in head/usr.bin/mkimg: . tests
Author: marcel Date: Tue Mar 5 22:55:33 2019 New Revision: 344826 URL: https://svnweb.freebsd.org/changeset/base/344826 Log: Round # partitions up to fill the last GPT table sector Set the number of partitions entries in the GPT header to a multiple of the number of entries that fit in a sector. PR: 236238 Reviewed by: imp MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D19465 Modified: head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/tests/Makefile head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow2.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-gpt.raw.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhd.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vhdf.gz.uu head/usr.bin/mkimg/tests/img-1x1-4096-gpt.vmdk.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.qcow2.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.raw.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhd.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.vhdf.gz.uu head/usr.bin/mkimg/tests/img-1x1-512-gpt.vmdk.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.qcow2.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.raw.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhd.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.vhdf.gz.uu head/usr.bin/mkimg/tests/img-63x255-4096-gpt.vmdk.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.qcow2.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.raw.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.vhd.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.vhdf.gz.uu head/usr.bin/mkimg/tests/img-63x255-512-gpt.vmdk.gz.uu Modified: head/usr.bin/mkimg/gpt.c == --- head/usr.bin/mkimg/gpt.cTue Mar 5 22:04:23 2019(r344825) +++ head/usr.bin/mkimg/gpt.cTue Mar 5 22:55:33 2019(r344826) @@ -259,9 +259,9 @@ gpt_write(lba_t imgsz, void *bootcode) le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); mkimg_uuid(&uuid); mkimg_uuid_enc(&hdr->hdr_uuid, &uuid); - le32enc(&hdr->hdr_entries, nparts); + le32enc(&hdr->hdr_entries, tblsz * secsz / sizeof(struct gpt_ent)); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); - crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); + crc = crc32(tbl, tblsz * secsz); le32enc(&hdr->hdr_crc_table, crc); error = gpt_write_hdr(hdr, 1, imgsz - 1, 2); if (!error) Modified: head/usr.bin/mkimg/tests/Makefile == --- head/usr.bin/mkimg/tests/Makefile Tue Mar 5 22:04:23 2019 (r344825) +++ head/usr.bin/mkimg/tests/Makefile Tue Mar 5 22:55:33 2019 (r344826) @@ -18,6 +18,6 @@ $f: $f.gz.uu CLEANFILES+= ${${PACKAGE}FILES}} rebase: .PHONY - (cd ${.CURDIR}; atf-sh ${_REBASE_SCRIPT}.sh rebase) + (cd ${.CURDIR}; /usr/libexec/atf-sh ${_REBASE_SCRIPT}.sh rebase) .include Modified: head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uu == --- head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uuTue Mar 5 22:04:23 2019(r344825) +++ head/usr.bin/mkimg/tests/img-1x1-4096-gpt.qcow.gz.uuTue Mar 5 22:55:33 2019(r344826) @@ -1,132 +1,132 @@ # $FreeBSD$ begin 644 img-1x1-4096-gpt.qcow.gz -M'XL(",]Q+ED``VEM9RTQ>#$M-#`Y-BUG<'0N<6-O=RYO=70`K9W+CAS7L47G -M^HKDFVR2S8J(S*Q,OFW`!CR3C7MG]P+.Y]`HS_GQ[NH^C^ZHO1D6V!(A4"!R -MH^IP]2I*6CH\'.[^:)I.FK9OVK'9Y^;F[],W:>[]S<-OS8^___5OU_?_^/'; -MW9@Y`3Y%N).0NQ$^1;B3D+L)/D6XDY"[ -M&3Y%N).0NP4^1;B3D+L5/D6XTY"[#3Y%N".?%_>XV^%3A#N-N!/\%.%.(^X$ -M^4X9=QIQ)\AWRKC3B#M!OE/&G4;<"?*=,NXTXDZ0[Y1Q9Q%W@GQGC#N+N!/D -M.V/<6<@=\ITQ[BSD#OG.&'<6*GR+]:QET;<:?(=RWCKHNX4^2[CG'71=PI\EW'N.M"[I#O.L9=%W*'?-' -MW"'?S8R[.>0.^6YFW,TA=\AW,^-N#KE#OIL9=W/('?+=S+B;0^Z0[V;&W1)R -MAWRW,.Z6D#ODNX5QMT3<]?@IPMT2<=^6QAW2\1=CWRW,.Z6 -MB+L>^6YAW"T1=SWRW<*X6R/N>N2[E7&W1MSUR'2O\/G@._D0+B30\@=\)T<"'=RB+@;\%.8 -M.PG[NP'X3EA_)V%_-P#?">OO).SO!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2 -M]G<#\)VP_D["_FX`OA/6WTG8WPW`=\+Z.PG[NP'X3EA_)V%_-P#?">OO).SO -M!N`[8?V=A/W=`'PGK+^3L+\;@.^$]7<2]G<#\AWK[R3L[P;D.];?2=C?C?@I -MPEW8WXW(=ZR_D["_&Y'O6'\G87\W(M^Q_D["_FY$OF/]G83]W8A\Q_H["?N[ -M$?F.]7<2]G]8?R=A?SOO).SO)OP4X2[L[R;D -M.];?2=C?3OO).SO)N0[UM])V-]-R'>LOY.POYN0[UA_)V%_-R'? -ML?Y.POYN0KYC_9V$_=V$?,?Z.PG[NPGYCO5W$O9W,WZ*OO).SO -M9N0[UM])V-_-R'>LOY.POYN1[UA_)V%_-R/?L?Y.POYN1KYC_9V$_=V,?,?Z -M.PG[NQGYCO5W$O9W,_(=Z^\D[.]FY#O6WTG8W\W(=ZR_D["_FY'O6'\G87\W -M(]^Q_D["_FY&OF/]G83]W8Q\Q_H["?N[!3]%N`O[NP7YCO5W$O9W"_(=Z^\D -M[.\6Y#O6WTG8WRW(=ZR_D["_6Y#O6'\G87^W(-^Q_D["_FY!OF/]G83]W8)\ -MQ_H["?N[!?F.]7<2]G<+\AWK[R3L[Q;D.];?2=C?+]8?R=A?[OO).SO5N0[UM])V-^MR'>LOY.P
svn commit: r344790 - head/sys/geom/part
Author: marcel Date: Tue Mar 5 04:15:34 2019 New Revision: 344790 URL: https://svnweb.freebsd.org/changeset/base/344790 Log: Revert revision 254095 In revision 254095, gpt_entries is not set to match the on-disk hdr_entries, but rather is computed based on available space. There are 2 problems with this: 1. The GPT backend respects hdr_entries and only reads and writes that number of partition entries. On top of that, CRC32 is computed over the table that has hdr_entries elements. When the common code works on what is possibly a larger number, the behaviour becomes inconsistent and problematic. In particular, it would be possible to add a new partition that on a reboot isn't there anymore. 2. The calculation of gpt_entries is based on flawed assumptions. The GPT specification does not dictate that sectors are layed out in a particular way that the available space can be determined by looking at LBAs. In practice, implementations do the same thing, because there's no reason to do it any other way. Still, GPT allows certain freedoms that can be exploited in some form or shape if the need arises. PR: 229977 MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D19438 Modified: head/sys/geom/part/g_part_gpt.c Modified: head/sys/geom/part/g_part_gpt.c == --- head/sys/geom/part/g_part_gpt.c Tue Mar 5 03:27:32 2019 (r344789) +++ head/sys/geom/part/g_part_gpt.c Tue Mar 5 04:15:34 2019 (r344790) @@ -990,10 +990,9 @@ g_part_gpt_read(struct g_part_table *basetable, struct basetable->gpt_first = table->hdr->hdr_lba_start; basetable->gpt_last = table->hdr->hdr_lba_end; - basetable->gpt_entries = (table->hdr->hdr_lba_start - 2) * - pp->sectorsize / table->hdr->hdr_entsz; + basetable->gpt_entries = table->hdr->hdr_entries; - for (index = table->hdr->hdr_entries - 1; index >= 0; index--) { + for (index = basetable->gpt_entries - 1; index >= 0; index--) { if (EQUUID(&tbl[index].ent_type, &gpt_uuid_unused)) continue; entry = (struct g_part_gpt_entry *)g_part_new_entry( ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r326477 - stable/11/sbin/geom/class/part
Author: marcel Date: Sat Dec 2 18:41:01 2017 New Revision: 326477 URL: https://svnweb.freebsd.org/changeset/base/326477 Log: MFC r324369 Fix alignment of 'last' in autofill. Modified: stable/11/sbin/geom/class/part/geom_part.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/part/geom_part.c == --- stable/11/sbin/geom/class/part/geom_part.c Sat Dec 2 18:00:01 2017 (r326476) +++ stable/11/sbin/geom/class/part/geom_part.c Sat Dec 2 18:41:01 2017 (r326477) @@ -534,7 +534,7 @@ gpart_autofill(struct gctl_req *req) last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); - last = ALIGNDOWN(last + offset, alignment); + last = ALIGNDOWN(last + offset + 1, alignment) - 1; if (a_first < start) a_first = start; while ((pp = find_provider(gp, first)) != NULL) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r326045 - head/sys/powerpc/booke
> On Nov 20, 2017, at 7:12 PM, Justin Hibbits wrote: > > Author: jhibbits > Date: Tue Nov 21 03:12:16 2017 > New Revision: 326045 > URL: https://svnweb.freebsd.org/changeset/base/326045 > > Log: > Check the page table before TLB1 in pmap_kextract() > > The vast majority of pmap_kextract() calls are looking for a physical memory > address, not a device address. By checking the page table first this saves > the formerly inevitable 64 (on e500mc and derivatives) iteration loop > through TLB1 in the most common cases. > > Benchmarking this on the P5020 (e5500 core) yields a 300% throughput > improvement on dtsec(4) (115Mbit/s -> 460Mbit/s) measured with iperf. > > Benchmarked on the P1022 (e500v2 core, 16 TLB1 entries) yields a 50% > throughput improvement on tsec(4) (~93Mbit/s -> 165Mbit/s) measured with > iperf. Nice! -- Marcel Moolenaar mar...@xcllnt.net ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r324369 - head/sbin/geom/class/part
Author: marcel Date: Fri Oct 6 16:38:00 2017 New Revision: 324369 URL: https://svnweb.freebsd.org/changeset/base/324369 Log: Fix alignment of 'last' in autofill. 'last' is the sector number of the last usable sector. Sector numbers start with 0. As such, 'last' is always 1 less than the count of sectors and aligning 'last' down as-is means that the number of free sectors is pessimized by 'alignment - 1' if the number of usable sectors was already a multiple of the alignment. Consequently, gpart(8) failed to create a partition when the alignment and size were such that it would extend to the end of the disk. Modified: head/sbin/geom/class/part/geom_part.c Modified: head/sbin/geom/class/part/geom_part.c == --- head/sbin/geom/class/part/geom_part.c Fri Oct 6 15:46:11 2017 (r324368) +++ head/sbin/geom/class/part/geom_part.c Fri Oct 6 16:38:00 2017 (r324369) @@ -547,7 +547,7 @@ gpart_autofill(struct gctl_req *req) last = (off_t)strtoimax(s, NULL, 0); grade = ~0ULL; a_first = ALIGNUP(first + offset, alignment); - last = ALIGNDOWN(last + offset, alignment); + last = ALIGNDOWN(last + offset + 1, alignment) - 1; if (a_first < start) a_first = start; while ((pp = find_provider(gp, first)) != NULL) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r319295 - head/usr.bin/mkimg/tests
> On Jun 1, 2017, at 8:32 AM, Alan Somers wrote: > > On Thu, Jun 1, 2017 at 9:11 AM, Marcel Moolenaar wrote: >> >> On May 31, 2017, at 11:06 PM, Ngie Cooper (yaneurabeya) >> wrote: >> >> >> On May 31, 2017, at 10:03 PM, Brooks Davis wrote: >> >> On Wed, May 31, 2017 at 08:01:12AM +, Ngie Cooper wrote: >> >> Author: ngie >> Date: Wed May 31 08:01:12 2017 >> New Revision: 319295 >> URL: https://svnweb.freebsd.org/changeset/base/319295 >> >> Log: >> Update the usr.bin/mkimg golden test output files after ^/head@r319125 >> >> ^/head@r319125 changed the location of the backup pmbr, requiring the >> output files to be regenerated, since they're binary disk dumps. >> >> The output files were regenerated with "make rebase"--fixed in >> ^/head@r319294. >> >> >> These should not be stored uuencoded. It serves no purpose other >> than bloating the repo and causing spammy commit mails like this one >> where we got a huge tail of garbage output. >> >> >> Hi Brooks, >> I’m not entirely sure why the files were uuencoded to be honest. I think >> that’s a good question for Marcel and some of the folks at Juniper, since >> they wrote the tool/tests. >> >> >> Result files used to start off as binary files. uuencoding is a given in >> that case. I eventually switched to using hexdump -C, because that makes it >> easier to analyze and understand differences. The uuencoding was kept to >> remain independent of version control system, file attributes and >> end-of-line characteristics of the host machine: nothing more annoying that >> checking out textual result files and have test failures because ‘\n’ was >> replaced by ‘\r\n’. >> >> Even if the files aren’t unencoded, there’s always someone who treats it as >> spammy and a tail of garbage. It’s just a knee-jerk reaction to seeing >> something that isn’t understood, I think. As such, there’s no reason to >> change — in fact, changing would be bloating the repo. >> >> -- >> Marcel Moolenaar >> mar...@xcllnt.net > > If the files are binary, then why not store them as binary files? A 100MB image, committed as binary file is 100MB of data. The hexdump -C equivalent is often only a few hundred bytes (due to the many zeroes). The repo bloat argument has grounds for binary files. -- Marcel Moolenaar mar...@xcllnt.net ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r319295 - head/usr.bin/mkimg/tests
> On May 31, 2017, at 11:06 PM, Ngie Cooper (yaneurabeya) > wrote: > > >> On May 31, 2017, at 10:03 PM, Brooks Davis wrote: >> >> On Wed, May 31, 2017 at 08:01:12AM +, Ngie Cooper wrote: >>> Author: ngie >>> Date: Wed May 31 08:01:12 2017 >>> New Revision: 319295 >>> URL: https://svnweb.freebsd.org/changeset/base/319295 >>> >>> Log: >>> Update the usr.bin/mkimg golden test output files after ^/head@r319125 >>> >>> ^/head@r319125 changed the location of the backup pmbr, requiring the >>> output files to be regenerated, since they're binary disk dumps. >>> >>> The output files were regenerated with "make rebase"--fixed in >>> ^/head@r319294. >> >> These should not be stored uuencoded. It serves no purpose other >> than bloating the repo and causing spammy commit mails like this one >> where we got a huge tail of garbage output. > > Hi Brooks, > I’m not entirely sure why the files were uuencoded to be honest. I > think that’s a good question for Marcel and some of the folks at Juniper, > since they wrote the tool/tests. Result files used to start off as binary files. uuencoding is a given in that case. I eventually switched to using hexdump -C, because that makes it easier to analyze and understand differences. The uuencoding was kept to remain independent of version control system, file attributes and end-of-line characteristics of the host machine: nothing more annoying that checking out textual result files and have test failures because ‘\n’ was replaced by ‘\r\n’. Even if the files aren’t unencoded, there’s always someone who treats it as spammy and a tail of garbage. It’s just a knee-jerk reaction to seeing something that isn’t understood, I think. As such, there’s no reason to change — in fact, changing would be bloating the repo. -- Marcel Moolenaar mar...@xcllnt.net ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r309845 - stable/11/sys/netpfil/pf
Author: marcel Date: Sun Dec 11 04:02:38 2016 New Revision: 309845 URL: https://svnweb.freebsd.org/changeset/base/309845 Log: MFC r309394, r309787 Fix use-after-free bugs in pfsync(4) Modified: stable/11/sys/netpfil/pf/if_pfsync.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/pf/if_pfsync.c == --- stable/11/sys/netpfil/pf/if_pfsync.cSun Dec 11 03:59:37 2016 (r309844) +++ stable/11/sys/netpfil/pf/if_pfsync.cSun Dec 11 04:02:38 2016 (r309845) @@ -161,8 +161,8 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static voidpfsync_q_ins(struct pf_state *, int); -static voidpfsync_q_del(struct pf_state *); +static voidpfsync_q_ins(struct pf_state *, int, bool); +static voidpfsync_q_del(struct pf_state *, bool); static voidpfsync_update_state(struct pf_state *); @@ -542,7 +542,7 @@ pfsync_state_import(struct pfsync_state if (!(flags & PFSYNC_SI_IOCTL)) { st->state_flags &= ~PFSTATE_NOSYNC; if (st->state_flags & PFSTATE_ACK) { - pfsync_q_ins(st, PFSYNC_S_IACK); + pfsync_q_ins(st, PFSYNC_S_IACK, true); pfsync_push(sc); } } @@ -1509,7 +1509,7 @@ pfsync_sendout(int schedswi) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st; + struct pf_state *st, *st_next; struct pfsync_upd_req_item *ur; int offset; int q, count = 0; @@ -1559,7 +1559,7 @@ pfsync_sendout(int schedswi) offset += sizeof(*subh); count = 0; - TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) { + TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, st_next) { KASSERT(st->sync_state == q, ("%s: st->sync_state == q", __func__)); @@ -1668,7 +1668,7 @@ pfsync_insert_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); - pfsync_q_ins(st, PFSYNC_S_INS); + pfsync_q_ins(st, PFSYNC_S_INS, true); PFSYNC_UNLOCK(sc); st->sync_updates = 0; @@ -1789,7 +1789,7 @@ static void pfsync_update_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; - int sync = 0; + bool sync = false, ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); @@ -1798,7 +1798,7 @@ pfsync_update_state(struct pf_state *st) pfsync_undefer_state(st, 0); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1815,14 +1815,17 @@ pfsync_update_state(struct pf_state *st) if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) { st->sync_updates++; if (st->sync_updates >= sc->sc_maxupdates) - sync = 1; + sync = true; } break; case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD_C); + pfsync_q_ins(st, PFSYNC_S_UPD_C, ref); st->sync_updates = 0; break; @@ -1880,13 +1883,14 @@ static void pfsync_update_state_req(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1894,9 +1898,12 @@ pfsync_update_state_req(struct pf_state switch (st->sync_state) { case PFSYNC_S_UPD_C: case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD); + pfsync_q_ins(st, PFSYNC_S_UPD, ref); pfsync_push(sc); break; @@ -1917,13 +1924,14 @@ static void pfsync_delete_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PFSYNC_LOCK(sc); if (st->state_flags & P
svn commit: r309844 - stable/11/usr.bin/mkimg
Author: marcel Date: Sun Dec 11 03:59:37 2016 New Revision: 309844 URL: https://svnweb.freebsd.org/changeset/base/309844 Log: MFC r306299: Update local variable 'block' after calling capacity_resize(), otherwise format_resize(), which is called right after, isn't getting the current/actual image size. Rather than rounding up, format_resize() could end up truncating the size and we don't allow that by design. Modified: stable/11/usr.bin/mkimg/mkimg.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/mkimg/mkimg.c == --- stable/11/usr.bin/mkimg/mkimg.c Sun Dec 11 03:57:21 2016 (r309843) +++ stable/11/usr.bin/mkimg/mkimg.c Sun Dec 11 03:59:37 2016 (r309844) @@ -463,13 +463,16 @@ mkimg(void) block = scheme_metadata(SCHEME_META_IMG_END, block); error = image_set_size(block); - if (!error) + if (!error) { error = capacity_resize(block); - if (!error) + block = image_get_size(); + } + if (!error) { error = format_resize(block); + block = image_get_size(); + } if (error) errc(EX_IOERR, error, "image sizing"); - block = image_get_size(); ncyls = block / (nsecs * nheads); error = scheme_write(block); if (error) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r309843 - in stable/11: . contrib/ofed/usr.lib/libsdp gnu/lib/libgcc gnu/lib/libgcov lib/libc/stdlib lib/libedit lib/libprocstat lib/libthr/support share/mk sys/conf usr.sbin/bsnmpd/mod...
Author: marcel Date: Sun Dec 11 03:57:21 2016 New Revision: 309843 URL: https://svnweb.freebsd.org/changeset/base/309843 Log: MFC r305855, r306297, r306300, r306312-r306313 When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Also: o Compile _Exit.c as C99_Exit.c, as it conflicts with _exit.s o Add entry to UPDATING o Document .pico extension Modified: stable/11/UPDATING stable/11/contrib/ofed/usr.lib/libsdp/Makefile stable/11/gnu/lib/libgcc/Makefile stable/11/gnu/lib/libgcov/Makefile stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libedit/Makefile stable/11/lib/libprocstat/Makefile stable/11/lib/libthr/support/Makefile.inc stable/11/share/mk/bsd.README stable/11/share/mk/bsd.dep.mk stable/11/share/mk/bsd.lib.mk stable/11/share/mk/meta.autodep.mk stable/11/sys/conf/kern.post.mk stable/11/sys/conf/kern.pre.mk stable/11/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/UPDATING == --- stable/11/UPDATING Sun Dec 11 02:01:59 2016(r309842) +++ stable/11/UPDATING Sun Dec 11 03:57:21 2016(r309843) @@ -16,6 +16,12 @@ from older versions of FreeBSD, try WITH the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20161210: + Relocatable object files with the extension of .So have been renamed + to use an extension of .pico instead. The purpose of this change is + to avoid a name clash with shared libraries on case-insensitive file + systems. On those file systems, foo.So is the same file as foo.so. + 20160622: The libc stub for the pipe(2) system call has been replaced with a wrapper that calls the pipe2(2) system call and the pipe(2) Modified: stable/11/contrib/ofed/usr.lib/libsdp/Makefile == --- stable/11/contrib/ofed/usr.lib/libsdp/Makefile Sun Dec 11 02:01:59 2016(r309842) +++ stable/11/contrib/ofed/usr.lib/libsdp/Makefile Sun Dec 11 03:57:21 2016(r309843) @@ -22,4 +22,4 @@ CFLAGS+= -I${OFEDSYS}/include # Remove .[ly] since the checked-in version is preferred. .SUFFIXES: -.SUFFIXES: .o .po .So .c .ln +.SUFFIXES: .o .po .pico .c .ln Modified: stable/11/gnu/lib/libgcc/Makefile == --- stable/11/gnu/lib/libgcc/Makefile Sun Dec 11 02:01:59 2016 (r309842) +++ stable/11/gnu/lib/libgcc/Makefile Sun Dec 11 03:57:21 2016 (r309843) @@ -254,8 +254,8 @@ OBJ_GRPS += FPBIT DPBIT .for T in ${OBJ_GRPS} ${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/} ${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/} -${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/} -SOBJS += ${${T}_FUNCS:S/$/.So/} +${T}_OBJS_S = ${${T}_FUNCS:S/$/.pico/} +SOBJS += ${${T}_FUNCS:S/$/.pico/} ${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS} ${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} @@ -270,7 +270,7 @@ ${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHD # Extra objects coming from separate files # .if !empty(LIB2ADD) -SOBJS += ${LIB2ADD:R:S/$/.So/} +SOBJS += ${LIB2ADD:R:S/$/.pico/} .endif #--- @@ -294,9 +294,9 @@ ${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDR .if defined(LIB1ASMSRC) ASM_T =${LIB1ASMFUNCS:S/$/.o/} ASM_P =${LIB1ASMFUNCS:S/$/.po/} -ASM_S =${LIB1ASMFUNCS:S/$/.So/} +ASM_S =${LIB1ASMFUNCS:S/$/.pico/} ASM_V =${LIB1ASMFUNCS:S/$/.vis/} -SOBJS += ${LIB1ASMFUNCS:S/$/.So/} +SOBJS += ${LIB1ASMFUNCS:S/$/.pico/} ${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ @@ -323,7 +323,7 @@ CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo # EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/} EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/} -EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} +EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.pico/} EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN .if ${TARGET_CPUARCH} != "riscv64" # RISCVTODO: unwinding support @@ -337,7 +337,7 @@ ${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor .for _src in ${LIB2ADDEHSHARED:M*.c} -${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} +${_src:R:S/$/.pico/}: ${_src} ${COMMONHDRS} ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .end
svn commit: r309787 - head/sys/netpfil/pf
Author: marcel Date: Sat Dec 10 03:31:38 2016 New Revision: 309787 URL: https://svnweb.freebsd.org/changeset/base/309787 Log: Improve upon r309394 Instead of taking an extra reference to deal with pfsync_q_ins() and pfsync_q_del() taken and dropping a reference (resp,) make it optional of those functions to take or drop a reference by passing an extra argument. Submitted by: glebius@ Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c == --- head/sys/netpfil/pf/if_pfsync.c Sat Dec 10 03:13:11 2016 (r309786) +++ head/sys/netpfil/pf/if_pfsync.c Sat Dec 10 03:31:38 2016 (r309787) @@ -161,8 +161,8 @@ static struct pfsync_q pfsync_qs[] = { { pfsync_out_del, sizeof(struct pfsync_del_c), PFSYNC_ACT_DEL_C } }; -static voidpfsync_q_ins(struct pf_state *, int); -static voidpfsync_q_del(struct pf_state *); +static voidpfsync_q_ins(struct pf_state *, int, bool); +static voidpfsync_q_del(struct pf_state *, bool); static voidpfsync_update_state(struct pf_state *); @@ -542,7 +542,7 @@ pfsync_state_import(struct pfsync_state if (!(flags & PFSYNC_SI_IOCTL)) { st->state_flags &= ~PFSTATE_NOSYNC; if (st->state_flags & PFSTATE_ACK) { - pfsync_q_ins(st, PFSYNC_S_IACK); + pfsync_q_ins(st, PFSYNC_S_IACK, true); pfsync_push(sc); } } @@ -1668,7 +1668,7 @@ pfsync_insert_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); - pfsync_q_ins(st, PFSYNC_S_INS); + pfsync_q_ins(st, PFSYNC_S_INS, true); PFSYNC_UNLOCK(sc); st->sync_updates = 0; @@ -1789,7 +1789,7 @@ static void pfsync_update_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; - int sync = 0; + bool sync = false, ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); @@ -1798,7 +1798,7 @@ pfsync_update_state(struct pf_state *st) pfsync_undefer_state(st, 0); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1815,14 +1815,17 @@ pfsync_update_state(struct pf_state *st) if (st->key[PF_SK_WIRE]->proto == IPPROTO_TCP) { st->sync_updates++; if (st->sync_updates >= sc->sc_maxupdates) - sync = 1; + sync = true; } break; case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD_C); + pfsync_q_ins(st, PFSYNC_S_UPD_C, ref); st->sync_updates = 0; break; @@ -1880,13 +1883,14 @@ static void pfsync_update_state_req(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PF_STATE_LOCK_ASSERT(st); PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1894,9 +1898,12 @@ pfsync_update_state_req(struct pf_state switch (st->sync_state) { case PFSYNC_S_UPD_C: case PFSYNC_S_IACK: - pfsync_q_del(st); + pfsync_q_del(st, false); + ref = false; + /* FALLTHROUGH */ + case PFSYNC_S_NONE: - pfsync_q_ins(st, PFSYNC_S_UPD); + pfsync_q_ins(st, PFSYNC_S_UPD, ref); pfsync_push(sc); break; @@ -1917,13 +1924,14 @@ static void pfsync_delete_state(struct pf_state *st) { struct pfsync_softc *sc = V_pfsyncif; + bool ref = true; PFSYNC_LOCK(sc); if (st->state_flags & PFSTATE_ACK) pfsync_undefer_state(st, 1); if (st->state_flags & PFSTATE_NOSYNC) { if (st->sync_state != PFSYNC_S_NONE) - pfsync_q_del(st); + pfsync_q_del(st, true); PFSYNC_UNLOCK(sc); return; } @@ -1931,30 +1939,27 @@ pfsync_delete_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); - pf_ref_state(st); - switch (st->sync_state) { case PFSYNC_S_I
Re: svn commit: r309394 - head/sys/netpfil/pf
> On Dec 8, 2016, at 2:48 PM, Gleb Smirnoff <mailto:gleb...@freebsd.org>> wrote: > > Marcel, > > On Wed, Dec 07, 2016 at 05:06:08PM -0800, Marcel Moolenaar wrote: > M> > thanks for the fixes. While the problem with the first chunk > M> > in pfsync_sendout() is obvious, the problem you are fixing in th > M> > second chunk in the pfsync_delete_state() is not clear to me. > M> > Can you please explain what scenario are you fixing there? > M> > M> State updates may be pending for state being deleted. This > M> means that the state is still sitting on either the PFSYNC_S_UPD > M> or PFSYNC_S_UPD_C queues. What pfsync(4) does in that case is > M> simply remove the state from those queues and add it to the > M> PFSYNC_S_DEL queue. > M> > M> But, pf(4) has already dropped the reference count for state > M> that’s deleted and the only reference is by pfsync(4) by virtue > M> of being on the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. When the > M> state gets dequeued from those queues, the reference count drops > M> to 0 and the state is deleted (read: memory freed). But the same > M> state is subsequently added to the PFSYNC_S_DEL queue — i.e. > M> after the memory was freed. > > Thanks for explanation, Marcel! Potentially this problem also exists > in pfsync_update_state() and in pfsync_update_state_req(). > > Your patch introduces extra unnecessary atomic operations, so let > me suggest another patch. It should be applied on top of yours, and > it also addresses pfsync_update_state() and in pfsync_update_state_req(). > > It isn't tested, but is pretty straightforward. I’ll give it a spin and commit. -- Marcel Moolenaar mar...@xcllnt.net <mailto:mar...@xcllnt.net> ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r309394 - head/sys/netpfil/pf
> On Dec 7, 2016, at 1:08 PM, Gleb Smirnoff <mailto:gleb...@freebsd.org>> wrote: > > Marcel, > > thanks for the fixes. While the problem with the first chunk > in pfsync_sendout() is obvious, the problem you are fixing in th > second chunk in the pfsync_delete_state() is not clear to me. > Can you please explain what scenario are you fixing there? State updates may be pending for state being deleted. This means that the state is still sitting on either the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. What pfsync(4) does in that case is simply remove the state from those queues and add it to the PFSYNC_S_DEL queue. But, pf(4) has already dropped the reference count for state that’s deleted and the only reference is by pfsync(4) by virtue of being on the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. When the state gets dequeued from those queues, the reference count drops to 0 and the state is deleted (read: memory freed). But the same state is subsequently added to the PFSYNC_S_DEL queue — i.e. after the memory was freed. HTH, -- Marcel Moolenaar mar...@xcllnt.net <mailto:mar...@xcllnt.net> ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r309394 - head/sys/netpfil/pf
> On Dec 7, 2016, at 1:08 PM, Gleb Smirnoff <mailto:gleb...@freebsd.org>> wrote: > > Marcel, > > thanks for the fixes. While the problem with the first chunk > in pfsync_sendout() is obvious, the problem you are fixing in th > second chunk in the pfsync_delete_state() is not clear to me. > Can you please explain what scenario are you fixing there? State updates may be pending for state being deleted. This means that the state is still sitting on either the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. What pfsync(4) does in that case is simply remove the state from those queues and add it to the PFSYNC_S_DEL queue. But, pf(4) has already dropped the reference count for state that’s deleted and the only reference is by pfsync(4) by virtue of being on the PFSYNC_S_UPD or PFSYNC_S_UPD_C queues. When the state gets dequeued from those queues, the reference count drops to 0 and the state is deleted (read: memory freed). But the same state is subsequently added to the PFSYNC_S_DEL queue — i.e. after the memory was freed. HTH, -- Marcel Moolenaar mar...@xcllnt.net <mailto:mar...@xcllnt.net> ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r309394 - head/sys/netpfil/pf
Author: marcel Date: Fri Dec 2 06:15:59 2016 New Revision: 309394 URL: https://svnweb.freebsd.org/changeset/base/309394 Log: Fix use-after-free bugs in pfsync(4) Use after free happens for state that is deleted. The reference count is what prevents the state from being freed. When the state is dequeued, the reference count is dropped and the memory freed. We can't dereference the next pointer or re-queue the state. MFC after:1 week Differential Revision:https://reviews.freebsd.org/D8671 Modified: head/sys/netpfil/pf/if_pfsync.c Modified: head/sys/netpfil/pf/if_pfsync.c == --- head/sys/netpfil/pf/if_pfsync.c Fri Dec 2 06:07:27 2016 (r309393) +++ head/sys/netpfil/pf/if_pfsync.c Fri Dec 2 06:15:59 2016 (r309394) @@ -1509,7 +1509,7 @@ pfsync_sendout(int schedswi) struct ip *ip; struct pfsync_header *ph; struct pfsync_subheader *subh; - struct pf_state *st; + struct pf_state *st, *st_next; struct pfsync_upd_req_item *ur; int offset; int q, count = 0; @@ -1559,7 +1559,7 @@ pfsync_sendout(int schedswi) offset += sizeof(*subh); count = 0; - TAILQ_FOREACH(st, &sc->sc_qs[q], sync_list) { + TAILQ_FOREACH_SAFE(st, &sc->sc_qs[q], sync_list, st_next) { KASSERT(st->sync_state == q, ("%s: st->sync_state == q", __func__)); @@ -1931,6 +1931,8 @@ pfsync_delete_state(struct pf_state *st) if (sc->sc_len == PFSYNC_MINPKT) callout_reset(&sc->sc_tmo, 1 * hz, pfsync_timeout, V_pfsyncif); + pf_ref_state(st); + switch (st->sync_state) { case PFSYNC_S_INS: /* We never got to tell the world so just forget about it. */ @@ -1950,6 +1952,9 @@ pfsync_delete_state(struct pf_state *st) default: panic("%s: unexpected sync state %d", __func__, st->sync_state); } + + pf_release_state(st); + PFSYNC_UNLOCK(sc); } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r308344 - head/usr.sbin/makefs
Author: marcel Date: Sat Nov 5 16:23:33 2016 New Revision: 308344 URL: https://svnweb.freebsd.org/changeset/base/308344 Log: Assign a random number to di_gen (for FFS), instead of extracting it from struct stat. We don't necessarily have permissions to see the generation number and the host OS may not have st_gen in struct stat anyway. Since the kernel assigns random numbers, there's nothing meaningful about the generation that requires us to preserve it when the file system image is created. With this change, all generation numbers come from random() and that makes it easier to add support for reproducible builds at some time in the future (i.e. by adding an argument to makefs that changes the behaviour of random() so that it always returns 0 or some predictable sequence). Differential Revision:https://reviews.freebsd.org/D8418 Modified: head/usr.sbin/makefs/Makefile head/usr.sbin/makefs/ffs.c Modified: head/usr.sbin/makefs/Makefile == --- head/usr.sbin/makefs/Makefile Sat Nov 5 16:17:07 2016 (r308343) +++ head/usr.sbin/makefs/Makefile Sat Nov 5 16:23:33 2016 (r308344) @@ -20,7 +20,6 @@ WARNS?= 2 .include "${SRCDIR}/ffs/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 -CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 .PATH: ${SRCTOP}/contrib/mtree CFLAGS+=-I${SRCTOP}/contrib/mtree Modified: head/usr.sbin/makefs/ffs.c == --- head/usr.sbin/makefs/ffs.c Sat Nov 5 16:17:07 2016(r308343) +++ head/usr.sbin/makefs/ffs.c Sat Nov 5 16:23:33 2016(r308344) @@ -666,9 +666,7 @@ ffs_build_dinode1(struct ufs1_dinode *di #if HAVE_STRUCT_STAT_ST_FLAGS dinp->di_flags = cur->inode->st.st_flags; #endif -#if HAVE_STRUCT_STAT_ST_GEN - dinp->di_gen = cur->inode->st.st_gen; -#endif + dinp->di_gen = random(); dinp->di_uid = cur->inode->st.st_uid; dinp->di_gid = cur->inode->st.st_gid; @@ -716,9 +714,7 @@ ffs_build_dinode2(struct ufs2_dinode *di #if HAVE_STRUCT_STAT_ST_FLAGS dinp->di_flags = cur->inode->st.st_flags; #endif -#if HAVE_STRUCT_STAT_ST_GEN - dinp->di_gen = cur->inode->st.st_gen; -#endif + dinp->di_gen = random(); dinp->di_uid = cur->inode->st.st_uid; dinp->di_gid = cur->inode->st.st_gid; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307967 - head/usr.sbin/config
Author: marcel Date: Wed Oct 26 15:58:41 2016 New Revision: 307967 URL: https://svnweb.freebsd.org/changeset/base/307967 Log: Allow config to be compiled from another source directory, such as one for building tools. This boils down to replacing ${.CURDIR} with ${SRCDIR}, where the latter is the directory in which this makefile lives. Also allow overriding where file2c comes from using ${FILE2C}. Modified: head/usr.sbin/config/Makefile Modified: head/usr.sbin/config/Makefile == --- head/usr.sbin/config/Makefile Wed Oct 26 15:19:18 2016 (r307966) +++ head/usr.sbin/config/Makefile Wed Oct 26 15:58:41 2016 (r307967) @@ -1,15 +1,20 @@ # @(#)Makefile8.1 (Berkeley) 6/6/93 # $FreeBSD$ +SRCDIR:=${.PARSEDIR:tA} + PROG= config MAN= config.5 config.8 SRCS= config.y main.c lang.l mkmakefile.c mkheaders.c \ mkoptions.c y.tab.h kernconf.c +FILE2C?=file2c + kernconf.c: kernconf.tmpl - file2c 'char kernconfstr[] = {' ',0};' < ${.CURDIR}/kernconf.tmpl > kernconf.c + ${FILE2C} 'char kernconfstr[] = {' ',0};' < \ + ${SRCDIR}/kernconf.tmpl > kernconf.c -CFLAGS+= -I. -I${.CURDIR} +CFLAGS+= -I. -I${SRCDIR} NO_WMISSING_VARIABLE_DECLARATIONS= ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307927 - in head/usr.sbin/makefs: . cd9660 ffs
Author: marcel Date: Tue Oct 25 16:29:15 2016 New Revision: 307927 URL: https://svnweb.freebsd.org/changeset/base/307927 Log: Be more precise when including headers so that we're less likely to depend on namespace pollution and as such become more portable. This means including headers like or , but also making sure we include system/host headers before local headers. While here: define ENOATTR as ENOMSG in mtree.c. There is no ENOATTR on Linux. With this, makefs is ready for compilation on macOS and Linux. Modified: head/usr.sbin/makefs/cd9660.c head/usr.sbin/makefs/cd9660/cd9660_archimedes.c head/usr.sbin/makefs/cd9660/iso9660_rrip.c head/usr.sbin/makefs/ffs/ffs_bswap.c head/usr.sbin/makefs/ffs/ffs_subr.c head/usr.sbin/makefs/mtree.c head/usr.sbin/makefs/walk.c Modified: head/usr.sbin/makefs/cd9660.c == --- head/usr.sbin/makefs/cd9660.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/cd9660.c Tue Oct 25 16:29:15 2016 (r307927) @@ -98,10 +98,11 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include #include +#include +#include +#include #include "makefs.h" #include "cd9660.h" Modified: head/usr.sbin/makefs/cd9660/cd9660_archimedes.c == --- head/usr.sbin/makefs/cd9660/cd9660_archimedes.c Tue Oct 25 16:28:30 2016(r307926) +++ head/usr.sbin/makefs/cd9660/cd9660_archimedes.c Tue Oct 25 16:29:15 2016(r307927) @@ -40,9 +40,11 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include #include +#include #include #include "makefs.h" Modified: head/usr.sbin/makefs/cd9660/iso9660_rrip.c == --- head/usr.sbin/makefs/cd9660/iso9660_rrip.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/cd9660/iso9660_rrip.c Tue Oct 25 16:29:15 2016 (r307927) @@ -35,14 +35,16 @@ * defined in iso9660_rrip.h */ -#include "makefs.h" -#include "cd9660.h" -#include "iso9660_rrip.h" +#include +__FBSDID("$FreeBSD$"); + #include +#include #include -#include -__FBSDID("$FreeBSD$"); +#include "makefs.h" +#include "cd9660.h" +#include "iso9660_rrip.h" static void cd9660_rrip_initialize_inode(cd9660node *); static int cd9660_susp_handle_continuation(cd9660node *); Modified: head/usr.sbin/makefs/ffs/ffs_bswap.c == --- head/usr.sbin/makefs/ffs/ffs_bswap.cTue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/ffs/ffs_bswap.cTue Oct 25 16:29:15 2016 (r307927) @@ -38,18 +38,19 @@ __FBSDID("$FreeBSD$"); #include #endif -#include -#include "ffs/ufs_bswap.h" -#include - #if !defined(_KERNEL) #include +#include #include #include #include #define panic(x) printf("%s\n", (x)), abort() #endif +#include +#include "ffs/ufs_bswap.h" +#include + #definefs_old_postblofffs_spare5[0] #definefs_old_rotbloff fs_spare5[1] #definefs_old_postbl_start fs_maxbsize Modified: head/usr.sbin/makefs/ffs/ffs_subr.c == --- head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/ffs/ffs_subr.c Tue Oct 25 16:29:15 2016 (r307927) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include Modified: head/usr.sbin/makefs/mtree.c == --- head/usr.sbin/makefs/mtree.cTue Oct 25 16:28:30 2016 (r307926) +++ head/usr.sbin/makefs/mtree.cTue Oct 25 16:29:15 2016 (r307927) @@ -44,10 +44,15 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include "makefs.h" +#ifndef ENOATTR +#defineENOATTR ENOMSG +#endif + #defineIS_DOT(nm) ((nm)[0] == '.' && (nm)[1] == '\0') #defineIS_DOTDOT(nm) ((nm)[0] == '.' && (nm)[1] == '.' && (nm)[2] == '\0') Modified: head/usr.sbin/makefs/walk.c == --- head/usr.sbin/makefs/walk.c Tue Oct 25 16:28:30 2016(r307926) +++ head/usr.sbin/makefs/walk.c Tue Oct 25 16:29:15 2016(r307927) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307923 - in head/usr.sbin/makefs: . cd9660 ffs
Author: marcel Date: Tue Oct 25 16:21:38 2016 New Revision: 307923 URL: https://svnweb.freebsd.org/changeset/base/307923 Log: Allow building makefs(8) from another Makefile (such as one in a seperate directory hierarchy used to build tools). This boils down to replacing the use of ${.CURDIR} with either ${SRCDIR} or ${SRCTOP}. SRCDIR is defined as the directory in which the Makefile lives that bmake(1) is currently reading. Use SRCTOP when reaching outside of makefs's directory. Modified: head/usr.sbin/makefs/Makefile head/usr.sbin/makefs/cd9660/Makefile.inc head/usr.sbin/makefs/ffs/Makefile.inc Modified: head/usr.sbin/makefs/Makefile == --- head/usr.sbin/makefs/Makefile Tue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/Makefile Tue Oct 25 16:21:38 2016 (r307923) @@ -1,10 +1,12 @@ # $FreeBSD$ +SRCDIR:=${.PARSEDIR:tA} + .include PROG= makefs -CFLAGS+=-I${.CURDIR} +CFLAGS+=-I${SRCDIR} SRCS= cd9660.c ffs.c \ makefs.c \ @@ -14,24 +16,24 @@ MAN=makefs.8 WARNS?=2 -.include "${.CURDIR}/cd9660/Makefile.inc" -.include "${.CURDIR}/ffs/Makefile.inc" +.include "${SRCDIR}/cd9660/Makefile.inc" +.include "${SRCDIR}/ffs/Makefile.inc" CFLAGS+=-DHAVE_STRUCT_STAT_ST_FLAGS=1 CFLAGS+=-DHAVE_STRUCT_STAT_ST_GEN=1 -.PATH: ${.CURDIR}/../../contrib/mtree -CFLAGS+=-I${.CURDIR}/../../contrib/mtree +.PATH: ${SRCTOP}/contrib/mtree +CFLAGS+=-I${SRCTOP}/contrib/mtree SRCS+= getid.c misc.c spec.c -.PATH: ${.CURDIR}/../../contrib/mknod -CFLAGS+=-I${.CURDIR}/../../contrib/mknod +.PATH: ${SRCTOP}/contrib/mknod +CFLAGS+=-I${SRCTOP}/contrib/mknod SRCS+= pack_dev.c -.PATH: ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${SRCTOP}/sys/ufs/ffs SRCS+= ffs_tables.c -CFLAGS+= -I${.CURDIR}/../../lib/libnetbsd +CFLAGS+= -I${SRCTOP}/lib/libnetbsd LIBADD=netbsd util sbuf .if ${MK_TESTS} != "no" Modified: head/usr.sbin/makefs/cd9660/Makefile.inc == --- head/usr.sbin/makefs/cd9660/Makefile.incTue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/cd9660/Makefile.incTue Oct 25 16:21:38 2016 (r307923) @@ -1,9 +1,9 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/cd9660 ${.CURDIR}/../../sys/fs/cd9660/ +.PATH: ${SRCDIR}/cd9660 ${SRCTOP}/sys/fs/cd9660/ -CFLAGS+=-I${.CURDIR}/../../sys/fs/cd9660/ +CFLAGS+=-I${SRCTOP}/sys/fs/cd9660/ SRCS+= cd9660_strings.c cd9660_debug.c cd9660_eltorito.c \ cd9660_write.c cd9660_conversion.c iso9660_rrip.c cd9660_archimedes.c Modified: head/usr.sbin/makefs/ffs/Makefile.inc == --- head/usr.sbin/makefs/ffs/Makefile.inc Tue Oct 25 16:14:11 2016 (r307922) +++ head/usr.sbin/makefs/ffs/Makefile.inc Tue Oct 25 16:21:38 2016 (r307923) @@ -1,9 +1,9 @@ # $FreeBSD$ # -.PATH: ${.CURDIR}/ffs ${.CURDIR}/../../sys/ufs/ffs +.PATH: ${SRCDIR}/ffs ${SRCTOP}/sys/ufs/ffs -CFLAGS+= -I${.CURDIR}/../../sys/ufs/ffs +CFLAGS+= -I${SRCTOP}/sys/ufs/ffs SRCS+= ffs_alloc.c ffs_balloc.c ffs_bswap.c ffs_subr.c ufs_bmap.c SRCS+= buf.c mkfs.c ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307874 - head/sys/ufs/ffs
Author: marcel Date: Mon Oct 24 18:12:57 2016 New Revision: 307874 URL: https://svnweb.freebsd.org/changeset/base/307874 Log: Include explicitly instead of depending on that header being included by . When compiled as part of makefs(8) and on macOS or Linux, is not our own. Modified: head/sys/ufs/ffs/ffs_tables.c Modified: head/sys/ufs/ffs/ffs_tables.c == --- head/sys/ufs/ffs/ffs_tables.c Mon Oct 24 18:03:04 2016 (r307873) +++ head/sys/ufs/ffs/ffs_tables.c Mon Oct 24 18:12:57 2016 (r307874) @@ -33,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307873 - head/sys/kern
Author: marcel Date: Mon Oct 24 18:03:04 2016 New Revision: 307873 URL: https://svnweb.freebsd.org/changeset/base/307873 Log: Include instead of when compiled as part of libsbuf. The former is the standard header, and allows us to compile libsbuf on macOS/linux. Modified: head/sys/kern/subr_prf.c Modified: head/sys/kern/subr_prf.c == --- head/sys/kern/subr_prf.cMon Oct 24 17:59:25 2016(r307872) +++ head/sys/kern/subr_prf.cMon Oct 24 18:03:04 2016(r307873) @@ -72,7 +72,11 @@ __FBSDID("$FreeBSD$"); * Note that stdarg.h and the ANSI style va_start macro is used for both * ANSI and traditional C compilers. */ +#ifdef _KERNEL #include +#else +#include +#endif #ifdef _KERNEL ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307872 - head/share/mk
Author: marcel Date: Mon Oct 24 17:59:25 2016 New Revision: 307872 URL: https://svnweb.freebsd.org/changeset/base/307872 Log: Detect clang on macOS. The version string is slightly different. Modified: head/share/mk/bsd.compiler.mk Modified: head/share/mk/bsd.compiler.mk == --- head/share/mk/bsd.compiler.mk Mon Oct 24 17:57:46 2016 (r307871) +++ head/share/mk/bsd.compiler.mk Mon Oct 24 17:59:25 2016 (r307872) @@ -147,7 +147,7 @@ ${X_}COMPILER_TYPE:=clang ${X_}COMPILER_TYPE:= gcc . elif ${_v:M\(GCC\)} ${X_}COMPILER_TYPE:= gcc -. elif ${_v:Mclang} +. elif ${_v:Mclang} || ${_v:M(clang-*.*.*)} ${X_}COMPILER_TYPE:= clang . else .error Unable to determine compiler type for ${cc}=${${cc}}. Consider setting ${X_}COMPILER_TYPE. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307871 - head/lib/libnetbsd
Author: marcel Date: Mon Oct 24 17:57:46 2016 New Revision: 307871 URL: https://svnweb.freebsd.org/changeset/base/307871 Log: Include "util.h", not . The header is in the same directory as the C file. There may be a on the host when compiling on macOS or Linux, causing conflicts. Modified: head/lib/libnetbsd/util.c Modified: head/lib/libnetbsd/util.c == --- head/lib/libnetbsd/util.c Mon Oct 24 17:56:08 2016(r307870) +++ head/lib/libnetbsd/util.c Mon Oct 24 17:57:46 2016(r307871) @@ -36,7 +36,8 @@ #include #include #include -#include + +#include "util.h" char * flags_to_string(u_long flags, const char *def) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307870 - head/lib/libnetbsd/sys
Author: marcel Date: Mon Oct 24 17:56:08 2016 New Revision: 307870 URL: https://svnweb.freebsd.org/changeset/base/307870 Log: When compiling on macOS or Linux, __dead can be defined already. Conditionally define __dead. Modified: head/lib/libnetbsd/sys/cdefs.h Modified: head/lib/libnetbsd/sys/cdefs.h == --- head/lib/libnetbsd/sys/cdefs.h Mon Oct 24 17:37:21 2016 (r307869) +++ head/lib/libnetbsd/sys/cdefs.h Mon Oct 24 17:56:08 2016 (r307870) @@ -35,11 +35,13 @@ #include_next +#ifndef __dead #ifdef __dead2 #define __dead __dead2 #else #define __dead #endif +#endif /* !__dead */ /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r307544 - head/usr.bin/mkimg
On October 17, 2016 at 8:34:11 PM, Ngie Cooper (yaneurab...@gmail.com) wrote: > On Oct 17, 2016, at 18:55, Marcel Moolenaar wrote: > *snip* > +CFLAGS+=-I${SRCTOP}/sys/sys/disk Isn't it a better app idea to maintain the disk/ namespace for includes? Thanks! You mean, add -I${SRCTOP}//sys/sys on the compile line and change the code to use #include ? Unfortunately, that creates conflicts with header files that are included as and match headers we have under sys/sys. signature.asc Description: Message signed with OpenPGP using AMPGpg
svn commit: r307544 - head/usr.bin/mkimg
nst void *buf, size_t sz) return (crc ^ ~0U); } -static void -gpt_uuid_enc(void *buf, const uuid_t *uuid) -{ - uint8_t *p = buf; - int i; - - le32enc(p, uuid->time_low); - le16enc(p + 4, uuid->time_mid); - le16enc(p + 6, uuid->time_hi_and_version); - p[8] = uuid->clock_seq_hi_and_reserved; - p[9] = uuid->clock_seq_low; - for (i = 0; i < _UUID_NODE_LEN; i++) - p[10 + i] = uuid->node[i]; -} - static u_int gpt_tblsz(void) { @@ -194,7 +178,7 @@ gpt_write_pmbr(lba_t blks, void *bootcod static struct gpt_ent * gpt_mktbl(u_int tblsz) { - uuid_t uuid; + mkimg_uuid_t uuid; struct gpt_ent *tbl, *ent; struct part *part; int c, idx; @@ -205,9 +189,9 @@ gpt_mktbl(u_int tblsz) TAILQ_FOREACH(part, &partlist, link) { ent = tbl + part->index; - gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); + mkimg_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); mkimg_uuid(&uuid); - gpt_uuid_enc(&ent->ent_uuid, &uuid); + mkimg_uuid_enc(&ent->ent_uuid, &uuid); le64enc(&ent->ent_lba_start, part->block); le64enc(&ent->ent_lba_end, part->block + part->size - 1); if (part->label != NULL) { @@ -238,7 +222,7 @@ gpt_write_hdr(struct gpt_hdr *hdr, uint6 static int gpt_write(lba_t imgsz, void *bootcode) { - uuid_t uuid; + mkimg_uuid_t uuid; struct gpt_ent *tbl; struct gpt_hdr *hdr; uint32_t crc; @@ -275,7 +259,7 @@ gpt_write(lba_t imgsz, void *bootcode) le64enc(&hdr->hdr_lba_start, 2 + tblsz); le64enc(&hdr->hdr_lba_end, imgsz - tblsz - 2); mkimg_uuid(&uuid); - gpt_uuid_enc(&hdr->hdr_uuid, &uuid); + mkimg_uuid_enc(&hdr->hdr_uuid, &uuid); le32enc(&hdr->hdr_entries, nparts); le32enc(&hdr->hdr_entsz, sizeof(struct gpt_ent)); crc = crc32(tbl, nparts * sizeof(struct gpt_ent)); Modified: head/usr.bin/mkimg/mbr.c == --- head/usr.bin/mkimg/mbr.cTue Oct 18 01:42:42 2016(r307543) +++ head/usr.bin/mkimg/mbr.cTue Oct 18 01:55:07 2016(r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Modified: head/usr.bin/mkimg/mkimg.c == --- head/usr.bin/mkimg/mkimg.c Tue Oct 18 01:42:42 2016(r307543) +++ head/usr.bin/mkimg/mkimg.c Tue Oct 18 01:55:07 2016(r307544) @@ -28,7 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include #include #include @@ -374,22 +373,6 @@ mkimg_chs(lba_t lba, u_int maxcyl, u_int *secp = sec; } -void -mkimg_uuid(struct uuid *uuid) -{ - static uint8_t gen[sizeof(struct uuid)]; - u_int i; - - if (!unit_testing) { - uuidgen(uuid, 1); - return; - } - - for (i = 0; i < sizeof(gen); i++) - gen[i]++; - memcpy(uuid, gen, sizeof(uuid_t)); -} - static int capacity_resize(lba_t end) { Modified: head/usr.bin/mkimg/mkimg.h == --- head/usr.bin/mkimg/mkimg.h Tue Oct 18 01:42:42 2016(r307543) +++ head/usr.bin/mkimg/mkimg.h Tue Oct 18 01:55:07 2016(r307544) @@ -30,6 +30,7 @@ #define_MKIMG_MKIMG_H_ #include +#include struct part { TAILQ_ENTRY(part) link; @@ -89,7 +90,17 @@ ssize_t sparse_write(int, const void *, void mkimg_chs(lba_t, u_int, u_int *, u_int *, u_int *); -struct uuid; -void mkimg_uuid(struct uuid *); +struct mkimg_uuid { + uint32_ttime_low; + uint16_ttime_mid; + uint16_ttime_hi_and_version; + uint8_t clock_seq_hi_and_reserved; + uint8_t clock_seq_low; + uint8_t node[6]; +}; +typedef struct mkimg_uuid mkimg_uuid_t; + +void mkimg_uuid(mkimg_uuid_t *); +void mkimg_uuid_enc(void *, const mkimg_uuid_t *); #endif /* _MKIMG_MKIMG_H_ */ Modified: head/usr.bin/mkimg/pc98.c == --- head/usr.bin/mkimg/pc98.c Tue Oct 18 01:42:42 2016(r307543) +++ head/usr.bin/mkimg/pc98.c Tue Oct 18 01:55:07 2016(r307544) @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" Added: head/usr.bin/mkimg/uuid.c == --- /dev/null 00:00:00 1970 (empty, because fil
svn commit: r307543 - head/share/mk
Author: marcel Date: Tue Oct 18 01:42:42 2016 New Revision: 307543 URL: https://svnweb.freebsd.org/changeset/base/307543 Log: Add LORDER, TSORT and TSORTFLAGS variables and replace the hardcoded utility names and tsort flags. Modified: head/share/mk/bsd.lib.mk head/share/mk/sys.mk Modified: head/share/mk/bsd.lib.mk == --- head/share/mk/bsd.lib.mkTue Oct 18 00:55:15 2016(r307542) +++ head/share/mk/bsd.lib.mkTue Oct 18 01:42:42 2016(r307543) @@ -178,7 +178,8 @@ _LIBS= lib${LIB_PRIVATE}${LIB}.a lib${LIB_PRIVATE}${LIB}.a: ${OBJS} ${STATICOBJS} @${ECHO} building static ${LIB} library @rm -f ${.TARGET} - ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${OBJS} ${STATICOBJS} | tsort -q` ${ARADD} + ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ + ${LORDER} ${OBJS} ${STATICOBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} ${RANLIB} ${RANLIBFLAGS} ${.TARGET} .endif @@ -193,7 +194,8 @@ CLEANFILES+=${POBJS} lib${LIB_PRIVATE}${LIB}_p.a: ${POBJS} @${ECHO} building profiled ${LIB} library @rm -f ${.TARGET} - ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${POBJS} | tsort -q` ${ARADD} + ${AR} ${ARFLAGS} ${.TARGET} `NM='${NM}' NMFLAGS='${NMFLAGS}' \ + ${LORDER} ${POBJS} | ${TSORT} ${TSORTFLAGS}` ${ARADD} ${RANLIB} ${RANLIBFLAGS} ${.TARGET} .endif @@ -241,7 +243,8 @@ ${SHLIB_NAME_FULL}: ${SOBJS} .endif ${_LD:N${CCACHE_BIN}} ${LDFLAGS} ${SSP_CFLAGS} ${SOLINKOPTS} \ -o ${.TARGET} -Wl,-soname,${SONAME} \ - `NM='${NM}' NMFLAGS='${NMFLAGS}' lorder ${SOBJS} | tsort -q` ${LDADD} + `NM='${NM}' NMFLAGS='${NMFLAGS}' ${LORDER} ${SOBJS} | \ + ${TSORT} ${TSORTFLAGS}` ${LDADD} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${SOBJS} .endif Modified: head/share/mk/sys.mk == --- head/share/mk/sys.mkTue Oct 18 00:55:15 2016(r307542) +++ head/share/mk/sys.mkTue Oct 18 01:42:42 2016(r307543) @@ -229,6 +229,8 @@ LINTLIBFLAGS?= -cghapbxu -C ${LIB} MAKE ?= make .if !defined(%POSIX) +LORDER ?= lorder + NM ?= nm NMFLAGS?= @@ -242,6 +244,9 @@ PFLAGS ?= RC ?= f77 RFLAGS ?= + +TSORT ?= tsort +TSORTFLAGS ?= -q .endif SHELL ?= sh ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r307387 - head/usr.bin/mkimg
Author: marcel Date: Sun Oct 16 02:55:52 2016 New Revision: 307387 URL: https://svnweb.freebsd.org/changeset/base/307387 Log: Switch to using the portable partition scheme headers. Modified: head/usr.bin/mkimg/Makefile head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/Makefile == --- head/usr.bin/mkimg/Makefile Sun Oct 16 02:43:51 2016(r307386) +++ head/usr.bin/mkimg/Makefile Sun Oct 16 02:55:52 2016(r307387) @@ -11,6 +11,7 @@ mkimg.o: Makefile CFLAGS+=-DMKIMG_VERSION=${MKIMG_VERSION} CFLAGS+=-DSPARSE_WRITE +CFLAGS+=-I${.CURDIR:H:H}/sys # List of formats to support SRCS+= \ Modified: head/usr.bin/mkimg/apm.c == --- head/usr.bin/mkimg/apm.cSun Oct 16 02:43:51 2016(r307386) +++ head/usr.bin/mkimg/apm.cSun Oct 16 02:55:52 2016(r307387) @@ -33,20 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef APM_ENT_TYPE_APPLE_BOOT -#defineAPM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" -#endif -#ifndef APM_ENT_TYPE_FREEBSD_NANDFS -#defineAPM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" -#endif - static struct mkimg_alias apm_aliases[] = { { ALIAS_FREEBSD, ALIAS_PTR2TYPE(APM_ENT_TYPE_FREEBSD) }, { ALIAS_FREEBSD_BOOT, ALIAS_PTR2TYPE(APM_ENT_TYPE_APPLE_BOOT) }, Modified: head/usr.bin/mkimg/bsd.c == --- head/usr.bin/mkimg/bsd.cSun Oct 16 02:43:51 2016(r307386) +++ head/usr.bin/mkimg/bsd.cSun Oct 16 02:55:52 2016(r307387) @@ -33,17 +33,13 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include #include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" -#ifndef FS_NANDFS -#defineFS_NANDFS 30 -#endif - static struct mkimg_alias bsd_aliases[] = { { ALIAS_FREEBSD_NANDFS, ALIAS_INT2TYPE(FS_NANDFS) }, { ALIAS_FREEBSD_SWAP, ALIAS_INT2TYPE(FS_SWAP) }, @@ -58,7 +54,7 @@ bsd_metadata(u_int where, lba_t blk) { if (where == SCHEME_META_IMG_START) - blk += BBSIZE / secsz; + blk += BSD_BOOTBLOCK_SIZE / secsz; else if (where == SCHEME_META_IMG_END) blk = round_cylinder(blk); else @@ -76,21 +72,21 @@ bsd_write(lba_t imgsz, void *bootcode) int bsdparts, error, n; uint16_t checksum; - buf = malloc(BBSIZE); + buf = malloc(BSD_BOOTBLOCK_SIZE); if (buf == NULL) return (ENOMEM); if (bootcode != NULL) { - memcpy(buf, bootcode, BBSIZE); + memcpy(buf, bootcode, BSD_BOOTBLOCK_SIZE); memset(buf + secsz, 0, sizeof(struct disklabel)); } else - memset(buf, 0, BBSIZE); + memset(buf, 0, BSD_BOOTBLOCK_SIZE); bsdparts = nparts + 1; /* Account for c partition */ - if (bsdparts < MAXPARTITIONS) - bsdparts = MAXPARTITIONS; + if (bsdparts < BSD_NPARTS_MIN) + bsdparts = BSD_NPARTS_MIN; d = (void *)(buf + secsz); - le32enc(&d->d_magic, DISKMAGIC); + le32enc(&d->d_magic, BSD_MAGIC); le32enc(&d->d_secsize, secsz); le32enc(&d->d_nsectors, nsecs); le32enc(&d->d_ntracks, nheads); @@ -98,14 +94,14 @@ bsd_write(lba_t imgsz, void *bootcode) le32enc(&d->d_secpercyl, nsecs * nheads); le32enc(&d->d_secperunit, imgsz); le16enc(&d->d_rpm, 3600); - le32enc(&d->d_magic2, DISKMAGIC); + le32enc(&d->d_magic2, BSD_MAGIC); le16enc(&d->d_npartitions, bsdparts); - le32enc(&d->d_bbsize, BBSIZE); + le32enc(&d->d_bbsize, BSD_BOOTBLOCK_SIZE); - dp = &d->d_partitions[RAW_PART]; + dp = &d->d_partitions[BSD_PART_RAW]; le32enc(&dp->p_size, imgsz); TAILQ_FOREACH(part, &partlist, link) { - n = part->index + ((part->index >= RAW_PART) ? 1 : 0); + n = part->index + ((part->index >= BSD_PART_RAW) ? 1 : 0); dp = &d->d_partitions[n]; le32enc(&dp->p_size, part->size); le32enc(&dp->p_offset, part->block); @@ -121,7 +117,7 @@ bsd_write(lba_t imgsz, void *bootcode) checksum ^= le16dec(p); le16enc(&d->d_checksum, checksum); - error = image_write(0, buf, BBSIZE / secsz); + error = image_write(0, buf, BSD_BOOTBLOCK_SIZE / secsz); free(buf); return (error); } @@ -132,8 +128,8 @@ static struct mkimg_scheme bsd_scheme = .aliases = bsd_aliases, .metadata = bsd_metadata, .write = b
svn commit: r307386 - in head: etc/mtree include sys/sys sys/sys/disk
Author: marcel Date: Sun Oct 16 02:43:51 2016 New Revision: 307386 URL: https://svnweb.freebsd.org/changeset/base/307386 Log: Re-apply change 306811 or alternatively, revert change 307385. Added: head/sys/sys/disk/ head/sys/sys/disk/apm.h - copied, changed from r307385, head/sys/sys/apm.h head/sys/sys/disk/bsd.h - copied, changed from r307385, head/sys/sys/disklabel.h head/sys/sys/disk/gpt.h - copied, changed from r307385, head/sys/sys/gpt.h head/sys/sys/disk/mbr.h - copied, changed from r307385, head/sys/sys/diskmbr.h head/sys/sys/disk/pc98.h - copied, changed from r307385, head/sys/sys/diskpc98.h head/sys/sys/disk/vtoc.h - copied, changed from r307385, head/sys/sys/vtoc.h Modified: head/etc/mtree/BSD.include.dist head/include/Makefile head/sys/sys/apm.h head/sys/sys/disklabel.h head/sys/sys/diskmbr.h head/sys/sys/diskpc98.h head/sys/sys/gpt.h head/sys/sys/vtoc.h Modified: head/etc/mtree/BSD.include.dist == --- head/etc/mtree/BSD.include.dist Sun Oct 16 02:05:22 2016 (r307385) +++ head/etc/mtree/BSD.include.dist Sun Oct 16 02:43:51 2016 (r307386) @@ -336,6 +336,8 @@ ssp .. sys +disk +.. .. teken .. Modified: head/include/Makefile == --- head/include/Makefile Sun Oct 16 02:05:22 2016(r307385) +++ head/include/Makefile Sun Oct 16 02:43:51 2016(r307386) @@ -59,6 +59,7 @@ LSUBDIRS= cam/ata cam/nvme cam/scsi \ security/audit \ security/mac_biba security/mac_bsdextended security/mac_lomac \ security/mac_mls security/mac_partition \ + sys/disk \ ufs/ffs ufs/ufs LSUBSUBDIRS= dev/mpt/mpilib Modified: head/sys/sys/apm.h == --- head/sys/sys/apm.h Sun Oct 16 02:05:22 2016(r307385) +++ head/sys/sys/apm.h Sun Oct 16 02:43:51 2016(r307386) @@ -1,69 +1,5 @@ /*- - * Copyright (c) 2007 Marcel Moolenaar - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - *notice, this list of conditions and the following disclaimer in the - *documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ + * This file is in the public domain. */ - -#ifndef _SYS_APM_H_ -#define_SYS_APM_H_ - -/* Driver Descriptor Record. */ -struct apm_ddr { - uint16_tddr_sig; -#defineAPM_DDR_SIG 0x4552 - uint16_tddr_blksize; - uint32_tddr_blkcount; -}; - -#defineAPM_ENT_NAMELEN 32 -#defineAPM_ENT_TYPELEN 32 - -/* Partition Map Entry Record. */ -struct apm_ent { - uint16_tent_sig; -#defineAPM_ENT_SIG 0x504d - uint16_t_pad_; - uint32_tent_pmblkcnt; - uint32_tent_start; - uint32_tent_size; - charent_name[APM_ENT_NAMELEN]; - charent_type[APM_ENT_TYPELEN]; -}; - -#defineAPM_ENT_TYPE_SELF "Apple_partition_map" -#defineAPM_ENT_TYPE_UNUSED "Apple_Free" - -#defineAPM_ENT_TYPE_FREEBSD"FreeBSD" -#defineAPM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" -#defineAPM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap" -#defineAPM_ENT_TYPE_FREEBSD_UFS"FreeBSD-UFS" -#defineAPM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum" -#defineAPM_ENT_TYPE_FREEBSD_ZFS"FreeBSD-ZFS" - -#defineAPM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" -#defineAPM_ENT_TYPE_APPLE_HFS &q
svn commit: r307385 - in head: etc/mtree include sys/sys sys/sys/disk
Author: marcel Date: Sun Oct 16 02:05:22 2016 New Revision: 307385 URL: https://svnweb.freebsd.org/changeset/base/307385 Log: Revert change 306811 so that the change can be re-done using svn copy instead of svn move. This to preserve history on the originals headers as well. Replaced: head/sys/sys/apm.h - copied unchanged from r306810, head/sys/sys/apm.h head/sys/sys/disklabel.h - copied unchanged from r306810, head/sys/sys/disklabel.h head/sys/sys/diskmbr.h - copied unchanged from r306810, head/sys/sys/diskmbr.h head/sys/sys/diskpc98.h - copied unchanged from r306810, head/sys/sys/diskpc98.h head/sys/sys/gpt.h - copied unchanged from r306810, head/sys/sys/gpt.h head/sys/sys/vtoc.h - copied unchanged from r306810, head/sys/sys/vtoc.h Deleted: head/sys/sys/disk/ Modified: head/etc/mtree/BSD.include.dist head/include/Makefile Modified: head/etc/mtree/BSD.include.dist == --- head/etc/mtree/BSD.include.dist Sat Oct 15 23:46:55 2016 (r307384) +++ head/etc/mtree/BSD.include.dist Sun Oct 16 02:05:22 2016 (r307385) @@ -336,8 +336,6 @@ ssp .. sys -disk -.. .. teken .. Modified: head/include/Makefile == --- head/include/Makefile Sat Oct 15 23:46:55 2016(r307384) +++ head/include/Makefile Sun Oct 16 02:05:22 2016(r307385) @@ -59,7 +59,6 @@ LSUBDIRS= cam/ata cam/nvme cam/scsi \ security/audit \ security/mac_biba security/mac_bsdextended security/mac_lomac \ security/mac_mls security/mac_partition \ - sys/disk \ ufs/ffs ufs/ufs LSUBSUBDIRS= dev/mpt/mpilib Copied: head/sys/sys/apm.h (from r306810, head/sys/sys/apm.h) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/apm.h Sun Oct 16 02:05:22 2016(r307385, copy of r306810, head/sys/sys/apm.h) @@ -0,0 +1,69 @@ +/*- + * Copyright (c) 2007 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _SYS_APM_H_ +#define_SYS_APM_H_ + +/* Driver Descriptor Record. */ +struct apm_ddr { + uint16_tddr_sig; +#defineAPM_DDR_SIG 0x4552 + uint16_tddr_blksize; + uint32_tddr_blkcount; +}; + +#defineAPM_ENT_NAMELEN 32 +#defineAPM_ENT_TYPELEN 32 + +/* Partition Map Entry Record. */ +struct apm_ent { + uint16_tent_sig; +#defineAPM_ENT_SIG 0x504d + uint16_t_pad_; + uint32_tent_pmblkcnt; + uint32_tent_start; + uint32_tent_size; + charent_name[APM_ENT_NAMELEN]; + charent_type[APM_ENT_TYPELEN]; +}; + +#defineAPM_ENT_TYPE_SELF "Apple_partition_map" +#defineAPM_ENT_TYPE_UNUSED "Apple_Free" + +#defineAPM_ENT_TYPE_FREEBSD"FreeBSD" +#defineAPM_ENT_TYPE_FREEBSD_NANDFS "FreeBSD-nandfs" +#defineAPM_ENT_TYPE_FREEBSD_SWAP "FreeBSD-swap" +#defineAPM_ENT_TYPE_FREEBSD_UFS"FreeBSD-UFS" +#defineAPM_ENT_TYPE_FREEBSD_VINUM "FreeBSD-Vinum" +#defineAPM_ENT_TYPE_FREEBSD_ZFS"FreeBSD-ZFS" + +#defineAPM_ENT_TYPE_APPLE_BOOT "Apple_Bootstrap" +#defineAPM_ENT_TYPE_APPLE_HFS "Apple_HFS&quo
Re: svn commit: r306811 - in head: etc/mtree include sys/sys sys/sys/disk
On October 7, 2016 at 5:13:10 PM, Julian Elischer (jul...@freebsd.org) wrote: On 7/10/2016 4:29 PM, Marcel Moolenaar wrote: On October 7, 2016 at 4:18:31 PM, Julian Elischer (jul...@freebsd.org) wrote: On 7/10/2016 4:12 PM, Marcel Moolenaar wrote: On October 7, 2016 at 3:18:10 PM, John Baldwin (j...@freebsd.org) wrote: On Friday, October 07, 2016 01:16:59 PM Marcel Moolenaar wrote: > On October 7, 2016 at 11:02:44 AM, John Baldwin (j...@freebsd.org) wrote: > On Friday, October 07, 2016 03:42:21 PM Marcel Moolenaar wrote: > *snip* > > > Author: marcel > > Date: Fri Oct 7 15:42:20 2016 > > New Revision: 306811 > > URL: https://svnweb.freebsd.org/changeset/base/306811 > > > > Added: > > head/sys/sys/disk/ > > head/sys/sys/disk/apm.h > > - copied, changed from r306810, head/sys/sys/apm.h > > head/sys/sys/disk/bsd.h > > - copied, changed from r306810, head/sys/sys/disklabel.h > > head/sys/sys/disk/gpt.h > > - copied, changed from r306810, head/sys/sys/gpt.h > > head/sys/sys/disk/mbr.h > > - copied, changed from r306810, head/sys/sys/diskmbr.h > > head/sys/sys/disk/pc98.h > > - copied, changed from r306810, head/sys/sys/diskpc98.h > > head/sys/sys/disk/vtoc.h > > - copied, changed from r306810, head/sys/sys/vtoc.h > > Replaced: > > head/sys/sys/apm.h (contents, props changed) > > head/sys/sys/disklabel.h (contents, props changed) > > head/sys/sys/diskmbr.h (contents, props changed) > > head/sys/sys/diskpc98.h (contents, props changed) > > head/sys/sys/gpt.h (contents, props changed) > > head/sys/sys/vtoc.h (contents, props changed) > > Somehow this destroyed the history on these files. They showed up as > deleted and then added instead of modified. If you 'svn log' on them > now you only get this commit and none of the previous history. I've > no idea if there's a way to recover this? Had you originally done an > 'svn mv' in your checkout and then copied the files back over or some > such? > I did a move from sys/X.h to sys/disk/X.h. The history moved to sys/disk/X.h. > New files were put where the old files used to be. > > Should I have done a svn copy? I think a copy would have been best. There is content in the sys/foo.h files still that has valid history (not all the lines were moved). Even if you had moved it all, I think a copy would still be best. I would only use a move if you are completely removing the original file. I'm not sure if there's a non-unfun way to recover from this. You might be able to copy the files from the previous revision, reapply your changes and then commit that. Ok. I’ll work on recovering the history of the original files. Maybe the repo masters can undo/delete the commit easily and I’ll just recommit. Avoids polluting the history… I'll keep an eye out for my svn -> p4 mirror importer exploding in that area in the near future. this sort of thing makes it very ill, especially files going away and coming back. I just asked svnadm@ for advice. I’m sure they can suggest a way that doesn’t blow things up downstream consumers. I’m fine with the manual labor if that’s preferred... I run a svn-> P4 imoprter that is importign at 1:1.. so change 30 in SVN is 30 in p4. If we end up making extra or missing revisions, I'll lose that 1:1 feature ..e.g. if 35 in svn maps to 350001 or 34 in p4 that's a lot less useful to me.. I’ll keep that in mind. If svnadm@ has no strong opinions, I’ll manually fix it up using commits. Thanks for the info, signature.asc Description: Message signed with OpenPGP using AMPGpg
Re: svn commit: r306811 - in head: etc/mtree include sys/sys sys/sys/disk
On October 7, 2016 at 4:18:31 PM, Julian Elischer (jul...@freebsd.org) wrote: On 7/10/2016 4:12 PM, Marcel Moolenaar wrote: On October 7, 2016 at 3:18:10 PM, John Baldwin (j...@freebsd.org) wrote: On Friday, October 07, 2016 01:16:59 PM Marcel Moolenaar wrote: > On October 7, 2016 at 11:02:44 AM, John Baldwin (j...@freebsd.org) wrote: > On Friday, October 07, 2016 03:42:21 PM Marcel Moolenaar wrote: > *snip* > > > Author: marcel > > Date: Fri Oct 7 15:42:20 2016 > > New Revision: 306811 > > URL: https://svnweb.freebsd.org/changeset/base/306811 > > > > Added: > > head/sys/sys/disk/ > > head/sys/sys/disk/apm.h > > - copied, changed from r306810, head/sys/sys/apm.h > > head/sys/sys/disk/bsd.h > > - copied, changed from r306810, head/sys/sys/disklabel.h > > head/sys/sys/disk/gpt.h > > - copied, changed from r306810, head/sys/sys/gpt.h > > head/sys/sys/disk/mbr.h > > - copied, changed from r306810, head/sys/sys/diskmbr.h > > head/sys/sys/disk/pc98.h > > - copied, changed from r306810, head/sys/sys/diskpc98.h > > head/sys/sys/disk/vtoc.h > > - copied, changed from r306810, head/sys/sys/vtoc.h > > Replaced: > > head/sys/sys/apm.h (contents, props changed) > > head/sys/sys/disklabel.h (contents, props changed) > > head/sys/sys/diskmbr.h (contents, props changed) > > head/sys/sys/diskpc98.h (contents, props changed) > > head/sys/sys/gpt.h (contents, props changed) > > head/sys/sys/vtoc.h (contents, props changed) > > Somehow this destroyed the history on these files. They showed up as > deleted and then added instead of modified. If you 'svn log' on them > now you only get this commit and none of the previous history. I've > no idea if there's a way to recover this? Had you originally done an > 'svn mv' in your checkout and then copied the files back over or some > such? > I did a move from sys/X.h to sys/disk/X.h. The history moved to sys/disk/X.h. > New files were put where the old files used to be. > > Should I have done a svn copy? I think a copy would have been best. There is content in the sys/foo.h files still that has valid history (not all the lines were moved). Even if you had moved it all, I think a copy would still be best. I would only use a move if you are completely removing the original file. I'm not sure if there's a non-unfun way to recover from this. You might be able to copy the files from the previous revision, reapply your changes and then commit that. Ok. I’ll work on recovering the history of the original files. Maybe the repo masters can undo/delete the commit easily and I’ll just recommit. Avoids polluting the history… I'll keep an eye out for my svn -> p4 mirror importer exploding in that area in the near future. this sort of thing makes it very ill, especially files going away and coming back. I just asked svnadm@ for advice. I’m sure they can suggest a way that doesn’t blow things up downstream consumers. I’m fine with the manual labor if that’s preferred... signature.asc Description: Message signed with OpenPGP using AMPGpg
Re: svn commit: r306811 - in head: etc/mtree include sys/sys sys/sys/disk
On October 7, 2016 at 3:18:10 PM, John Baldwin (j...@freebsd.org) wrote: On Friday, October 07, 2016 01:16:59 PM Marcel Moolenaar wrote: > On October 7, 2016 at 11:02:44 AM, John Baldwin (j...@freebsd.org) wrote: > On Friday, October 07, 2016 03:42:21 PM Marcel Moolenaar wrote: > *snip* > > > Author: marcel > > Date: Fri Oct 7 15:42:20 2016 > > New Revision: 306811 > > URL: https://svnweb.freebsd.org/changeset/base/306811 > > > > Added: > > head/sys/sys/disk/ > > head/sys/sys/disk/apm.h > > - copied, changed from r306810, head/sys/sys/apm.h > > head/sys/sys/disk/bsd.h > > - copied, changed from r306810, head/sys/sys/disklabel.h > > head/sys/sys/disk/gpt.h > > - copied, changed from r306810, head/sys/sys/gpt.h > > head/sys/sys/disk/mbr.h > > - copied, changed from r306810, head/sys/sys/diskmbr.h > > head/sys/sys/disk/pc98.h > > - copied, changed from r306810, head/sys/sys/diskpc98.h > > head/sys/sys/disk/vtoc.h > > - copied, changed from r306810, head/sys/sys/vtoc.h > > Replaced: > > head/sys/sys/apm.h (contents, props changed) > > head/sys/sys/disklabel.h (contents, props changed) > > head/sys/sys/diskmbr.h (contents, props changed) > > head/sys/sys/diskpc98.h (contents, props changed) > > head/sys/sys/gpt.h (contents, props changed) > > head/sys/sys/vtoc.h (contents, props changed) > > Somehow this destroyed the history on these files. They showed up as > deleted and then added instead of modified. If you 'svn log' on them > now you only get this commit and none of the previous history. I've > no idea if there's a way to recover this? Had you originally done an > 'svn mv' in your checkout and then copied the files back over or some > such? > I did a move from sys/X.h to sys/disk/X.h. The history moved to sys/disk/X.h. > New files were put where the old files used to be. > > Should I have done a svn copy? I think a copy would have been best. There is content in the sys/foo.h files still that has valid history (not all the lines were moved). Even if you had moved it all, I think a copy would still be best. I would only use a move if you are completely removing the original file. I'm not sure if there's a non-unfun way to recover from this. You might be able to copy the files from the previous revision, reapply your changes and then commit that. Ok. I’ll work on recovering the history of the original files. Maybe the repo masters can undo/delete the commit easily and I’ll just recommit. Avoids polluting the history… signature.asc Description: Message signed with OpenPGP using AMPGpg
Re: svn commit: r306811 - in head: etc/mtree include sys/sys sys/sys/disk
On October 7, 2016 at 11:02:44 AM, John Baldwin (j...@freebsd.org) wrote: On Friday, October 07, 2016 03:42:21 PM Marcel Moolenaar wrote: *snip* > Author: marcel > Date: Fri Oct 7 15:42:20 2016 > New Revision: 306811 > URL: https://svnweb.freebsd.org/changeset/base/306811 > > Added: > head/sys/sys/disk/ > head/sys/sys/disk/apm.h > - copied, changed from r306810, head/sys/sys/apm.h > head/sys/sys/disk/bsd.h > - copied, changed from r306810, head/sys/sys/disklabel.h > head/sys/sys/disk/gpt.h > - copied, changed from r306810, head/sys/sys/gpt.h > head/sys/sys/disk/mbr.h > - copied, changed from r306810, head/sys/sys/diskmbr.h > head/sys/sys/disk/pc98.h > - copied, changed from r306810, head/sys/sys/diskpc98.h > head/sys/sys/disk/vtoc.h > - copied, changed from r306810, head/sys/sys/vtoc.h > Replaced: > head/sys/sys/apm.h (contents, props changed) > head/sys/sys/disklabel.h (contents, props changed) > head/sys/sys/diskmbr.h (contents, props changed) > head/sys/sys/diskpc98.h (contents, props changed) > head/sys/sys/gpt.h (contents, props changed) > head/sys/sys/vtoc.h (contents, props changed) Somehow this destroyed the history on these files. They showed up as deleted and then added instead of modified. If you 'svn log' on them now you only get this commit and none of the previous history. I've no idea if there's a way to recover this? Had you originally done an 'svn mv' in your checkout and then copied the files back over or some such? I did a move from sys/X.h to sys/disk/X.h. The history moved to sys/disk/X.h. New files were put where the old files used to be. Should I have done a svn copy? signature.asc Description: Message signed with OpenPGP using AMPGpg
svn commit: r306811 - in head: etc/mtree include sys/sys sys/sys/disk
* The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + */ + +#ifndef _SYS_DISKMBR_H_ +#define_SYS_DISKMBR_H_ + +#include +#include + +void dos_partition_dec(void const *pp, struct dos_partition *d); +void dos_partition_enc(void *pp, struct dos_partition *d); + +#define DIOCSMBR _IOW('M', 129, u_char[512]) + +#endif /* !_SYS_DISKMBR_H_ */ Added: head/sys/sys/diskpc98.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/diskpc98.h Fri Oct 7 15:42:20 2016(r306811) @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 1987, 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * 4. Neither the name of the University nor the names of its contributors + *may be used to endorse or promote products derived from this software + *without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)disklabel.h 8.2 (Berkeley) 7/10/94 + * $FreeBSD$ + */ + +#ifndef _SYS_DISKPC98_H_ +#define_SYS_DISKPC98_H_ + +#include +#include + +#defineDOSMID_386BSD __DOSMID_386BSD +#defineDOSSID_386BSD __DOSSID_386BSD + +void pc98_partition_dec(void const *pp, struct pc98_partition *d); +void pc98_partition_enc(void *pp, struct pc98_partition *d); + +#define DIOCSPC98 _IOW('M', 129, u_char[8192]) + +#endif /* !_SYS_DISKPC98_H_ */ Added: head/sys/sys/gpt.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/sys/gpt.h Fri Oct 7 15:42:20 2016(r306811) @@ -0,0 +1,37 @@ +/*- + * Copyright (c) 2002 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the follo
Re: svn commit: r306620 - head/usr.bin/mkimg
On October 3, 2016 at 10:36:27 AM, Conrad Meyer (c...@freebsd.org) wrote: On Sun, Oct 2, 2016 at 6:46 PM, Marcel Moolenaar wrote: > Author: marcel > Date: Mon Oct 3 01:46:47 2016 > New Revision: 306620 > URL: https://svnweb.freebsd.org/changeset/base/306620 > > Log: > Replace STAILQ with TAILQ. TAILQs are portable enough that they can > be used on both macOS and Linux. STAILQs are not. In particular, > STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE > nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular > TAILQ_FOREACH. The _SAFE variant was only used for having the next > pointer in a local variable. All of these routines are available in the "libbsd" sys/queue.h. You might find other helpful portability/compatibility routines there, requiring fewer changes to the FreeBSD mkimg. Oh, nice. I’ll take a look. signature.asc Description: Message signed with OpenPGP using AMPGpg
Re: svn commit: r306622 - head/usr.bin/mkimg
On October 2, 2016 at 11:52:33 PM, Warner Losh (i...@bsdimp.com) wrote: Wouldn't it be better to say at the top #ifndef OFF_MAX #define OFF_MAX INT64_MAX #endif Not sure. The max is just for input checking. We do not even try to deal with an lseek(2) implementation that doesn’t take a 64-bit offset argument. Granted, the use of OFF_MAX before was based on FreeBSD’s lseek(2) implementation and was chosen to match it, knowing very well that it has a 64-bit offset argument. If lseek(2) doesn’t take a 64-bit offset then mkimg(1) fails for images larger than 2GB, but the problems with that run deeper than the max capacity that a user can specify on the mkimg command line. Not using OFF_MAX is a clear indication that the limit is not fully determined by lseek(2), but to a greater extend by the datatype used to hold the capacity. Hence by preference for going with INT64_MAX. Easy to change if people feel I should keep using OFF_MAX. signature.asc Description: Message signed with OpenPGP using AMPGpg
svn commit: r306622 - head/usr.bin/mkimg
Author: marcel Date: Mon Oct 3 04:00:30 2016 New Revision: 306622 URL: https://svnweb.freebsd.org/changeset/base/306622 Log: Replace OFF_MAX with INT64_MAX. The former is defined on Linux. Modified: head/usr.bin/mkimg/mkimg.c Modified: head/usr.bin/mkimg/mkimg.c == --- head/usr.bin/mkimg/mkimg.c Mon Oct 3 02:37:28 2016(r306621) +++ head/usr.bin/mkimg/mkimg.c Mon Oct 3 04:00:30 2016(r306622) @@ -496,7 +496,7 @@ main(int argc, char *argv[]) err(EX_UNAVAILABLE, "%s", optarg); break; case 'c': /* CAPACITY */ - error = parse_uint64(&capacity, 1, OFF_MAX, optarg); + error = parse_uint64(&capacity, 1, INT64_MAX, optarg); if (error) errc(EX_DATAERR, error, "capacity in bytes"); break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r306621 - head/usr.bin/mkimg
Author: marcel Date: Mon Oct 3 02:37:28 2016 New Revision: 306621 URL: https://svnweb.freebsd.org/changeset/base/306621 Log: Prefer over . While here remove redundant inclusion of . Move the inclusion of the disk partitioning headers out of order and inbetween standard headers and local header. They will change in a subsequent commit. Modified: head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/format.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/image.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/qcow.c head/usr.bin/mkimg/raw.c head/usr.bin/mkimg/scheme.c head/usr.bin/mkimg/vhd.c head/usr.bin/mkimg/vmdk.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/apm.c == --- head/usr.bin/mkimg/apm.cMon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/apm.cMon Oct 3 02:37:28 2016(r306621) @@ -27,13 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include #include #include #include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/bsd.c == --- head/usr.bin/mkimg/bsd.cMon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/bsd.cMon Oct 3 02:37:28 2016(r306621) @@ -27,13 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include #include #include #include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/ebr.c == --- head/usr.bin/mkimg/ebr.cMon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/ebr.cMon Oct 3 02:37:28 2016(r306621) @@ -27,13 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include #include #include #include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/format.c == --- head/usr.bin/mkimg/format.c Mon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/format.c Mon Oct 3 02:37:28 2016(r306621) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include Modified: head/usr.bin/mkimg/gpt.c == --- head/usr.bin/mkimg/gpt.cMon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/gpt.cMon Oct 3 02:37:28 2016(r306621) @@ -27,10 +27,7 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include -#include #include #include #include @@ -38,6 +35,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/image.c == --- head/usr.bin/mkimg/image.c Mon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/image.c Mon Oct 3 02:37:28 2016(r306621) @@ -28,9 +28,7 @@ __FBSDID("$FreeBSD$"); #include -#include #include -#include #include #include #include Modified: head/usr.bin/mkimg/mbr.c == --- head/usr.bin/mkimg/mbr.cMon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/mbr.cMon Oct 3 02:37:28 2016(r306621) @@ -27,13 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include #include #include #include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/mkimg.c == --- head/usr.bin/mkimg/mkimg.c Mon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/mkimg.c Mon Oct 3 02:37:28 2016(r306621) @@ -27,9 +27,7 @@ #include __FBSDID("$FreeBSD$"); -#include #include -#include #include #include #include @@ -37,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: head/usr.bin/mkimg/pc98.c == --- head/usr.bin/mkimg/pc98.c Mon Oct 3 01:46:47 2016(r306620) +++ head/usr.bin/mkimg/pc98.c Mon Oct 3 02:37:28 2016(r306621) @@ -27,13 +27,14 @@ #include __FBSDID("$FreeBSD$"); -#include -#include #include +#include #include #include #include +#include + #include "endian.h" #include "image.h" #include "mkimg.h" Modified: head/usr.bin/mkimg/qcow.c ===
svn commit: r306620 - head/usr.bin/mkimg
Author: marcel Date: Mon Oct 3 01:46:47 2016 New Revision: 306620 URL: https://svnweb.freebsd.org/changeset/base/306620 Log: Replace STAILQ with TAILQ. TAILQs are portable enough that they can be used on both macOS and Linux. STAILQs are not. In particular, STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular TAILQ_FOREACH. The _SAFE variant was only used for having the next pointer in a local variable. Modified: head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/image.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/mkimg.h head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/apm.c == --- head/usr.bin/mkimg/apm.cMon Oct 3 01:08:34 2016(r306619) +++ head/usr.bin/mkimg/apm.cMon Oct 3 01:46:47 2016(r306620) @@ -91,7 +91,7 @@ apm_write(lba_t imgsz, void *bootcode __ strncpy(ent->ent_type, APM_ENT_TYPE_SELF, sizeof(ent->ent_type)); strncpy(ent->ent_name, "Apple", sizeof(ent->ent_name)); - STAILQ_FOREACH(part, &partlist, link) { + TAILQ_FOREACH(part, &partlist, link) { ent = (void *)(buf + (part->index + 2) * secsz); be16enc(&ent->ent_sig, APM_ENT_SIG); be32enc(&ent->ent_pmblkcnt, nparts + 1); Modified: head/usr.bin/mkimg/bsd.c == --- head/usr.bin/mkimg/bsd.cMon Oct 3 01:08:34 2016(r306619) +++ head/usr.bin/mkimg/bsd.cMon Oct 3 01:46:47 2016(r306620) @@ -103,7 +103,7 @@ bsd_write(lba_t imgsz, void *bootcode) dp = &d->d_partitions[RAW_PART]; le32enc(&dp->p_size, imgsz); - STAILQ_FOREACH(part, &partlist, link) { + TAILQ_FOREACH(part, &partlist, link) { n = part->index + ((part->index >= RAW_PART) ? 1 : 0); dp = &d->d_partitions[n]; le32enc(&dp->p_size, part->size); Modified: head/usr.bin/mkimg/ebr.c == --- head/usr.bin/mkimg/ebr.cMon Oct 3 01:08:34 2016(r306619) +++ head/usr.bin/mkimg/ebr.cMon Oct 3 01:46:47 2016(r306620) @@ -88,7 +88,7 @@ ebr_write(lba_t imgsz __unused, void *bo le16enc(ebr + DOSMAGICOFFSET, DOSMAGIC); error = 0; - STAILQ_FOREACH_SAFE(part, &partlist, link, next) { + TAILQ_FOREACH(part, &partlist, link) { block = part->block - nsecs; size = round_track(part->size); dp = (void *)(ebr + DOSPARTOFF); @@ -100,6 +100,7 @@ ebr_write(lba_t imgsz __unused, void *bo le32enc(&dp->dp_size, size); /* Add link entry */ + next = TAILQ_NEXT(part, link); if (next != NULL) { size = round_track(next->size); dp++; Modified: head/usr.bin/mkimg/gpt.c == --- head/usr.bin/mkimg/gpt.cMon Oct 3 01:08:34 2016(r306619) +++ head/usr.bin/mkimg/gpt.cMon Oct 3 01:46:47 2016(r306620) @@ -208,7 +208,7 @@ gpt_mktbl(u_int tblsz) if (tbl == NULL) return (NULL); - STAILQ_FOREACH(part, &partlist, link) { + TAILQ_FOREACH(part, &partlist, link) { ent = tbl + part->index; gpt_uuid_enc(&ent->ent_type, ALIAS_TYPE2PTR(part->type)); mkimg_uuid(&uuid); Modified: head/usr.bin/mkimg/image.c == --- head/usr.bin/mkimg/image.c Mon Oct 3 01:08:34 2016(r306619) +++ head/usr.bin/mkimg/image.c Mon Oct 3 01:46:47 2016(r306620) @@ -60,7 +60,7 @@ __FBSDID("$FreeBSD$"); #endif struct chunk { - STAILQ_ENTRY(chunk) ch_list; + TAILQ_ENTRY(chunk) ch_list; size_t ch_size;/* Size of chunk in bytes. */ lba_t ch_block; /* Block address in image. */ union { @@ -78,7 +78,7 @@ struct chunk { #defineCH_TYPE_MEMORY 2 /* Memory-backed chunk */ }; -static STAILQ_HEAD(chunk_head, chunk) image_chunks; +static TAILQ_HEAD(chunk_head, chunk) image_chunks; static u_int image_nchunks; static char image_swap_file[PATH_MAX]; @@ -139,14 +139,14 @@ image_chunk_find(lba_t blk) struct chunk *ch; ch = (last != NULL && last->ch_block <= blk) - ? last : STAILQ_FIRST(&image_chunks); + ? last : TAILQ_FIRST(&image_chunks); while (ch != NULL) { if (ch->ch_block <= blk && (lba_t)(ch->ch_block + (ch->ch_size / secsz)) > blk) {
svn commit: r306333 - head/usr.bin/mkimg
Author: marcel Date: Mon Sep 26 04:14:00 2016 New Revision: 306333 URL: https://svnweb.freebsd.org/changeset/base/306333 Log: Portability changes: 1. macOS nor Linux have MAP_NOCORE nor MAP_NOSYNC. Define as 0. 2. macOS doesn't have SEEK_DATA nor SEEK_HOLE. Define as -1 so that lseek will return -1 (with errno set to EINVAL). 3. gcc correctly warns that error is assigned but not used in image_copyout_region(). Fix by returning on the first error. Modified: head/usr.bin/mkimg/image.c Modified: head/usr.bin/mkimg/image.c == --- head/usr.bin/mkimg/image.c Mon Sep 26 02:29:28 2016(r306332) +++ head/usr.bin/mkimg/image.c Mon Sep 26 04:14:00 2016(r306333) @@ -45,6 +45,20 @@ __FBSDID("$FreeBSD$"); #include "image.h" #include "mkimg.h" +#ifndef MAP_NOCORE +#defineMAP_NOCORE 0 +#endif +#ifndef MAP_NOSYNC +#defineMAP_NOSYNC 0 +#endif + +#ifndef SEEK_DATA +#defineSEEK_DATA -1 +#endif +#ifndef SEEK_HOLE +#defineSEEK_HOLE -1 +#endif + struct chunk { STAILQ_ENTRY(chunk) ch_list; size_t ch_size;/* Size of chunk in bytes. */ @@ -582,10 +596,13 @@ image_copyout_region(int fd, lba_t blk, size *= secsz; - while (size > 0) { + error = 0; + while (!error && size > 0) { ch = image_chunk_find(blk); - if (ch == NULL) - return (EINVAL); + if (ch == NULL) { + error = EINVAL; + break; + } ofs = (blk - ch->ch_block) * secsz; sz = ch->ch_size - ofs; sz = ((lba_t)sz < size) ? sz : (size_t)size; @@ -606,7 +623,7 @@ image_copyout_region(int fd, lba_t blk, size -= sz; blk += sz / secsz; } - return (0); + return (error); } int ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r306330 - head/usr.bin/mkimg
On September 25, 2016 at 7:13:21 PM, Adrian Chadd (adrian.ch...@gmail.com) wrote: Hi, Yeah, for portable-y stuff, I'd recommend: #include "endian.h" -> #ifdef __FreeBSD__ #include #elif __Apple__ etc, etc. That way we don't duplicate contents. Same with sys/queue.h, etc. We may even want to do , , etc. The compat directory can be shared by all build utilities that need portability. That way we only have to solve portability problems once. The name compat is but a suggestion. signature.asc Description: Message signed with OpenPGP using AMPGpg
svn commit: r306330 - head/usr.bin/mkimg
Author: marcel Date: Mon Sep 26 01:06:32 2016 New Revision: 306330 URL: https://svnweb.freebsd.org/changeset/base/306330 Log: Avoid depending on the header for le*enc and be*enc. Not only is the header unportable, the encoding/decoding functions are as well. Instead, duplicate the handful of small inlines we need into a private header called endian.h. Aside: an alternative approach is to move the encoding/decoding functions to a separate system header. While the header is still nonportable, such an approach would make it possible to re-use the definitions by playing games with include paths. This may be the preferred approach if more (build) utilities need this. This change does not preclude that. In fact, it makes it easier. Added: head/usr.bin/mkimg/endian.h (contents, props changed) Modified: head/usr.bin/mkimg/apm.c head/usr.bin/mkimg/bsd.c head/usr.bin/mkimg/ebr.c head/usr.bin/mkimg/gpt.c head/usr.bin/mkimg/mbr.c head/usr.bin/mkimg/pc98.c head/usr.bin/mkimg/qcow.c head/usr.bin/mkimg/raw.c head/usr.bin/mkimg/vhd.c head/usr.bin/mkimg/vmdk.c head/usr.bin/mkimg/vtoc8.c Modified: head/usr.bin/mkimg/apm.c == --- head/usr.bin/mkimg/apm.cMon Sep 26 00:41:08 2016(r306329) +++ head/usr.bin/mkimg/apm.cMon Sep 26 01:06:32 2016(r306330) @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include #include +#include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" Modified: head/usr.bin/mkimg/bsd.c == --- head/usr.bin/mkimg/bsd.cMon Sep 26 00:41:08 2016(r306329) +++ head/usr.bin/mkimg/bsd.cMon Sep 26 01:06:32 2016(r306330) @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include #include +#include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" Modified: head/usr.bin/mkimg/ebr.c == --- head/usr.bin/mkimg/ebr.cMon Sep 26 00:41:08 2016(r306329) +++ head/usr.bin/mkimg/ebr.cMon Sep 26 01:06:32 2016(r306330) @@ -29,12 +29,12 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include #include +#include "endian.h" #include "image.h" #include "mkimg.h" #include "scheme.h" Added: head/usr.bin/mkimg/endian.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/usr.bin/mkimg/endian.h Mon Sep 26 01:06:32 2016(r306330) @@ -0,0 +1,106 @@ +/*- + * Copyright (c) 2002 Thomas Moestl + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _MKIMG_ENDIAN_H_ +#define _MKIMG_ENDIAN_H_ + +static __inline uint16_t +be16dec(const void *pp) +{ + uint8_t const *p = (uint8_t const *)pp; + + return ((p[0] << 8) | p[1]); +} + +static __inline void +be16enc(void *pp, uint16_t u) +{ + uint8_t *p = (uint8_t *)pp; + + p[0] = (u >> 8) & 0xff; + p[1] = u & 0xff; +} + +static __inline void +be32enc(void *pp, uint32_t u) +{ + uint8_t *p = (uint8_t *)pp; + + p[0] = (u >> 24) & 0xff; + p[1] = (u >> 16) & 0xff; + p[2] = (u >> 8) & 0xff; + p[3] = u & 0xff; +} + +static __inline void +be64enc(void *pp, uint64_t u) +{ + uint8_t *p = (uint8_t *)pp; + + be32enc(p, (uint32_t)(u >> 32)); + be32enc(p + 4, (uint32_t)(u & 0xU)); +} + +
svn commit: r306329 - head/usr.bin/mkimg
Author: marcel Date: Mon Sep 26 00:41:08 2016 New Revision: 306329 URL: https://svnweb.freebsd.org/changeset/base/306329 Log: Eliminate the use of EDOOFUS. The error code was used to signal programming errors, but is really a poor substitute for assert. And less portable as well. Modified: head/usr.bin/mkimg/image.c head/usr.bin/mkimg/qcow.c Modified: head/usr.bin/mkimg/image.c == --- head/usr.bin/mkimg/image.c Sun Sep 25 23:48:15 2016(r306328) +++ head/usr.bin/mkimg/image.c Mon Sep 26 00:41:08 2016(r306329) @@ -456,8 +456,7 @@ image_copyin_mapped(lba_t blk, int fd, u * I don't know what this means or whether it * can happen at all... */ - error = EDOOFUS; - break; + assert(0); } } if (error) @@ -602,7 +601,7 @@ image_copyout_region(int fd, lba_t blk, error = image_copyout_memory(fd, sz, ch->ch_u.mem.ptr); break; default: - return (EDOOFUS); + assert(0); } size -= sz; blk += sz / secsz; Modified: head/usr.bin/mkimg/qcow.c == --- head/usr.bin/mkimg/qcow.c Sun Sep 25 23:48:15 2016(r306328) +++ head/usr.bin/mkimg/qcow.c Mon Sep 26 00:41:08 2016(r306329) @@ -30,6 +30,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -102,7 +103,7 @@ qcow_resize(lba_t imgsz, u_int version) clstr_log2sz = QCOW2_CLSTR_LOG2SZ; break; default: - return (EDOOFUS); + assert(0); } imagesz = round_clstr(imgsz * secsz); @@ -143,8 +144,7 @@ qcow_write(int fd, u_int version) u_int clstrsz, l1idx, l2idx; int error; - if (clstr_log2sz == 0) - return (EDOOFUS); + assert(clstr_log2sz != 0); clstrsz = 1U << clstr_log2sz; blk_clstrsz = clstrsz / secsz; @@ -203,7 +203,7 @@ qcow_write(int fd, u_int version) be32enc(&hdr->u.v2.refcnt_clstrs, refcnt_clstrs); break; default: - return (EDOOFUS); + assert(0); } if (sparse_write(fd, hdr, clstrsz) < 0) { ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r306312 - head
On September 25, 2016 at 10:41:32 AM, Andrey V. Elsukov (bu7c...@yandex.ru) wrote: On 25.09.16 19:39, Marcel Moolenaar wrote: > +20160924: > + Relocatable object files with the extension of .So have been renamed > + to use an extension of .pico instead. The purpose of this change is > + to avoid a name clash with shared libraries on case-insensitive file > + systems. On those file systems, foo.So is the same file as foo.so. Hi, probably old *.So files now should be removed using `make delete-old` or something like this. make “delete-old” is not for pruning files or directories in the object tree (unless that changed while I wasn’t paying attention. Has that changed? signature.asc Description: Message signed with OpenPGP using AMPGpg
Re: svn commit: r306325 - head/usr.bin/mkimg
On September 25, 2016 at 4:52:17 PM, Conrad Meyer (c...@freebsd.org) wrote: What's the motivation for this? This seems worse. Portability. We need mkimg to compile on other OSes besides FreeBSD. In particular, macOS and Linux. It’s ok that constructors are not 100% portable… signature.asc Description: Message signed with OpenPGP using AMPGpg
svn commit: r306325 - head/usr.bin/mkimg
Author: marcel Date: Sun Sep 25 22:57:59 2016 New Revision: 306325 URL: https://svnweb.freebsd.org/changeset/base/306325 Log: Replace the use of linker sets with constructors for both the formats and schemes. Formats and schemes are registered at runtime now, rather than collected at link time. Modified: head/usr.bin/mkimg/format.c head/usr.bin/mkimg/format.h head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/scheme.c head/usr.bin/mkimg/scheme.h Modified: head/usr.bin/mkimg/format.c == --- head/usr.bin/mkimg/format.c Sun Sep 25 22:17:46 2016(r306324) +++ head/usr.bin/mkimg/format.c Sun Sep 25 22:57:59 2016(r306325) @@ -28,8 +28,6 @@ __FBSDID("$FreeBSD$"); #include -#include -#include #include #include #include @@ -42,8 +40,24 @@ __FBSDID("$FreeBSD$"); #include "format.h" #include "mkimg.h" +static struct mkimg_format *first; static struct mkimg_format *format; +struct mkimg_format * +format_iterate(struct mkimg_format *f) +{ + + return ((f == NULL) ? first : f->next); +} + +void +format_register(struct mkimg_format *f) +{ + + f->next = first; + first = f; +} + int format_resize(lba_t end) { @@ -56,10 +70,10 @@ format_resize(lba_t end) int format_select(const char *spec) { - struct mkimg_format *f, **iter; + struct mkimg_format *f; - SET_FOREACH(iter, formats) { - f = *iter; + f = NULL; + while ((f = format_iterate(f)) != NULL) { if (strcasecmp(spec, f->name) == 0) { format = f; return (0); Modified: head/usr.bin/mkimg/format.h == --- head/usr.bin/mkimg/format.h Sun Sep 25 22:17:46 2016(r306324) +++ head/usr.bin/mkimg/format.h Sun Sep 25 22:57:59 2016(r306325) @@ -29,21 +29,24 @@ #ifndef _MKIMG_FORMAT_H_ #define_MKIMG_FORMAT_H_ -#include - struct mkimg_format { + struct mkimg_format *next; const char *name; const char *description; int (*resize)(lba_t); int (*write)(int); }; -SET_DECLARE(formats, struct mkimg_format); -#defineFORMAT_DEFINE(nm) DATA_SET(formats, nm) +#defineFORMAT_DEFINE(nm) \ +static void format_register_##nm(void) __attribute__((constructor)); \ +static void format_register_##nm(void) { format_register(&nm); } -intformat_resize(lba_t); +struct mkimg_format *format_iterate(struct mkimg_format *); +void format_register(struct mkimg_format *); intformat_select(const char *); struct mkimg_format *format_selected(void); + +intformat_resize(lba_t); intformat_write(int); #endif /* _MKIMG_FORMAT_H_ */ Modified: head/usr.bin/mkimg/mkimg.c == --- head/usr.bin/mkimg/mkimg.c Sun Sep 25 22:17:46 2016(r306324) +++ head/usr.bin/mkimg/mkimg.c Sun Sep 25 22:57:59 2016(r306325) @@ -27,7 +27,6 @@ #include __FBSDID("$FreeBSD$"); -#include #include #include #include @@ -77,20 +76,20 @@ u_int blksz = 0; static void print_formats(int usage) { - struct mkimg_format *f, **f_iter; + struct mkimg_format *f; const char *sep; if (usage) { fprintf(stderr, "formats:\n"); - SET_FOREACH(f_iter, formats) { - f = *f_iter; + f = NULL; + while ((f = format_iterate(f)) != NULL) { fprintf(stderr, "\t%s\t- %s\n", f->name, f->description); } } else { sep = ""; - SET_FOREACH(f_iter, formats) { - f = *f_iter; + f = NULL; + while ((f = format_iterate(f)) != NULL) { printf("%s%s", sep, f->name); sep = " "; } @@ -101,20 +100,20 @@ print_formats(int usage) static void print_schemes(int usage) { - struct mkimg_scheme *s, **s_iter; + struct mkimg_scheme *s; const char *sep; if (usage) { fprintf(stderr, "schemes:\n"); - SET_FOREACH(s_iter, schemes) { - s = *s_iter; + s = NULL; + while ((s = scheme_iterate(s)) != NULL) { fprintf(stderr, "\t%s\t- %s\n", s->name, s->description); } } else { sep = ""; - SET_FOREACH(s_iter, schemes) { - s = *s_iter; + s = NULL; + while ((s = scheme_iterate(s)) != NULL) { printf("%s%s", sep, s->name); sep = " "; }
svn commit: r306313 - head/share/mk
Author: marcel Date: Sun Sep 25 16:50:31 2016 New Revision: 306313 URL: https://svnweb.freebsd.org/changeset/base/306313 Log: Document the ".pico" extension for object files. Suggested by: emaste@ Modified: head/share/mk/bsd.README Modified: head/share/mk/bsd.README == --- head/share/mk/bsd.READMESun Sep 25 16:39:18 2016(r306312) +++ head/share/mk/bsd.READMESun Sep 25 16:50:31 2016(r306313) @@ -114,7 +114,7 @@ the tree where the file gets installed. The profiled libraries are no longer built in a different directory than the regular libraries. A new suffix, ".po", is used to denote a profiled -object. +object, and ".pico" denotes a position-independent relocatable object. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r306312 - head
Author: marcel Date: Sun Sep 25 16:39:18 2016 New Revision: 306312 URL: https://svnweb.freebsd.org/changeset/base/306312 Log: Relocatable object files are renamed from *.So to *.pico Reminder by: imp@ Modified: head/UPDATING Modified: head/UPDATING == --- head/UPDATING Sun Sep 25 16:30:29 2016(r306311) +++ head/UPDATING Sun Sep 25 16:39:18 2016(r306312) @@ -31,6 +31,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12 disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20160924: + Relocatable object files with the extension of .So have been renamed + to use an extension of .pico instead. The purpose of this change is + to avoid a name clash with shared libraries on case-insensitive file + systems. On those file systems, foo.So is the same file as foo.so. + 20160918: GNU rcs has been turned off by default. It can (temporarily) be built again by adding WITH_RCS knob in src.conf. ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r306300 - head/contrib/ofed/usr.lib/libsdp
Author: marcel Date: Sat Sep 24 17:50:11 2016 New Revision: 306300 URL: https://svnweb.freebsd.org/changeset/base/306300 Log: When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same target files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. Missed in r306297 MFC after:1 month Sponsored by: Bracket Computing Differential Revision:https://reviews.freebsd.org/D7906 Modified: head/contrib/ofed/usr.lib/libsdp/Makefile Modified: head/contrib/ofed/usr.lib/libsdp/Makefile == --- head/contrib/ofed/usr.lib/libsdp/Makefile Sat Sep 24 17:29:27 2016 (r306299) +++ head/contrib/ofed/usr.lib/libsdp/Makefile Sat Sep 24 17:50:11 2016 (r306300) @@ -22,4 +22,4 @@ CFLAGS+= -I${OFEDSYS}/include # Remove .[ly] since the checked-in version is preferred. .SUFFIXES: -.SUFFIXES: .o .po .So .c .ln +.SUFFIXES: .o .po .pico .c .ln ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r306299 - head/usr.bin/mkimg
Author: marcel Date: Sat Sep 24 17:29:27 2016 New Revision: 306299 URL: https://svnweb.freebsd.org/changeset/base/306299 Log: Update local variable 'block' after calling capacity_resize(), otherwise format_resize(), which is called right after, isn't getting the current/actual image size. Rather than rounding up, format_resize() could end up truncating the size and we don't allow that by design. MFC after:1 week Modified: head/usr.bin/mkimg/mkimg.c Modified: head/usr.bin/mkimg/mkimg.c == --- head/usr.bin/mkimg/mkimg.c Sat Sep 24 16:46:37 2016(r306298) +++ head/usr.bin/mkimg/mkimg.c Sat Sep 24 17:29:27 2016(r306299) @@ -463,13 +463,16 @@ mkimg(void) block = scheme_metadata(SCHEME_META_IMG_END, block); error = image_set_size(block); - if (!error) + if (!error) { error = capacity_resize(block); - if (!error) + block = image_get_size(); + } + if (!error) { error = format_resize(block); + block = image_get_size(); + } if (error) errc(EX_IOERR, error, "image sizing"); - block = image_get_size(); ncyls = block / (nsecs * nheads); error = scheme_write(block); if (error) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r306297 - in head: gnu/lib/libgcc gnu/lib/libgcov lib/libedit lib/libprocstat lib/libthr/support share/mk sys/conf usr.sbin/bsnmpd/modules/snmp_hostres
Author: marcel Date: Sat Sep 24 15:11:27 2016 New Revision: 306297 URL: https://svnweb.freebsd.org/changeset/base/306297 Log: When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same target files (case-insensitivity speaking). This is the case for object files compiled with -fpic and shared libraries. The former uses an extension of ".So", and the latter an extension ".so". Rename shared object files from *.So to *.pico to match what NetBSD does. See also r305855 MFC after:1 month Sponsored by: Bracket Computing Differential Revision:https://reviews.freebsd.org/D7906 Modified: head/gnu/lib/libgcc/Makefile head/gnu/lib/libgcov/Makefile head/lib/libedit/Makefile head/lib/libprocstat/Makefile head/lib/libthr/support/Makefile.inc head/share/mk/bsd.dep.mk head/share/mk/bsd.lib.mk head/share/mk/meta.autodep.mk head/sys/conf/kern.post.mk head/sys/conf/kern.pre.mk head/usr.sbin/bsnmpd/modules/snmp_hostres/Makefile Modified: head/gnu/lib/libgcc/Makefile == --- head/gnu/lib/libgcc/MakefileSat Sep 24 13:44:18 2016 (r306296) +++ head/gnu/lib/libgcc/MakefileSat Sep 24 15:11:27 2016 (r306297) @@ -258,8 +258,8 @@ OBJ_GRPS += FPBIT DPBIT .for T in ${OBJ_GRPS} ${T}_OBJS_T = ${${T}_FUNCS:S/$/.o/} ${T}_OBJS_P = ${${T}_FUNCS:S/$/.po/} -${T}_OBJS_S = ${${T}_FUNCS:S/$/.So/} -SOBJS += ${${T}_FUNCS:S/$/.So/} +${T}_OBJS_S = ${${T}_FUNCS:S/$/.pico/} +SOBJS += ${${T}_FUNCS:S/$/.pico/} ${${T}_OBJS_T}: ${${T}_CFILE} ${COMMONHDRS} ${CC_T} ${${T}_CFLAGS} -DL${.PREFIX} -o ${.TARGET} ${.ALLSRC:M*.c} @@ -274,7 +274,7 @@ ${${T}_OBJS_S}: ${${T}_CFILE} ${COMMONHD # Extra objects coming from separate files # .if !empty(LIB2ADD) -SOBJS += ${LIB2ADD:R:S/$/.So/} +SOBJS += ${LIB2ADD:R:S/$/.pico/} .endif #--- @@ -298,9 +298,9 @@ ${STAT_OBJS_P}: ${STD_CFILE} ${COMMONHDR .if defined(LIB1ASMSRC) ASM_T =${LIB1ASMFUNCS:S/$/.o/} ASM_P =${LIB1ASMFUNCS:S/$/.po/} -ASM_S =${LIB1ASMFUNCS:S/$/.So/} +ASM_S =${LIB1ASMFUNCS:S/$/.pico/} ASM_V =${LIB1ASMFUNCS:S/$/.vis/} -SOBJS += ${LIB1ASMFUNCS:S/$/.So/} +SOBJS += ${LIB1ASMFUNCS:S/$/.pico/} ${ASM_T}: ${LIB1ASMSRC} ${.PREFIX}.vis ${CC} -x assembler-with-cpp -c ${CFLAGS} -DL${.PREFIX} \ @@ -327,7 +327,7 @@ CLEANFILES += ${ASM_V} ${ASM_V:R:S/$/.vo # EH_OBJS_T = ${LIB2ADDEHSTATIC:R:S/$/.o/} EH_OBJS_P = ${LIB2ADDEHSTATIC:R:S/$/.po/} -EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.So/} +EH_OBJS_S = ${LIB2ADDEHSHARED:R:S/$/.pico/} EH_CFLAGS = -fexceptions -D__GLIBC__=3 -DElfW=__ElfN .if ${TARGET_CPUARCH} != "riscv64" # RISCVTODO: unwinding support @@ -341,7 +341,7 @@ ${_src:R:S/$/.po/}: ${_src} ${COMMONHDRS ${CC_P} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor .for _src in ${LIB2ADDEHSHARED:M*.c} -${_src:R:S/$/.So/}: ${_src} ${COMMONHDRS} +${_src:R:S/$/.pico/}: ${_src} ${COMMONHDRS} ${CC_S} ${EH_CFLAGS} -o ${.TARGET} ${.IMPSRC} .endfor Modified: head/gnu/lib/libgcov/Makefile == --- head/gnu/lib/libgcov/Makefile Sat Sep 24 13:44:18 2016 (r306296) +++ head/gnu/lib/libgcov/Makefile Sat Sep 24 15:11:27 2016 (r306297) @@ -35,7 +35,7 @@ SYMS = _gcov _gcov_merge_add _gcov_merge OBJS= ${SYMS:S/$/.o/} OBJS_T=${SYMS:S/$/.o/} OBJS_P=${SYMS:S/$/.po/} -OBJS_S=${SYMS:S/$/.So/} +OBJS_S=${SYMS:S/$/.pico/} #--- # Modified: head/lib/libedit/Makefile == --- head/lib/libedit/Makefile Sat Sep 24 13:44:18 2016(r306296) +++ head/lib/libedit/Makefile Sat Sep 24 15:11:27 2016(r306297) @@ -76,7 +76,7 @@ historyn.c: makelist Makefile sh ${.CURDIR}/makelist -n history.c > ${.TARGET} # minimal dependency to make "make depend" optional -editline.o editline.po editline.So editline.ln:\ +editline.o editline.po editline.pico editline.ln: \ common.h emacs.h fcns.c fcns.h help.c help.h vi.h tc1.o: ${.CURDIR}/TEST/tc1.c Modified: head/lib/libprocstat/Makefile == --- head/lib/libprocstat/Makefile Sat Sep 24 13:44:18 2016 (r306296) +++ head/lib/libprocstat/Makefile Sat Sep 24 15:11:27 2016 (r306297) @@ -58,13 +58,13 @@ MLINKS+=libprocstat.3 procstat_close.3 \ .if ${MK_CDDL} != "no" CFLAGS+= -DLIBPROCSTAT_ZFS OBJS+= zfs/zfs.o -SOBJS+=zfs/zfs.So +SOBJS+=zfs/zfs.pico POBJS+=
svn commit: r305855 - head/lib/libc/stdlib
Author: marcel Date: Fri Sep 16 03:04:48 2016 New Revision: 305855 URL: https://svnweb.freebsd.org/changeset/base/305855 Log: When MAKEOBJDIRPREFIX points to a case-insensitive file system, the build can break when different source files create the same object files (case-insensitivity speaking). This is the case for _Exit.c and _exit.s. Compile _Exit.c as C99_Exit.c Reviewed by: sjg@ MFC after:completion Sponsored by: Bracket Computing Differential Revision:https://reviews.freebsd.org/D7893 Modified: head/lib/libc/stdlib/Makefile.inc Modified: head/lib/libc/stdlib/Makefile.inc == --- head/lib/libc/stdlib/Makefile.inc Fri Sep 16 01:38:22 2016 (r305854) +++ head/lib/libc/stdlib/Makefile.inc Fri Sep 16 03:04:48 2016 (r305855) @@ -4,7 +4,7 @@ # machine-independent stdlib sources .PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/stdlib ${LIBC_SRCTOP}/stdlib -MISRCS+=_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ +MISRCS+=C99_Exit.c a64l.c abort.c abs.c atexit.c atof.c atoi.c atol.c atoll.c \ bsearch.c cxa_thread_atexit.c div.c exit.c getenv.c getopt.c getopt_long.c \ getsubopt.c hcreate.c hcreate_r.c hdestroy_r.c heapsort.c heapsort_b.c \ hsearch_r.c imaxabs.c imaxdiv.c \ @@ -16,6 +16,13 @@ MISRCS+=_Exit.c a64l.c abort.c abs.c ate strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c +# Work around an issue on case-insensitive file systems. +# libc has both _Exit.c and _exit.s and they both yield +# _exit.o (case insensitively speaking). +CLEANFILES+=C99_Exit.c +C99_Exit.c: ${LIBC_SRCTOP}/stdlib/_Exit.c .NOMETA + ln -sf ${.ALLSRC} ${.TARGET} + SYM_MAPS+= ${LIBC_SRCTOP}/stdlib/Symbol.map # machine-dependent stdlib sources ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r296103 - head/sys/amd64/vmm
Author: marcel Date: Fri Feb 26 16:18:47 2016 New Revision: 296103 URL: https://svnweb.freebsd.org/changeset/base/296103 Log: Bump VM_MAX_MEMSEGS from 2 to 3 to match the number of VM segment identifiers present in vmmapi.h. In particular, it's now possible to create a VM_FRAMEBUFFER segment. Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c == --- head/sys/amd64/vmm/vmm.cFri Feb 26 16:15:02 2016(r296102) +++ head/sys/amd64/vmm/vmm.cFri Feb 26 16:18:47 2016(r296103) @@ -121,7 +121,7 @@ struct mem_seg { boolsysmem; struct vm_object *object; }; -#defineVM_MAX_MEMSEGS 2 +#defineVM_MAX_MEMSEGS 3 struct mem_map { vm_paddr_t gpa; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r296102 - head/usr.sbin/bhyveload
Author: marcel Date: Fri Feb 26 16:15:02 2016 New Revision: 296102 URL: https://svnweb.freebsd.org/changeset/base/296102 Log: Add option -C to have the guest memory included in core files. This aids in debugging OS loaders. Modified: head/usr.sbin/bhyveload/bhyveload.8 head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.8 == --- head/usr.sbin/bhyveload/bhyveload.8 Fri Feb 26 16:12:20 2016 (r296101) +++ head/usr.sbin/bhyveload/bhyveload.8 Fri Feb 26 16:15:02 2016 (r296102) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2015 +.Dd February 26, 2016 .Dt BHYVELOAD 8 .Os .Sh NAME @@ -35,6 +35,7 @@ guest inside a bhyve virtual machine .Sh SYNOPSIS .Nm +.Op Fl C .Op Fl S .Op Fl c Ar cons-dev .Op Fl d Ar disk-path @@ -125,6 +126,12 @@ respectively. The default value of .Ar mem-size is 256M. +.It Fl C +Include guest memory in the core file when +.Nm +dumps core. +This is intended for debugging an OS loader as it allows inspection of +the guest memory. .It Fl S Wire guest memory. .El Modified: head/usr.sbin/bhyveload/bhyveload.c == --- head/usr.sbin/bhyveload/bhyveload.c Fri Feb 26 16:12:20 2016 (r296101) +++ head/usr.sbin/bhyveload/bhyveload.c Fri Feb 26 16:15:02 2016 (r296102) @@ -674,7 +674,7 @@ main(int argc, char** argv) consin_fd = STDIN_FILENO; consout_fd = STDOUT_FILENO; - while ((opt = getopt(argc, argv, "Sc:d:e:h:l:m:")) != -1) { + while ((opt = getopt(argc, argv, "CSc:d:e:h:l:m:")) != -1) { switch (opt) { case 'c': error = altcons_open(optarg); @@ -709,6 +709,9 @@ main(int argc, char** argv) if (error != 0) errx(EX_USAGE, "Invalid memsize '%s'", optarg); break; + case 'C': + memflags |= VM_MEM_F_INCORE; + break; case 'S': memflags |= VM_MEM_F_WIRED; break; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r296101 - head/usr.sbin/bhyveload
Author: marcel Date: Fri Feb 26 16:12:20 2016 New Revision: 296101 URL: https://svnweb.freebsd.org/changeset/base/296101 Log: Support version 4 of the userboot structure by implementing the vm_set_register() and vm_set_desc() callbacks. Modified: head/usr.sbin/bhyveload/bhyveload.c Modified: head/usr.sbin/bhyveload/bhyveload.c == --- head/usr.sbin/bhyveload/bhyveload.c Fri Feb 26 16:04:47 2016 (r296100) +++ head/usr.sbin/bhyveload/bhyveload.c Fri Feb 26 16:12:20 2016 (r296101) @@ -542,6 +542,21 @@ cb_getenv(void *arg, int num) return (NULL); } +static int +cb_vm_set_register(void *arg, int vcpu, int reg, uint64_t val) +{ + + return (vm_set_register(ctx, vcpu, reg, val)); +} + +static int +cb_vm_set_desc(void *arg, int vcpu, int reg, uint64_t base, u_int limit, +u_int access) +{ + + return (vm_set_desc(ctx, vcpu, reg, base, limit, access)); +} + static struct loader_callbacks cb = { .getc = cb_getc, .putc = cb_putc, @@ -571,6 +586,10 @@ static struct loader_callbacks cb = { .getmem = cb_getmem, .getenv = cb_getenv, + + /* Version 4 additions */ + .vm_set_register = cb_vm_set_register, + .vm_set_desc = cb_vm_set_desc, }; static int @@ -765,7 +784,7 @@ main(int argc, char** argv) addenv("smbios.bios.vendor=BHYVE"); addenv("boot_serial=1"); - func(&cb, NULL, USERBOOT_VERSION_3, ndisks); + func(&cb, NULL, USERBOOT_VERSION_4, ndisks); free(loader); return (0); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r296099 - head/sys/boot/userboot
Author: marcel Date: Fri Feb 26 16:00:16 2016 New Revision: 296099 URL: https://svnweb.freebsd.org/changeset/base/296099 Log: Add vm_set_register() and vm_set_desc() callbacks. These callbacks translate directly into calls to their namesake API functions in libvmmapi. It is an improvement over the existing setreg(), setmsr(), setcr() setgdt() and exec() callbacks in that the new additions give full control and don't assume we're booting FreeBSD, like exec() and don't assume one only wants to set the value of RSP, like setreg(). Modified: head/sys/boot/userboot/userboot.h Modified: head/sys/boot/userboot/userboot.h == --- head/sys/boot/userboot/userboot.h Fri Feb 26 15:54:34 2016 (r296098) +++ head/sys/boot/userboot/userboot.h Fri Feb 26 16:00:16 2016 (r296099) @@ -34,6 +34,14 @@ #defineUSERBOOT_VERSION_3 3 /* + * Version 4 added more generic callbacks for setting up + * registers and descriptors. The callback structure is + * backward compatible (new callbacks have been added at + * the tail end). + */ +#defineUSERBOOT_VERSION_4 4 + +/* * Exit codes from the loader */ #defineUSERBOOT_EXIT_QUIT 1 @@ -195,4 +203,11 @@ struct loader_callbacks { * each invocation will add 1 to the previous value of 'num'. */ const char *(*getenv)(void *arg, int num); + + /* +* Version 4 additions. +*/ + int (*vm_set_register)(void *arg, int vcpu, int reg, uint64_t val); + int (*vm_set_desc)(void *arg, int vcpu, int reg, uint64_t base, + u_int limit, u_int access); }; ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r296097 - head/sys/boot/userboot/userboot
Author: marcel Date: Fri Feb 26 15:52:55 2016 New Revision: 296097 URL: https://svnweb.freebsd.org/changeset/base/296097 Log: Check that the userboot version is at least 3, rather than 3 exactly. The structure may be of a newer version and as long as it is backward compatible with 3, we can work with it. While here: whitespace nits. Modified: head/sys/boot/userboot/userboot/main.c Modified: head/sys/boot/userboot/userboot/main.c == --- head/sys/boot/userboot/userboot/main.c Fri Feb 26 15:46:14 2016 (r296096) +++ head/sys/boot/userboot/userboot/main.c Fri Feb 26 15:52:55 2016 (r296097) @@ -43,6 +43,7 @@ static void userboot_zfs_probe(void); static int userboot_zfs_found; #endif +/* Minimum version required */ #defineUSERBOOT_VERSIONUSERBOOT_VERSION_3 #defineMALLOCSZ(10*1024*1024) @@ -64,7 +65,7 @@ void delay(int usec) { -CALLBACK(delay, usec); + CALLBACK(delay, usec); } void @@ -82,11 +83,11 @@ loader_main(struct loader_callbacks *cb, const char *var; int i; -if (version != USERBOOT_VERSION) -abort(); + if (version < USERBOOT_VERSION) + abort(); callbacks = cb; -callbacks_arg = arg; + callbacks_arg = arg; userboot_disk_maxunit = ndisks; /* @@ -95,9 +96,9 @@ loader_main(struct loader_callbacks *cb, */ setheap((void *)mallocbuf, (void *)(mallocbuf + sizeof(mallocbuf))); -/* - * Hook up the console - */ + /* +* Hook up the console +*/ cons_probe(); printf("\n"); @@ -192,9 +193,9 @@ extract_currdev(void) } env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev), -userboot_setcurrdev, env_nounset); + userboot_setcurrdev, env_nounset); env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev), -env_noset, env_nounset); + env_noset, env_nounset); } #if defined(USERBOOT_ZFS_SUPPORT) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r289044 - head/lib/libstand
Author: marcel Date: Thu Oct 8 17:59:05 2015 New Revision: 289044 URL: https://svnweb.freebsd.org/changeset/base/289044 Log: If we can't open the file, skip devclose() for the exclusive_file_system case. We never called devopen(), so we know there's nothing to close. Modified: head/lib/libstand/open.c Modified: head/lib/libstand/open.c == --- head/lib/libstand/open.cThu Oct 8 17:55:53 2015(r289043) +++ head/lib/libstand/open.cThu Oct 8 17:59:05 2015(r289044) @@ -114,7 +114,7 @@ open(const char *fname, int mode) error = (fs->fo_open)(fname, f); if (error == 0) goto ok; - goto fail; + goto err; } error = devopen(f, fname, &file); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r289001 - in head: share/examples/bhyve usr.sbin/bhyveload
Author: marcel Date: Thu Oct 8 02:28:22 2015 New Revision: 289001 URL: https://svnweb.freebsd.org/changeset/base/289001 Log: Add option -l for specifying which OS loader to dlopen(3). By default this is /boot/userboot.so. This option allows for the development and use of other OS loaders. Modified: head/share/examples/bhyve/vmrun.sh head/usr.sbin/bhyveload/bhyveload.8 head/usr.sbin/bhyveload/bhyveload.c Modified: head/share/examples/bhyve/vmrun.sh == --- head/share/examples/bhyve/vmrun.sh Thu Oct 8 01:17:45 2015 (r289000) +++ head/share/examples/bhyve/vmrun.sh Thu Oct 8 02:28:22 2015 (r289001) @@ -48,8 +48,8 @@ usage() { echo "Usage: vmrun.sh [-ahi] [-c ] [-C ] [-d ]" echo "[-e ] [-g ] [-H ]" - echo "[-I ] [-m ]" - echo "[-t ] " + echo "[-I ] [-l ]" + echo "[-m ] [-t ] " echo "" echo " -h: display this help message" echo " -a: force memory mapped local APIC access" @@ -61,6 +61,7 @@ usage() { echo " -H: host filesystem to export to the loader" echo " -i: force boot of the Installation CDROM image" echo " -I: Installation CDROM image location (default is ${DEFAULT_ISOFILE})" + echo " -l: the OS loader to use (default is /boot/userboot.so)" echo " -m: memory size (default is ${DEFAULT_MEMSIZE})" echo " -p: pass-through a host PCI device at bus/slot/func (e.g. 10/0/0)" echo " -t: tap device for virtio-net (default is $DEFAULT_TAPDEV)" @@ -92,7 +93,7 @@ loader_opt="" bhyverun_opt="-H -A -P" pass_total=0 -while getopts ac:C:d:e:g:hH:iI:m:p:t: c ; do +while getopts ac:C:d:e:g:hH:iI:l:m:p:t: c ; do case $c in a) bhyverun_opt="${bhyverun_opt} -a" @@ -125,6 +126,9 @@ while getopts ac:C:d:e:g:hH:iI:m:p:t: c I) isofile=${OPTARG} ;; + l) + loader_opt="${loader_opt} -l ${OPTARG}" + ;; m) memsize=${OPTARG} ;; Modified: head/usr.sbin/bhyveload/bhyveload.8 == --- head/usr.sbin/bhyveload/bhyveload.8 Thu Oct 8 01:17:45 2015 (r289000) +++ head/usr.sbin/bhyveload/bhyveload.8 Thu Oct 8 02:28:22 2015 (r289001) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 7, 2012 +.Dd October 7, 2015 .Dt BHYVELOAD 8 .Os .Sh NAME @@ -40,6 +40,7 @@ guest inside a bhyve virtual machine .Op Fl d Ar disk-path .Op Fl e Ar name=value .Op Fl h Ar host-path +.Op Fl l Ar os-loader .Op Fl m Ar mem-size .Ar vmname .Sh DESCRIPTION @@ -56,6 +57,7 @@ is based on and will present an interface identical to the .Fx loader on the user's terminal. +This behavior can be changed by specifying a different OS loader. .Pp The virtual machine is identified as .Ar vmname @@ -78,7 +80,9 @@ The .Ar disk-path is the pathname of the guest's boot disk image. .It Fl e Ar name=value -Set the FreeBSD loader environment variable +Set the +.Fx +loader environment variable .Ar name to .Ar value . @@ -89,6 +93,15 @@ variable. The .Ar host-path is the directory at the top of the guest's boot filesystem. +.It Fl l Ar os-loader +Specify a different OS loader. +By default +.Nm +will use +.Pa /boot/userboot.so , +which presents a standard +.Fx +loader. .It Fl m Ar mem-size Xo .Sm off .Op Cm K | k | M | m | G | g | T | t Modified: head/usr.sbin/bhyveload/bhyveload.c == --- head/usr.sbin/bhyveload/bhyveload.c Thu Oct 8 01:17:45 2015 (r289000) +++ head/usr.sbin/bhyveload/bhyveload.c Thu Oct 8 02:28:22 2015 (r289001) @@ -639,6 +639,7 @@ usage(void) int main(int argc, char** argv) { + char *loader; void *h; void (*func)(struct loader_callbacks *, void *, int, int); uint64_t mem_size; @@ -646,13 +647,15 @@ main(int argc, char** argv) progname = basename(argv[0]); + loader = NULL; + memflags = 0; mem_size = 256 * MB; consin_fd = STDIN_FILENO; consout_fd = STDOUT_FILENO; - while ((opt = getopt(argc, argv, "Sc:d:e:h:m:")) != -1) { + while ((opt = getopt(argc, argv, "Sc:d:e:h:l:m:")) != -1) { switch (opt) { case 'c': error = altcons_open(optarg); @@ -674,6 +677,14 @@ main(int argc, char** argv) host_base = optarg; break; + case 'l': + if (loader != NULL) + errx(EX_USAGE, "-l can only be given once"); + loader = strdup(optarg); + if (loader == NULL) +
Re: svn commit: r287934 - head/sys/boot/efi/loader
> > The other approach I suggested earlier is to make the kernel relocatable > (and allow the module metadata to be anywhere and live in a chain instead > of an array) so that we can just load things wherever and leave them there > without having to relocate. For ia64 I linked the kernel against a virtual address. The loader could simply allocate EFI memory as needed, and not worry about its location. It would map that into what I called the “pre-boot virtual address space”. When booting the kernel, the loader only had to pass the physical address and size of the page table (the virtual address was fixed). With a variable size the loader would start off with a single 4KB page table and it would grow it as needed to some arbitrary max. The page size for the pre-boot virtual address space was 64KB (to match the maximum alignment of segments that the toolchain allowed). With more than 700MB of pre-boot virtual address space, one could preload and entire installation CD if willing to wait for it being loaded. No need to set memory aside and hope things fit... As a nice plus: linking against a virtual address allows copying the kernel text across the memory domains and always have it run locally to CPUs in NUMA configurations. -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r287538 - head/sys/boot/efi/loader/arch/amd64
Author: marcel Date: Mon Sep 7 17:56:49 2015 New Revision: 287538 URL: https://svnweb.freebsd.org/changeset/base/287538 Log: As expected, things aren't as simple as hoped. Consequently, we have no option but to use the smbios information to fill in the blanks. It's a good thing UGA is a protocol of the past and GOP has all the info we need. Anyway, the logic has been tweaked a little to get the easier bits of information up front. This includes the resolution and the frame buffer address. Then we look at the smbios information and define expected values as well as the missing bits (frame buffer offset and stride). If the values obtained match the expect values, we fill in the blanks and return. Otherwise we use the existing detection logic to figure it out. Rename the environment variables from uga_framebuffer abd uga_stride to hw.efifb.address and hw.efifb.stride. The latter names are more in line with other variable names. We currently have hardcoded settings for: 1. Mid-2007 iMac (iMac7,1) 2. Late-2007 MacBook (MacBook3,1) Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c == --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 16:44:28 2015(r287537) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Mon Sep 7 17:56:49 2015(r287538) @@ -269,8 +269,10 @@ efifb_from_uga(struct efi_fb *efifb, EFI EFI_PCI_IO_PROTOCOL *pciio; char *ev, *p; EFI_STATUS status; - ssize_t ofs; - uint32_t np, horiz, vert, depth, refresh; + ssize_t offset; + uint64_t fbaddr, fbsize; + uint32_t horiz, vert, stride; + uint32_t np, depth, refresh; status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh); if (EFI_ERROR(status)) @@ -285,6 +287,63 @@ efifb_from_uga(struct efi_fb *efifb, EFI efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, NULL); + /* pciio can be NULL on return! */ + pciio = efifb_uga_get_pciio(); + + /* Try to find the frame buffer. */ + status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, + &efifb->fb_size); + if (EFI_ERROR(status)) { + efifb->fb_addr = 0; + efifb->fb_size = 0; + } + + /* +* There's no reliable way to detect the frame buffer or the +* offset within the frame buffer of the visible region, nor +* the stride. Our only option is to look at the system and +* fill in the blanks based on that. Luckily, UGA was mostly +* only used on Apple hardware. +*/ + offset = -1; + ev = getenv("smbios.system.maker"); + if (ev != NULL && !strcmp(ev, "Apple Inc.")) { + ev = getenv("smbios.system.product"); + if (ev != NULL && !strcmp(ev, "iMac7,1")) { + /* These are the expected values we should have. */ + horiz = 1680; + vert = 1050; + fbaddr = 0xc000; + /* These are the missing bits. */ + offset = 0x1; + stride = 1728; + } else if (ev != NULL && !strcmp(ev, "MacBook3,1")) { + /* These are the expected values we should have. */ + horiz = 1280; + vert = 800; + fbaddr = 0xc000; + /* These are the missing bits. */ + offset = 0x0; + stride = 2048; + } + } + + /* +* If this is hardware we know, make sure that it looks familiar +* before we accept our hardcoded values. +*/ + if (offset >= 0 && efifb->fb_width == horiz && + efifb->fb_height == vert && efifb->fb_addr == fbaddr) { + efifb->fb_addr += offset; + efifb->fb_size -= offset; + efifb->fb_stride = stride; + return (0); + } else if (offset >= 0) { + printf("Hardware make/model known, but graphics not " + "as expected.\n"); + printf("Console may not work!\n"); + } + /* * The stride is equal or larger to the width. Often it's the * next larger power of two. We'll start with that... @@ -298,16 +357,11 @@ efifb_from_uga(struct efi_fb *efifb, EFI } } while (np); - /* pciio can be NULL on return! */ - pciio = efifb_uga_get_pciio(); - - ev = getenv("uga_framebuffer"); + ev = getenv("hw.efifb.address"); if (ev == NULL) { - /* Try to find the frame buffer. */ - status = efifb_uga_locate_framebuffer(pciio, &efifb->fb_addr, -
svn commit: r287489 - head/sys/boot/efi/loader/arch/amd64
Author: marcel Date: Sat Sep 5 18:24:51 2015 New Revision: 287489 URL: https://svnweb.freebsd.org/changeset/base/287489 Log: Auto-detect the UGA frame buffer and stride on a MacBook. We're striking a delicate balance between exhaustive searching and banking on assumptions. The environment variables can be used as a fall-back anyway. With this change, all known and tested Macs with only UGA should have a working console out of the box... for now... Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c == --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sat Sep 5 17:34:49 2015(r287488) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sat Sep 5 18:24:51 2015(r287489) @@ -175,7 +175,7 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOC ofs += count; size -= count; } - printf("Couldn't find the pixel"); + printf("No change detected in frame buffer"); fail: printf(" -- error %lu\n", status & ~EFI_ERROR_MASK); @@ -218,18 +218,20 @@ efifb_uga_get_pciio(void) } static EFI_STATUS -efifb_uga_detect_framebuffer(EFI_UGA_DRAW_PROTOCOL *uga, -EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp, uint64_t *sizep) +efifb_uga_locate_framebuffer(EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp, +uint64_t *sizep) { uint8_t *resattr; - uint64_t a, addr, s, size; - ssize_t ofs; + uint64_t addr, size; EFI_STATUS status; u_int bar; + if (pciio == NULL) + return (EFI_DEVICE_ERROR); + /* Attempt to get the frame buffer address (imprecise). */ - addr = 0; - size = 0; + *addrp = 0; + *sizep = 0; for (bar = 0; bar < 6; bar++) { status = pciio->GetBarAttributes(pciio, bar, NULL, (void **)&resattr); @@ -238,43 +240,27 @@ efifb_uga_detect_framebuffer(EFI_UGA_DRA /* XXX magic offsets and constants. */ if (resattr[0] == 0x87 && resattr[3] == 0) { /* 32-bit address space descriptor (MEMIO) */ - a = le32dec(resattr + 10); - s = le32dec(resattr + 22); + addr = le32dec(resattr + 10); + size = le32dec(resattr + 22); } else if (resattr[0] == 0x8a && resattr[3] == 0) { /* 64-bit address space descriptor (MEMIO) */ - a = le64dec(resattr + 14); - s = le64dec(resattr + 38); + addr = le64dec(resattr + 14); + size = le64dec(resattr + 38); } else { - a = 0; - s = 0; + addr = 0; + size = 0; } BS->FreePool(resattr); - if (a == 0 || s == 0) + if (addr == 0 || size == 0) continue; /* We assume the largest BAR is the frame buffer. */ - if (s > size) { - addr = a; - size = s; + if (size > *sizep) { + *addrp = addr; + *sizep = size; } } - if (addr == 0 || size == 0) - return (EFI_DEVICE_ERROR); - - /* -* The visible part of the frame buffer may not start at offset -* 0, so try to detect it. -*/ - ofs = efifb_uga_find_pixel(uga, 0, pciio, addr, size); - if (ofs == -1) - return (EFI_NO_RESPONSE); - - addr += ofs; - size -= ofs; - - *addrp = addr; - *sizep = size; - return (0); + return ((*addrp == 0 || *sizep == 0) ? EFI_DEVICE_ERROR : 0); } static int @@ -284,29 +270,75 @@ efifb_from_uga(struct efi_fb *efifb, EFI char *ev, *p; EFI_STATUS status; ssize_t ofs; - uint32_t horiz, vert, depth, refresh; + uint32_t np, horiz, vert, depth, refresh; status = uga->GetMode(uga, &horiz, &vert, &depth, &refresh); if (EFI_ERROR(status)) return (1); efifb->fb_height = vert; efifb->fb_width = horiz; + /* Paranoia... */ + if (efifb->fb_height == 0 || efifb->fb_width == 0) + return (1); + + /* The color masks are fixed AFAICT. */ efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, NULL); + /* +* The stride is equal or larger to the width. Often it's the +* next larger power of two. We'll start with that... +*/ + efifb->fb_stride = efifb->fb_width; + do { + np = efifb->fb_stride & (efifb->fb_stride - 1); + if (np) { + efifb->fb_strid
svn commit: r287475 - head/sys/boot/efi/loader/arch/amd64
Author: marcel Date: Sat Sep 5 03:27:23 2015 New Revision: 287475 URL: https://svnweb.freebsd.org/changeset/base/287475 Log: My MacBook has UGA only, but we fail to detect any changes in the frame buffer when we flip pixels. Allow the detection to be bypassed by setting the uga_framebuffer and uga_stride variables. The kernel console works fine even when we can't detect pixel changes in the frame buffer, which indicates that the problem could be with reading from the frame buffer and not writing to it. Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c == --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sat Sep 5 01:00:02 2015(r287474) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sat Sep 5 03:27:23 2015(r287475) @@ -183,29 +183,24 @@ efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOC return (-1); } -static EFI_STATUS -efifb_uga_detect_framebuffer(EFI_UGA_DRAW_PROTOCOL *uga, -EFI_PCI_IO_PROTOCOL **pciiop, uint64_t *addrp, uint64_t *sizep) +static EFI_PCI_IO_PROTOCOL * +efifb_uga_get_pciio(void) { EFI_PCI_IO_PROTOCOL *pciio; EFI_HANDLE *buf, *hp; - uint8_t *resattr; - uint64_t a, addr, s, size; - ssize_t ofs; EFI_STATUS status; UINTN bufsz; - u_int bar; /* Get all handles that support the UGA protocol. */ bufsz = 0; status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, NULL); if (status != EFI_BUFFER_TOO_SMALL) - return (status); + return (NULL); buf = malloc(bufsz); status = BS->LocateHandle(ByProtocol, &uga_guid, NULL, &bufsz, buf); if (status != EFI_SUCCESS) { free(buf); - return (status); + return (NULL); } bufsz /= sizeof(EFI_HANDLE); @@ -213,12 +208,24 @@ efifb_uga_detect_framebuffer(EFI_UGA_DRA pciio = NULL; for (hp = buf; hp < buf + bufsz; hp++) { status = BS->HandleProtocol(*hp, &pciio_guid, (void **)&pciio); - if (status == EFI_SUCCESS) - break; + if (status == EFI_SUCCESS) { + free(buf); + return (pciio); + } } free(buf); - if (status != EFI_SUCCESS || pciio == NULL) - return (EFI_NOT_FOUND); + return (NULL); +} + +static EFI_STATUS +efifb_uga_detect_framebuffer(EFI_UGA_DRAW_PROTOCOL *uga, +EFI_PCI_IO_PROTOCOL *pciio, uint64_t *addrp, uint64_t *sizep) +{ + uint8_t *resattr; + uint64_t a, addr, s, size; + ssize_t ofs; + EFI_STATUS status; + u_int bar; /* Attempt to get the frame buffer address (imprecise). */ addr = 0; @@ -265,7 +272,6 @@ efifb_uga_detect_framebuffer(EFI_UGA_DRA addr += ofs; size -= ofs; - *pciiop = pciio; *addrp = addr; *sizep = size; return (0); @@ -275,6 +281,7 @@ static int efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga) { EFI_PCI_IO_PROTOCOL *pciio; + char *ev, *p; EFI_STATUS status; ssize_t ofs; uint32_t horiz, vert, depth, refresh; @@ -287,18 +294,37 @@ efifb_from_uga(struct efi_fb *efifb, EFI efifb_mask_from_pixfmt(efifb, PixelBlueGreenRedReserved8BitPerColor, NULL); - /* Try and find the frame buffer. */ - status = efifb_uga_detect_framebuffer(uga, &pciio, &efifb->fb_addr, - &efifb->fb_size); - if (EFI_ERROR(status)) + pciio = efifb_uga_get_pciio(); + if (pciio == NULL) return (1); - /* Try and detect the stride. */ - ofs = efifb_uga_find_pixel(uga, 1, pciio, efifb->fb_addr, - efifb->fb_size); - if (ofs == -1) - return (1); - efifb->fb_stride = ofs >> 2; + ev = getenv("uga_framebuffer"); + if (ev == NULL) { + /* Try to find the frame buffer. */ + status = efifb_uga_detect_framebuffer(uga, pciio, + &efifb->fb_addr, &efifb->fb_size); + if (EFI_ERROR(status)) + return (1); + } else { + efifb->fb_size = horiz * vert * 4; + efifb->fb_addr = strtoul(ev, &p, 0); + if (*p != '\0') + return (1); + } + + ev = getenv("uga_stride"); + if (ev == NULL) { + /* Try to detect the stride. */ + ofs = efifb_uga_find_pixel(uga, 1, pciio, efifb->fb_addr, + efifb->fb_size); + if (ofs == -1) + return (1); + efifb->fb_stride = ofs >> 2; + } else { + efifb->fb_stride = strtoul(ev, &p, 0); + if (*p != '\0') +
svn commit: r287422 - head/sys/boot/efi/loader/arch/amd64
Author: marcel Date: Thu Sep 3 04:35:17 2015 New Revision: 287422 URL: https://svnweb.freebsd.org/changeset/base/287422 Log: For UGA, the frame buffer address obtained by scanning the PCI BARs does not necessarily correspond to the upper-left most pixel. Scan the frame buffer for which byte changed when changing the pixel at (0,0). Use the same technique to determine the stride. Except for changing the pixel at (0,0), we change the pixel at (0,1). PR: 202730 Tested by:hartzell (at) alerce.com Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c == --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Thu Sep 3 03:58:59 2015(r287421) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Thu Sep 3 04:35:17 2015(r287422) @@ -43,6 +43,21 @@ static EFI_GUID gop_guid = EFI_GRAPHICS_ static EFI_GUID pciio_guid = EFI_PCI_IO_PROTOCOL_GUID; static EFI_GUID uga_guid = EFI_UGA_DRAW_PROTOCOL_GUID; +static u_int +efifb_color_depth(struct efi_fb *efifb) +{ + uint32_t mask; + u_int depth; + + mask = efifb->fb_mask_red | efifb->fb_mask_green | + efifb->fb_mask_blue | efifb->fb_mask_reserved; + if (mask == 0) + return (0); + for (depth = 1; mask != 1; depth++) + mask >>= 1; + return (depth); +} + static int efifb_mask_from_pixfmt(struct efi_fb *efifb, EFI_GRAPHICS_PIXEL_FORMAT pixfmt, EFI_PIXEL_BITMASK *pixinfo) @@ -92,83 +107,198 @@ efifb_from_gop(struct efi_fb *efifb, EFI return (result); } -static int -efifb_from_uga(struct efi_fb *efifb, EFI_UGA_DRAW_PROTOCOL *uga) +static ssize_t +efifb_uga_find_pixel(EFI_UGA_DRAW_PROTOCOL *uga, u_int line, +EFI_PCI_IO_PROTOCOL *pciio, uint64_t addr, uint64_t size) +{ + EFI_UGA_PIXEL pix0, pix1; + uint8_t *data1, *data2; + size_t count, maxcount = 1024; + ssize_t ofs; + EFI_STATUS status; + u_int idx; + + status = uga->Blt(uga, &pix0, EfiUgaVideoToBltBuffer, + 0, line, 0, 0, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (video->buffer)"); + return (-1); + } + pix1.Red = ~pix0.Red; + pix1.Green = ~pix0.Green; + pix1.Blue = ~pix0.Blue; + pix1.Reserved = 0; + + data1 = calloc(maxcount, 2); + if (data1 == NULL) { + printf("Unable to allocate memory"); + return (-1); + } + data2 = data1 + maxcount; + + ofs = 0; + while (size > 0) { + count = min(size, maxcount); + + status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32, + EFI_PCI_IO_PASS_THROUGH_BAR, addr + ofs, count >> 2, + data1); + if (EFI_ERROR(status)) { + printf("Error reading frame buffer (before)"); + goto fail; + } + status = uga->Blt(uga, &pix1, EfiUgaBltBufferToVideo, + 0, 0, 0, line, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (modify)"); + goto fail; + } + status = pciio->Mem.Read(pciio, EfiPciIoWidthUint32, + EFI_PCI_IO_PASS_THROUGH_BAR, addr + ofs, count >> 2, + data2); + if (EFI_ERROR(status)) { + printf("Error reading frame buffer (after)"); + goto fail; + } + status = uga->Blt(uga, &pix0, EfiUgaBltBufferToVideo, + 0, 0, 0, line, 1, 1, 0); + if (EFI_ERROR(status)) { + printf("UGA BLT operation failed (restore)"); + goto fail; + } + for (idx = 0; idx < count; idx++) { + if (data1[idx] != data2[idx]) { + free(data1); + return (ofs + (idx & ~3)); + } + } + ofs += count; + size -= count; + } + printf("Couldn't find the pixel"); + + fail: + printf(" -- error %lu\n", status & ~EFI_ERROR_MASK); + free(data1); + return (-1); +} + +static EFI_STATUS +efifb_uga_detect_framebuffer(EFI_UGA_DRAW_PROTOCOL *uga, +EFI_PCI_IO_PROTOCOL **pciiop, uint64_t *addrp, uint64_t *sizep) { - uint8_t *buf; EFI_PCI_IO_PROTOCOL *pciio; - EFI_HANDLE handle; + EFI_HANDLE *buf, *hp; + uint8_t *resattr; + uint64_t a, addr, s, size; + ssize_t ofs; EFI_STATUS status; - UINTN bufofs, bufsz; - uint64_t address, length; - uint32_t horiz, vert, depth, refresh; + UINTN bufsz; u_int bar; - statu
Re: svn commit: r287299 - head/sys/boot/efi/loader/arch/amd64
> On Aug 30, 2015, at 11:27 AM, Rui Paulo wrote: > > On Sun, 2015-08-30 at 01:40 +0000, Marcel Moolenaar wrote: >> Author: marcel >> Date: Sun Aug 30 01:39:59 2015 >> New Revision: 287299 >> URL: https://svnweb.freebsd.org/changeset/base/287299 >> >> Log: >> Add a gop command to help diagnose VT efifb problems. The gop >> command has the following sub-commands: >>list - list all possible modes (paged) >>get - return the current mode >>set - set the current mode to >> > > This is duplicating the functionality of the `mode' command. Please > remove the mode command. It doesn’t. The mode command works on text modes only. This command works on the Graphics Output Protocol (GOP) modes. > > Also, 'gop' is pretty weird for a command name. Maybe we can change > that to something more user friendly? Maybe. -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r287317 - in head/sys/boot/efi: include loader/arch/amd64
Author: marcel Date: Sun Aug 30 23:58:53 2015 New Revision: 287317 URL: https://svnweb.freebsd.org/changeset/base/287317 Log: Add support for the UGA draw protocol. This includes adding a command called 'uga' to show whether UGA is implemented by the firmware and what the settings are. It also includes filling the efi_fb structure from the UGA information when GOP isn't implemented by the firmware. Since UGA does not provide information about the stride, we set the stride to the horizontal resolution. This is likely not correct and we should determine the stride by trial and error. For now, this should show something on the console rather than nothing. Refactor this file to maximize code reuse. PR: 202730 Added: head/sys/boot/efi/include/efipciio.h (contents, props changed) head/sys/boot/efi/include/efiuga.h (contents, props changed) Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Added: head/sys/boot/efi/include/efipciio.h == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/boot/efi/include/efipciio.hSun Aug 30 23:58:53 2015 (r287317) @@ -0,0 +1,559 @@ +/* $FreeBSD$ */ +/** @file + EFI PCI I/O Protocol provides the basic Memory, I/O, PCI configuration, + and DMA interfaces that a driver uses to access its PCI controller. + + Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __PCI_IO_H__ +#define __PCI_IO_H__ + +/// +/// Global ID for the PCI I/O Protocol +/// +#define EFI_PCI_IO_PROTOCOL_GUID \ + { \ +0x4cf5b200, 0x68b8, 0x4ca5, {0x9e, 0xec, 0xb2, 0x3e, 0x3f, 0x50, 0x2, 0x9a } \ + } + +typedef struct _EFI_PCI_IO_PROTOCOL EFI_PCI_IO_PROTOCOL; + +/// +/// *** +/// EFI_PCI_IO_PROTOCOL_WIDTH +/// *** +/// +typedef enum { + EfiPciIoWidthUint8 = 0, + EfiPciIoWidthUint16, + EfiPciIoWidthUint32, + EfiPciIoWidthUint64, + EfiPciIoWidthFifoUint8, + EfiPciIoWidthFifoUint16, + EfiPciIoWidthFifoUint32, + EfiPciIoWidthFifoUint64, + EfiPciIoWidthFillUint8, + EfiPciIoWidthFillUint16, + EfiPciIoWidthFillUint32, + EfiPciIoWidthFillUint64, + EfiPciIoWidthMaximum +} EFI_PCI_IO_PROTOCOL_WIDTH; + +// +// Complete PCI address generater +// +#define EFI_PCI_IO_PASS_THROUGH_BAR 0xff///< Special BAR that passes a memory or I/O cycle through unchanged +#define EFI_PCI_IO_ATTRIBUTE_MASK 0x077f ///< All the following I/O and Memory cycles +#define EFI_PCI_IO_ATTRIBUTE_ISA_MOTHERBOARD_IO 0x0001 ///< I/O cycles 0x-0x00FF (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_ISA_IO 0x0002 ///< I/O cycles 0x0100-0x03FF or greater (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO 0x0004 ///< I/O cycles 0x3C6, 0x3C8, 0x3C9 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY 0x0008 ///< MEM cycles 0xA-0xB (24 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_VGA_IO 0x0010 ///< I/O cycles 0x3B0-0x3BB and 0x3C0-0x3DF (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO 0x0020 ///< I/O cycles 0x1F0-0x1F7, 0x3F6, 0x3F7 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO 0x0040 ///< I/O cycles 0x170-0x177, 0x376, 0x377 (10 bit decode) +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_WRITE_COMBINE 0x0080 ///< Map a memory range so writes are combined +#define EFI_PCI_IO_ATTRIBUTE_IO 0x0100 ///< Enable the I/O decode bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_MEMORY 0x0200 ///< Enable the Memory decode bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_BUS_MASTER 0x0400 ///< Enable the DMA bit in the PCI Config Header +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_CACHED0x0800 ///< Map a memory range so all r/w accesses are cached +#define EFI_PCI_IO_ATTRIBUTE_MEMORY_DISABLE 0x1000 ///< Disable a memory range +#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_DEVICE 0x2000 ///< Clear for an add-in PCI Device +#define EFI_PCI_IO_ATTRIBUTE_EMBEDDED_ROM 0x4000 ///< Clear for a physical PCI Option ROM accessed through ROM BAR +#define EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE 0x8000 ///< Clear for PCI controllers that can not genrate a DAC +#defin
svn commit: r287299 - head/sys/boot/efi/loader/arch/amd64
Author: marcel Date: Sun Aug 30 01:39:59 2015 New Revision: 287299 URL: https://svnweb.freebsd.org/changeset/base/287299 Log: Add a gop command to help diagnose VT efifb problems. The gop command has the following sub-commands: list- list all possible modes (paged) get - return the current mode set - set the current mode to Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c Modified: head/sys/boot/efi/loader/arch/amd64/framebuffer.c == --- head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sat Aug 29 20:41:09 2015(r287298) +++ head/sys/boot/efi/loader/arch/amd64/framebuffer.c Sun Aug 30 01:39:59 2015(r287299) @@ -29,6 +29,7 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include @@ -83,3 +84,97 @@ efi_find_framebuffer(struct efi_fb *efif } return (0); } + +COMMAND_SET(gop, "gop", "graphics output protocol", command_gop); + +static void +command_gop_display(u_int mode, EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info) +{ + + printf("mode %u: %ux%u, stride=%u, color=", mode, + info->HorizontalResolution, info->VerticalResolution, + info->PixelsPerScanLine); + switch (info->PixelFormat) { + case PixelRedGreenBlueReserved8BitPerColor: + printf("32-bit (RGB)"); + break; + case PixelBlueGreenRedReserved8BitPerColor: + printf("32-bit (BGR)"); + break; + case PixelBitMask: + printf("mask (R=%x, G=%x, B=%x, X=%x)", + info->PixelInformation.RedMask, + info->PixelInformation.GreenMask, + info->PixelInformation.BlueMask, + info->PixelInformation.ReservedMask); + break; + case PixelBltOnly: + printf("unsupported (blt only)"); + break; + default: + printf("unsupported (unknown)"); + break; + } +} + +static int +command_gop(int argc, char *argv[]) +{ + EFI_GRAPHICS_OUTPUT *gop; + EFI_STATUS status; + u_int mode; + + status = BS->LocateProtocol(&gop_guid, NULL, (VOID **)&gop); + if (EFI_ERROR(status)) { + sprintf(command_errbuf, "%s: Graphics Output Protocol not " + "present (error=%lu)", argv[0], status & ~EFI_ERROR_MASK); + return (CMD_ERROR); + } + + if (argc == 1) + goto usage; + + if (!strcmp(argv[1], "set")) { + char *cp; + + if (argc != 3) + goto usage; + mode = strtol(argv[2], &cp, 0); + if (cp[0] != '\0') { + sprintf(command_errbuf, "mode is an integer"); + return (CMD_ERROR); + } + status = gop->SetMode(gop, mode); + if (EFI_ERROR(status)) { + sprintf(command_errbuf, "%s: Unable to set mode to " + "%u (error=%lu)", argv[0], mode, + status & ~EFI_ERROR_MASK); + return (CMD_ERROR); + } + } else if (!strcmp(argv[1], "get")) { + command_gop_display(gop->Mode->Mode, gop->Mode->Info); + printf("\nframe buffer: address=%jx, size=%lx\n", + (uintmax_t)gop->Mode->FrameBufferBase, + gop->Mode->FrameBufferSize); + } else if (!strcmp(argv[1], "list")) { + EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *info; + UINTN infosz; + + pager_open(); + for (mode = 0; mode < gop->Mode->MaxMode; mode++) { + status = gop->QueryMode(gop, mode, &infosz, &info); + if (EFI_ERROR(status)) + continue; + command_gop_display(mode, info); + if (pager_output("\n")) + break; + } + pager_close(); + } + return (CMD_OK); + + usage: + sprintf(command_errbuf, "usage: %s [list | get | set ]", + argv[0]); + return (CMD_ERROR); +} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r287190 - head/sys/kern
Author: marcel Date: Thu Aug 27 04:25:27 2015 New Revision: 287190 URL: https://svnweb.freebsd.org/changeset/base/287190 Log: An error of -1 from parse_mount() indicates that the specification was invalid. Don't trigger a mount failure (which by default means a panic), but instead just move on to the next directive in the configuration. This typically has us ask for the root mount. PR: 163245 Modified: head/sys/kern/vfs_mountroot.c Modified: head/sys/kern/vfs_mountroot.c == --- head/sys/kern/vfs_mountroot.c Thu Aug 27 03:47:56 2015 (r287189) +++ head/sys/kern/vfs_mountroot.c Thu Aug 27 04:25:27 2015 (r287190) @@ -791,6 +791,11 @@ retry: break; default: error = parse_mount(&conf); + if (error == -1) { + printf("mountroot: invalid file system " + "specification.\n"); + error = 0; + } break; } if (error < 0) ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r287128 - in stable/10/sys: amd64/amd64 dev/vt dev/vt/hw/efifb dev/vt/hw/fb
Author: marcel Date: Tue Aug 25 15:14:50 2015 New Revision: 287128 URL: https://svnweb.freebsd.org/changeset/base/287128 Log: MFC r286808, r286809, r286867, r286868 - Improve support for Macs that have a stride not equal to the horizonal resolution (width). - Support frame buffers that are larger than the default screen size. - Support large frame buffers: add 24 more page table pages we allocate on boot-up. PR: 193745 Modified: stable/10/sys/amd64/amd64/pmap.c stable/10/sys/dev/vt/hw/efifb/efifb.c stable/10/sys/dev/vt/hw/fb/vt_fb.c stable/10/sys/dev/vt/vt.h stable/10/sys/dev/vt/vt_core.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/amd64/amd64/pmap.c == --- stable/10/sys/amd64/amd64/pmap.cTue Aug 25 14:49:11 2015 (r287127) +++ stable/10/sys/amd64/amd64/pmap.cTue Aug 25 15:14:50 2015 (r287128) @@ -701,8 +701,14 @@ nkpt_init(vm_paddr_t addr) * pmap_growkernel() will need to allocate page table pages to map * the entire 512GB of KVA space which is an unnecessary tax on * physical memory. +* +* Secondly, device memory mapped as part of setting up the low- +* level console(s) is taken from KVA, starting at virtual_avail. +* This is because cninit() is called after pmap_bootstrap() but +* before vm_init() and pmap_init(). 20MB for a frame buffer is +* not uncommon. */ - pt_pages += 8; /* 16MB additional slop for kernel modules */ + pt_pages += 32; /* 64MB additional slop. */ #endif nkpt = pt_pages; } Modified: stable/10/sys/dev/vt/hw/efifb/efifb.c == --- stable/10/sys/dev/vt/hw/efifb/efifb.c Tue Aug 25 14:49:11 2015 (r287127) +++ stable/10/sys/dev/vt/hw/efifb/efifb.c Tue Aug 25 15:14:50 2015 (r287128) @@ -98,7 +98,6 @@ vt_efifb_probe(struct vt_device *vd) static int vt_efifb_init(struct vt_device *vd) { - int depth, d; struct fb_info *info; struct efi_fb *efifb; caddr_t kmdp; @@ -118,16 +117,13 @@ vt_efifb_init(struct vt_device *vd) info->fb_height = efifb->fb_height; info->fb_width = efifb->fb_width; - depth = fls(efifb->fb_mask_red); - d = fls(efifb->fb_mask_green); - depth = d > depth ? d : depth; - d = fls(efifb->fb_mask_blue); - depth = d > depth ? d : depth; - d = fls(efifb->fb_mask_reserved); - depth = d > depth ? d : depth; - info->fb_depth = depth; + info->fb_depth = fls(efifb->fb_mask_red | efifb->fb_mask_green | + efifb->fb_mask_blue | efifb->fb_mask_reserved); + /* Round to a multiple of the bits in a byte. */ + info->fb_bpp = (info->fb_depth + NBBY - 1) & ~(NBBY - 1); - info->fb_stride = efifb->fb_stride * (depth / 8); + /* Stride in bytes, not pixels */ + info->fb_stride = efifb->fb_stride * (info->fb_bpp / NBBY); vt_generate_cons_palette(info->fb_cmap, COLOR_FORMAT_RGB, efifb->fb_mask_red, ffs(efifb->fb_mask_red) - 1, @@ -139,16 +135,6 @@ vt_efifb_init(struct vt_device *vd) info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase, info->fb_size, VM_MEMATTR_WRITE_COMBINING); - /* Get pixel storage size. */ - info->fb_bpp = info->fb_stride / info->fb_width * 8; - - /* -* Early FB driver work with static window buffer, so reduce to minimal -* size, buffer or screen. -*/ - info->fb_width = MIN(info->fb_width, VT_FB_DEFAULT_WIDTH); - info->fb_height = MIN(info->fb_height, VT_FB_DEFAULT_HEIGHT); - vt_fb_init(vd); return (CN_INTERNAL); Modified: stable/10/sys/dev/vt/hw/fb/vt_fb.c == --- stable/10/sys/dev/vt/hw/fb/vt_fb.c Tue Aug 25 14:49:11 2015 (r287127) +++ stable/10/sys/dev/vt/hw/fb/vt_fb.c Tue Aug 25 15:14:50 2015 (r287128) @@ -280,6 +280,7 @@ vt_fb_bitblt_bitmap(struct vt_device *vd if (mask != NULL && (mask[byte] & bit) == 0) continue; o = (y + yi) * info->fb_stride + (x + xi) * bpp; + o += vd->vd_transpose; cc = pattern[byte] & bit ? fgc : bgc; switch(bpp) { @@ -397,11 +398,16 @@ int vt_fb_init(struct vt_device *vd) { struct fb_info *info; + u_int margin; int err; info = vd->vd_softc; - vd->vd_height = info->fb_height; - vd->vd_width = info->fb_width; + vd->vd_height = MIN(VT_FB_DEFAULT_HEIGHT, info->fb_height); + margin = (info->fb_height - vd->vd_height) >> 1; + vd->vd_transpose = margin * in
svn commit: r287126 - in stable/10/sys: amd64/amd64 conf dev/vt/hw/efifb dev/vt/hw/vga i386/i386 x86/include x86/x86
/include/bus.h Tue Aug 25 09:16:09 2015 (r287125) +++ stable/10/sys/x86/include/bus.h Tue Aug 25 14:39:40 2015 (r287126) @@ -130,32 +130,15 @@ * Map a region of device bus space into CPU virtual address space. */ -static __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int flags, - bus_space_handle_t *bshp); - -static __inline int -bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr, - bus_size_t size __unused, int flags __unused, - bus_space_handle_t *bshp) -{ - - *bshp = addr; - return (0); -} +int bus_space_map(bus_space_tag_t tag, bus_addr_t addr, bus_size_t size, +int flags, bus_space_handle_t *bshp); /* * Unmap a region of device bus space. */ -static __inline void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, -bus_size_t size); - -static __inline void -bus_space_unmap(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused, - bus_size_t size __unused) -{ -} +void bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t bsh, +bus_size_t size); /* * Get a new handle for a subregion of an already-mapped area of bus space. Copied: stable/10/sys/x86/x86/bus_machdep.c (from r286667, head/sys/x86/x86/bus_machdep.c) == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/10/sys/x86/x86/bus_machdep.c Tue Aug 25 14:39:40 2015 (r287126, copy of r286667, head/sys/x86/x86/bus_machdep.c) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2015 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +/* + * Implementation of bus_space_map(), which effectively is a thin + * wrapper around pmap_mapdev() for memory mapped I/O space. It's + * implemented here and not in to avoid pollution. + */ +int +bus_space_map(bus_space_tag_t tag, bus_addr_t addr, bus_size_t size, +int flags __unused, bus_space_handle_t *bshp) +{ + + *bshp = (tag == X86_BUS_SPACE_MEM) + ? (uintptr_t)pmap_mapdev(addr, size) + : addr; + return (0); +} + +void +bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size) +{ + + if (tag == X86_BUS_SPACE_MEM) + pmap_unmapdev(bsh, size); +} ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r287122 - stable/10/usr.bin/mkimg
y details. +.Sh DISK FORMATS +The +.Nm +utility supports a number of output file formats. +A short description of these is given below. +.Ss QCOW and QCOW2 +QCOW stands for "QEMU Copy On Write". +It's a sparse file format akin to VHD and VMDK and QCOW represents the +first version. +QCOW2 represents version 2 of the file format. +Version 2 is not backward compatible with version 1 and adds support for +snapshots among other things. +The QCOW file formats are natively supported by QEMU and Xen. +To write QCOW, specify +.Fl f Ar qcow +on the command line. +To write version 2 QCOW, specify +.Fl f Ar qcow2 +on the command line. +The preferred file extension is ".qcow" and ".qcow2" for QCOW and QCOW2 +(resp.), but ".qcow" is sometimes used for version 2 files as well. +.Ss RAW file format +This file format is a sector by sector representation of an actual disk. +There is no extra information that describes or relates to the format +itself. The size of the file is the size of the (virtual) disk. +This file format is suitable for being copyied onto a disk with utilities +like +.Nm dd . +To write a raw disk file, either omit the +.Fl f +option, or specify +.Fl f Ar raw +on the command line. +The preferred file extension is one of ".img" or ".raw", but there's no +real convention for it. +.Ss Dynamic VHD and Fixed VHD +Microsoft's "Virtual Hard Disk" file formats. +The dynamic format is a sparse format akin to QCOW and VMDK. +The fixed format is effectively a raw format with a footer appended to the +file and as such it's often indistinguishable from the raw format. +The fixed file format has been added to support Microsoft's Azure platform +and due to inconsistencies in interpretation of the footer is not compatible +with utilities like +.Nm qemu +when it is specifically instructed to interpreted the file as a VHD file. +By default +.Nm qemu +will treat the file as a raw disk file, which mostly works fine. +To have +.Nm +create a dynamic VHD file, specify +.Fl f Ar vhd +on the command line. +To create a fixed VHD file for use by Azure, specify +.Fl f Ar vhdf +on the command line. +The preferred file extension is ".vhd". +.Ss VMDK +VMware's "Virtual Machine Disk" file format. +It's a sparse file format akin to QCOW and VHD and supported by many +virtualization solutions. +To create a VMDK file, specify +.Fl f Ar vmdk +on the command line. +The preferred file extension is ".vmdk". +.Pp +Not all virtualization solutions support all file formats, but often those +virtualization environments have utilities to convert from one format to +another. +Note however that conversion may require that the virtual disk size is +changed to match the constraints of the output format and this may invalidate +the contents of the disk image. +For example, the GUID Partition Table (GPT) scheme has a header in the last +sector on the disk. +When changing the disk size, the GPT must be changed so that the last header +is moved accordingly. +This is typically not part of the conversion process. +If possible, use an output format specifically for the environment in which +the file is intended to be used. .Sh ENVIRONMENT .Bl -tag -width "TMPDIR" -compact .It Ev TMPDIR @@ -235,6 +314,7 @@ utility supports assigning labels to the In the following example the file system partition is labeled as 'backup': .Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img .Sh SEE ALSO +.Xr dd 1 , .Xr gpart 8 , .Xr makefs 8 , .Xr mdconfig 8 , @@ -247,4 +327,5 @@ utility first appeared in .Sh AUTHORS The .Nm -utility and manpage were written by Marcel Moolenaar +utility and manpage were written by +.An Marcel Moolenaar Aq Mt marc...@juniper.net . Modified: stable/10/usr.bin/mkimg/scheme.c == --- stable/10/usr.bin/mkimg/scheme.cTue Aug 25 01:01:25 2015 (r287121) +++ stable/10/usr.bin/mkimg/scheme.cTue Aug 25 04:03:51 2015 (r287122) @@ -59,6 +59,7 @@ static struct { { "freebsd-vinum", ALIAS_FREEBSD_VINUM }, { "freebsd-zfs", ALIAS_FREEBSD_ZFS }, { "mbr", ALIAS_MBR }, + { "ntfs", ALIAS_NTFS }, { NULL, ALIAS_NONE }/* Keep last! */ }; Modified: stable/10/usr.bin/mkimg/scheme.h == --- stable/10/usr.bin/mkimg/scheme.hTue Aug 25 01:01:25 2015 (r287121) +++ stable/10/usr.bin/mkimg/scheme.hTue Aug 25 04:03:51 2015 (r287122) @@ -45,6 +45,7 @@ enum alias { ALIAS_FREEBSD_VINUM, ALIAS_FREEBSD_ZFS, ALIAS_MBR, + ALIAS_NTFS, /* end */ ALIAS_COUNT /* Keep last! */ }; Modified: stable/10/usr.bin/mkimg/vhd.c =
svn commit: r287114 - head/contrib/libxo/libxo
Author: marcel Date: Mon Aug 24 17:58:11 2015 New Revision: 287114 URL: https://svnweb.freebsd.org/changeset/base/287114 Log: Fix build for architectures that define wchar_t as an unsigned int. Reported by: bz@ Modified: head/contrib/libxo/libxo/xo_wcwidth.h Modified: head/contrib/libxo/libxo/xo_wcwidth.h == --- head/contrib/libxo/libxo/xo_wcwidth.h Mon Aug 24 17:28:19 2015 (r287113) +++ head/contrib/libxo/libxo/xo_wcwidth.h Mon Aug 24 17:58:11 2015 (r287114) @@ -62,8 +62,8 @@ #include struct interval { - int first; - int last; + wchar_t first; + wchar_t last; }; /* auxiliary function for binary search in interval table */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r287111 - in head: bin/ls bin/ps contrib/libxo contrib/libxo/bin contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/test contrib/libxo/libxo contr
> On Aug 24, 2015, at 10:07 AM, Bjoern A. Zeeb wrote: > > >> On 24 Aug 2015, at 16:26 , Marcel Moolenaar wrote: >> >> Author: marcel >> Date: Mon Aug 24 16:26:20 2015 >> New Revision: 287111 >> URL: https://svnweb.freebsd.org/changeset/base/287111 >> >> Log: >> Upgrade libxo to 0.4.5. >> >> Local changes incorporated by 0.4.5: r284340 >> Local changes retained: r276260, r282117 >> >> Obtained from: https://github.com/Juniper/libxo > > > arm* broke with a couple of those: > > In file included from /scratch/tmp/bz/head.svn/contrib/libxo/libxo/libxo.c:73: > /scratch/tmp/bz/head.svn/contrib/libxo/libxo/xo_wcwidth.h:76:11: error: > comparison of integers of different signs: 'wchar_t' (aka 'unsigned int') and > 'const int' [-Werror,-Wsign-compare] > if (ucs < table[0].first || ucs > table[max].last) > ~~~ ^ ~~ Ugh. Thanks, -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r287111 - in head: bin/ls bin/ps contrib/libxo contrib/libxo/bin contrib/libxo/doc contrib/libxo/encoder contrib/libxo/encoder/cbor contrib/libxo/encoder/test contrib/libxo/libxo contri...
Author: marcel Date: Mon Aug 24 16:26:20 2015 New Revision: 287111 URL: https://svnweb.freebsd.org/changeset/base/287111 Log: Upgrade libxo to 0.4.5. Local changes incorporated by 0.4.5: r284340 Local changes retained: r276260, r282117 Obtained from:https://github.com/Juniper/libxo Added: head/contrib/libxo/INSTALL.md head/contrib/libxo/encoder/ head/contrib/libxo/encoder/Makefile.am (contents, props changed) head/contrib/libxo/encoder/cbor/ head/contrib/libxo/encoder/cbor/Makefile.am (contents, props changed) head/contrib/libxo/encoder/cbor/enc_cbor.c (contents, props changed) head/contrib/libxo/encoder/test/ head/contrib/libxo/encoder/test/Makefile.am (contents, props changed) head/contrib/libxo/encoder/test/enc_test.c (contents, props changed) head/contrib/libxo/libxo/add.man head/contrib/libxo/libxo/add.man.in (contents, props changed) head/contrib/libxo/libxo/xo_buf.h (contents, props changed) head/contrib/libxo/libxo/xo_config.h - copied, changed from r287110, head/contrib/libxo/libxo/xoconfig.h head/contrib/libxo/libxo/xo_emit_err.3 (contents, props changed) head/contrib/libxo/libxo/xo_encoder.c (contents, props changed) head/contrib/libxo/libxo/xo_encoder.h (contents, props changed) head/contrib/libxo/libxo/xo_humanize.h (contents, props changed) head/contrib/libxo/libxo/xo_message.3 (contents, props changed) head/contrib/libxo/libxo/xo_set_syslog_enterprise_id.3 (contents, props changed) head/contrib/libxo/libxo/xo_syslog.3 (contents, props changed) head/contrib/libxo/libxo/xo_syslog.c (contents, props changed) head/contrib/libxo/libxo/xo_wcwidth.h (contents, props changed) head/contrib/libxo/tests/core/saved/test_01.E.err head/contrib/libxo/tests/core/saved/test_01.E.out head/contrib/libxo/tests/core/saved/test_02.E.err head/contrib/libxo/tests/core/saved/test_02.E.out head/contrib/libxo/tests/core/saved/test_03.E.err head/contrib/libxo/tests/core/saved/test_03.E.out head/contrib/libxo/tests/core/saved/test_04.E.err head/contrib/libxo/tests/core/saved/test_04.E.out head/contrib/libxo/tests/core/saved/test_05.E.err head/contrib/libxo/tests/core/saved/test_05.E.out (contents, props changed) head/contrib/libxo/tests/core/saved/test_06.E.err head/contrib/libxo/tests/core/saved/test_06.E.out head/contrib/libxo/tests/core/saved/test_07.E.err head/contrib/libxo/tests/core/saved/test_07.E.out head/contrib/libxo/tests/core/saved/test_08.E.err head/contrib/libxo/tests/core/saved/test_08.E.out head/contrib/libxo/tests/core/saved/test_09.E.err head/contrib/libxo/tests/core/saved/test_09.E.out head/contrib/libxo/tests/core/saved/test_10.E.err head/contrib/libxo/tests/core/saved/test_10.E.out head/contrib/libxo/tests/core/saved/test_11.E.err head/contrib/libxo/tests/core/saved/test_11.E.out head/contrib/libxo/tests/core/saved/test_11.H.err head/contrib/libxo/tests/core/saved/test_11.H.out head/contrib/libxo/tests/core/saved/test_11.HIPx.err head/contrib/libxo/tests/core/saved/test_11.HIPx.out head/contrib/libxo/tests/core/saved/test_11.HP.err head/contrib/libxo/tests/core/saved/test_11.HP.out head/contrib/libxo/tests/core/saved/test_11.J.err head/contrib/libxo/tests/core/saved/test_11.J.out head/contrib/libxo/tests/core/saved/test_11.JP.err head/contrib/libxo/tests/core/saved/test_11.JP.out head/contrib/libxo/tests/core/saved/test_11.T.err head/contrib/libxo/tests/core/saved/test_11.T.out head/contrib/libxo/tests/core/saved/test_11.X.err head/contrib/libxo/tests/core/saved/test_11.X.out head/contrib/libxo/tests/core/saved/test_11.XP.err head/contrib/libxo/tests/core/saved/test_11.XP.out head/contrib/libxo/tests/core/test_11.c (contents, props changed) head/contrib/libxo/tests/gettext/ head/contrib/libxo/tests/gettext/Makefile.am (contents, props changed) head/contrib/libxo/tests/gettext/gt_01.c (contents, props changed) head/contrib/libxo/tests/gettext/gt_01.pot head/contrib/libxo/tests/gettext/ldns.pot head/contrib/libxo/tests/gettext/po/ head/contrib/libxo/tests/gettext/po/pig_latin/ head/contrib/libxo/tests/gettext/po/pig_latin/gt_01.po head/contrib/libxo/tests/gettext/po/pig_latin/ldns.po head/contrib/libxo/tests/gettext/po/pig_latin/strerror.po head/contrib/libxo/tests/gettext/saved/ head/contrib/libxo/tests/gettext/saved/gt_01.H.err head/contrib/libxo/tests/gettext/saved/gt_01.H.out head/contrib/libxo/tests/gettext/saved/gt_01.HIPx.err head/contrib/libxo/tests/gettext/saved/gt_01.HIPx.out head/contrib/libxo/tests/gettext/saved/gt_01.HP.err head/contrib/libxo/tests/gettext/saved/gt_01.HP.out head/contrib/libxo/tests/gettext/saved/gt_01.J.err head/contrib/libxo/tests/gettext/saved/gt_01.J.out head/contrib/libxo/tests/gettext/saved/gt_01.JP.err head/contrib/libxo/tests/gettext/saved/gt_01.JP.out head/contrib/libxo/tests/gettext/saved/gt_01.T.err head/contrib/libxo/tests/get
svn commit: r286868 - head/sys/amd64/amd64
Author: marcel Date: Tue Aug 18 01:53:41 2015 New Revision: 286868 URL: https://svnweb.freebsd.org/changeset/base/286868 Log: Add 24 more page table pages we allocate on boot-up. 16MB slop is a little tight in and by itself, but severily insufficient when one needs to map a large frame buffer as part of console initialization. 64MB slop should be enough for a while. As an example: a 15" MacBook Pro with retina display needs ~28MB of KVA for the frame buffer. PR: 193745 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c == --- head/sys/amd64/amd64/pmap.c Tue Aug 18 00:47:02 2015(r286867) +++ head/sys/amd64/amd64/pmap.c Tue Aug 18 01:53:41 2015(r286868) @@ -699,8 +699,14 @@ nkpt_init(vm_paddr_t addr) * pmap_growkernel() will need to allocate page table pages to map * the entire 512GB of KVA space which is an unnecessary tax on * physical memory. +* +* Secondly, device memory mapped as part of setting up the low- +* level console(s) is taken from KVA, starting at virtual_avail. +* This is because cninit() is called after pmap_bootstrap() but +* before vm_init() and pmap_init(). 20MB for a frame buffer is +* not uncommon. */ - pt_pages += 8; /* 16MB additional slop for kernel modules */ + pt_pages += 32; /* 64MB additional slop. */ #endif nkpt = pt_pages; } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286867 - in head/sys/dev/vt: . hw/fb
Author: marcel Date: Tue Aug 18 00:47:02 2015 New Revision: 286867 URL: https://svnweb.freebsd.org/changeset/base/286867 Log: Support frame buffers that are larger than the default screen size as defined by VT_FB_DEFAULT_WIDTH and VT_FB_DEFAULT_HEIGHT (at this time 2048x1200). The default is really a max. We cap the height and width to those defaults and position the screen in the center of the frame buffer. Ideally we use a bigger font to utility the entire real estate that is the frame buffer, but that's seen as an improvement over making it work first. PR: 193745 Modified: head/sys/dev/vt/hw/fb/vt_fb.c head/sys/dev/vt/vt.h Modified: head/sys/dev/vt/hw/fb/vt_fb.c == --- head/sys/dev/vt/hw/fb/vt_fb.c Tue Aug 18 00:21:25 2015 (r286866) +++ head/sys/dev/vt/hw/fb/vt_fb.c Tue Aug 18 00:47:02 2015 (r286867) @@ -294,6 +294,7 @@ vt_fb_bitblt_bitmap(struct vt_device *vd if (mask != NULL && (mask[byte] & bit) == 0) continue; o = (y + yi) * info->fb_stride + (x + xi) * bpp; + o += vd->vd_transpose; cc = pattern[byte] & bit ? fgc : bgc; switch(bpp) { @@ -411,11 +412,16 @@ int vt_fb_init(struct vt_device *vd) { struct fb_info *info; + u_int margin; int err; info = vd->vd_softc; - vd->vd_height = info->fb_height; - vd->vd_width = info->fb_width; + vd->vd_height = MIN(VT_FB_DEFAULT_HEIGHT, info->fb_height); + margin = (info->fb_height - vd->vd_height) >> 1; + vd->vd_transpose = margin * info->fb_stride; + vd->vd_width = MIN(VT_FB_DEFAULT_WIDTH, info->fb_width); + margin = (info->fb_width - vd->vd_width) >> 1; + vd->vd_transpose += margin * (info->fb_bpp / NBBY); vd->vd_video_dev = info->fb_video_dev; if (info->fb_size == 0) Modified: head/sys/dev/vt/vt.h == --- head/sys/dev/vt/vt.hTue Aug 18 00:21:25 2015(r286866) +++ head/sys/dev/vt/vt.hTue Aug 18 00:47:02 2015(r286867) @@ -140,6 +140,7 @@ struct vt_device { uint32_t vd_mstate; /* (?) Mouse state. */ vt_axis_tvd_width; /* (?) Screen width. */ vt_axis_tvd_height; /* (?) Screen height. */ + size_t vd_transpose; /* (?) Screen offset in FB */ struct mtx vd_lock; /* Per-device lock. */ struct cvvd_winswitch; /* (d) Window switch notify. */ struct callout vd_timer; /* (d) Display timer. */ ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286809 - head/sys/dev/vt/hw/efifb
Author: marcel Date: Sat Aug 15 16:13:28 2015 New Revision: 286809 URL: https://svnweb.freebsd.org/changeset/base/286809 Log: Improve support for Macs that have a stride not equal to the horizonal resolution (width). In those cases fb_bpp ended up completely wrong -- as in 6 bytes per pixel or something like that. Since we already have a way to calculate fb_depth given the masks and fb_bpp is effectively the same as fb_depth, all we need to do is make sure fb_bpp is rounded to the next multiple of the number of bits in a byte -- we assume we can divide by the number of bits in a byte throughout vt(4). While here: - simplify how we calculate fb_depth. - use fb_bpp instead of fb_depth to calculate fb_stride; we know we can divide fb_bpp. - don't limit fb_width and fb_height by VT_FB_DEFAULT_WIDTH and VT_FB_DEFAULT_HEIGHT (resp.). Those constants have not relation to the size of the frame buffer. This at least fixes "lower-resolution" Macs. We're talking 1280x1024 or so. There still is a problem with 27" Macs, which typically have a horizontal resolution over 2K. PR: 193745 (partial) Ok'd by: emaste@ Modified: head/sys/dev/vt/hw/efifb/efifb.c Modified: head/sys/dev/vt/hw/efifb/efifb.c == --- head/sys/dev/vt/hw/efifb/efifb.cSat Aug 15 15:44:09 2015 (r286808) +++ head/sys/dev/vt/hw/efifb/efifb.cSat Aug 15 16:13:28 2015 (r286809) @@ -96,7 +96,6 @@ vt_efifb_probe(struct vt_device *vd) static int vt_efifb_init(struct vt_device *vd) { - int depth, d; struct fb_info *info; struct efi_fb *efifb; caddr_t kmdp; @@ -116,16 +115,13 @@ vt_efifb_init(struct vt_device *vd) info->fb_height = efifb->fb_height; info->fb_width = efifb->fb_width; - depth = fls(efifb->fb_mask_red); - d = fls(efifb->fb_mask_green); - depth = d > depth ? d : depth; - d = fls(efifb->fb_mask_blue); - depth = d > depth ? d : depth; - d = fls(efifb->fb_mask_reserved); - depth = d > depth ? d : depth; - info->fb_depth = depth; + info->fb_depth = fls(efifb->fb_mask_red | efifb->fb_mask_green | + efifb->fb_mask_blue | efifb->fb_mask_reserved); + /* Round to a multiple of the bits in a byte. */ + info->fb_bpp = (info->fb_depth + NBBY - 1) & ~(NBBY - 1); - info->fb_stride = efifb->fb_stride * (depth / 8); + /* Stride in bytes, not pixels */ + info->fb_stride = efifb->fb_stride * (info->fb_bpp / NBBY); vt_generate_cons_palette(info->fb_cmap, COLOR_FORMAT_RGB, efifb->fb_mask_red, ffs(efifb->fb_mask_red) - 1, @@ -137,16 +133,6 @@ vt_efifb_init(struct vt_device *vd) info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase, info->fb_size, VM_MEMATTR_WRITE_COMBINING); - /* Get pixel storage size. */ - info->fb_bpp = info->fb_stride / info->fb_width * 8; - - /* -* Early FB driver work with static window buffer, so reduce to minimal -* size, buffer or screen. -*/ - info->fb_width = MIN(info->fb_width, VT_FB_DEFAULT_WIDTH); - info->fb_height = MIN(info->fb_height, VT_FB_DEFAULT_HEIGHT); - vt_fb_init(vd); return (CN_INTERNAL); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286808 - head/sys/dev/vt
Author: marcel Date: Sat Aug 15 15:44:09 2015 New Revision: 286808 URL: https://svnweb.freebsd.org/changeset/base/286808 Log: Improve the VT initialization message: have it say what the resolution is. For text mode this is the number of columns by the number of rows. Include the name of the driver in a much less prominent way. Modified: head/sys/dev/vt/vt_core.c Modified: head/sys/dev/vt/vt_core.c == --- head/sys/dev/vt/vt_core.c Sat Aug 15 15:42:21 2015(r286807) +++ head/sys/dev/vt/vt_core.c Sat Aug 15 15:44:09 2015(r286808) @@ -264,8 +264,9 @@ vt_update_static(void *dummy) if (!vty_enabled(VTY_VT)) return; if (main_vd->vd_driver != NULL) - printf("VT: running with driver \"%s\".\n", - main_vd->vd_driver->vd_name); + printf("VT(%s): %s %ux%u\n", main_vd->vd_driver->vd_name, + (main_vd->vd_flags & VDF_TEXTMODE) ? "text" : "resolution", + main_vd->vd_width, main_vd->vd_height); else printf("VT: init without driver.\n"); ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286741 - head/sys/dev/md
Author: marcel Date: Thu Aug 13 19:12:55 2015 New Revision: 286741 URL: https://svnweb.freebsd.org/changeset/base/286741 Log: s/as/at/ in previous commit. Pointed out by: jmallett@ Modified: head/sys/dev/md/md.c Modified: head/sys/dev/md/md.c == --- head/sys/dev/md/md.cThu Aug 13 19:05:18 2015(r286740) +++ head/sys/dev/md/md.cThu Aug 13 19:12:55 2015(r286741) @@ -1565,7 +1565,7 @@ md_preloaded(u_char *image, size_t lengt printf("%s%d: Preloaded image <%s> %zd bytes at %p\n", MD_NAME, sc->unit, name, length, image); } else { - printf("%s%d: Embedded image %zd bytes as %p\n", + printf("%s%d: Embedded image %zd bytes at %p\n", MD_NAME, sc->unit, length, image); } } ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286727 - in head/sys: conf dev/md
Author: marcel Date: Thu Aug 13 15:16:34 2015 New Revision: 286727 URL: https://svnweb.freebsd.org/changeset/base/286727 Log: Change md(4) to use weak symbols as start, end and size for the embedded root disk. The embedded image is linked into the kernel in the .mfs section. Add rules and variables to kern.pre.mk and kern.post.mk that handle the linking of the image. First objcopy is used to generate an object file. Then, the object file is linked into the kernel. Submitted by: Steve Kiernan Reviewed by: brooks@ Obtained from: Juniper Networks, Inc. Differential Revision:https://reviews.freebsd.org/D2903 Modified: head/sys/conf/Makefile.arm head/sys/conf/kern.post.mk head/sys/conf/kern.pre.mk head/sys/dev/md/md.c Modified: head/sys/conf/Makefile.arm == --- head/sys/conf/Makefile.arm Thu Aug 13 14:53:29 2015(r286726) +++ head/sys/conf/Makefile.arm Thu Aug 13 15:16:34 2015(r286727) @@ -66,10 +66,6 @@ SYSTEM_LD_TAIL +=;sed s/" + SIZEOF_HEADE ${KERNEL_KO}.bin; \ rm ${FULLKERNEL}.noheader -.if defined(MFS_IMAGE) -SYSTEM_LD_TAIL += ;sh ${S}/tools/embed_mfs.sh ${KERNEL_KO}.bin ${MFS_IMAGE}; -.endif - FILES_CPU_FUNC = \ $S/$M/$M/cpufunc_asm_arm9.S \ $S/$M/$M/cpufunc_asm_arm10.S \ Modified: head/sys/conf/kern.post.mk == --- head/sys/conf/kern.post.mk Thu Aug 13 14:53:29 2015(r286726) +++ head/sys/conf/kern.post.mk Thu Aug 13 15:16:34 2015(r286727) @@ -121,7 +121,7 @@ gdbinit: .endif .endif -${FULLKERNEL}: ${SYSTEM_DEP} vers.o ${MFS_IMAGE} +${FULLKERNEL}: ${SYSTEM_DEP} vers.o @rm -f ${.TARGET} @echo linking ${.TARGET} ${SYSTEM_LD} @@ -133,9 +133,6 @@ ${FULLKERNEL}: ${SYSTEM_DEP} vers.o ${MF ${OBJCOPY} --strip-debug ${.TARGET} .endif ${SYSTEM_LD_TAIL} -.if defined(MFS_IMAGE) - sh ${S}/tools/embed_mfs.sh ${FULLKERNEL} ${MFS_IMAGE} -.endif .if !exists(${.OBJDIR}/.depend) ${SYSTEM_OBJS}: assym.s vnode_if.h ${BEFORE_DEPEND:M*.h} ${MFILES:T:S/.m$/.h/} @@ -301,6 +298,27 @@ vnode_if_newproto.h: vnode_if_typedef.h: ${AWK} -f $S/tools/vnode_if.awk $S/kern/vnode_if.src -q +.if ${MFS_IMAGE:Uno} != "no" +# Generate an object file from the file system image to embed in the kernel +# via linking. Make sure the contents are in the mfs section and rename the +# start/end/size variables to __start_mfs, __stop_mfs, and mfs_size, +# respectively. +embedfs_${MFS_IMAGE:T:R}.o: ${MFS_IMAGE} + ${OBJCOPY} --input-target binary \ + --output-target ${EMBEDFS_FORMAT.${MACHINE_ARCH}} \ + --binary-architecture ${EMBEDFS_ARCH.${MACHINE_ARCH}} \ + ${MFS_IMAGE} ${.TARGET} + ${OBJCOPY} \ + --rename-section .data=mfs,contents,alloc,load,readonly,data \ + --redefine-sym \ + _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_size=__mfs_root_size \ + --redefine-sym \ + _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_start=mfs_root \ + --redefine-sym \ + _binary_${MFS_IMAGE:C,[^[:alnum:]],_,g}_end=mfs_root_end \ + ${.TARGET} +.endif + # XXX strictly, everything depends on Makefile because changes to ${PROF} # only appear there, but we don't handle that. Modified: head/sys/conf/kern.pre.mk == --- head/sys/conf/kern.pre.mk Thu Aug 13 14:53:29 2015(r286726) +++ head/sys/conf/kern.pre.mk Thu Aug 13 15:16:34 2015(r286727) @@ -191,6 +191,9 @@ SYSTEM_DEP= Makefile ${SYSTEM_OBJS} SYSTEM_OBJS= locore.o ${MDOBJS} ${OBJS} SYSTEM_OBJS+= ${SYSTEM_CFILES:.c=.o} SYSTEM_OBJS+= hack.So +.if ${MFS_IMAGE:Uno} != "no" +SYSTEM_OBJS+= embedfs_${MFS_IMAGE:T:R}.o +.endif SYSTEM_LD= @${LD} -Bdynamic -T ${LDSCRIPT} ${_LDFLAGS} --no-warn-mismatch \ --warn-common --export-dynamic --dynamic-linker /red/herring \ -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o @@ -222,6 +225,32 @@ MKMODULESENV+= DEBUG_FLAGS="${DEBUG}" .endif MKMODULESENV+= _MPATH="${_MPATH}" +# Architecture and output format arguments for objdump to convert image to +# object file +.if ${MFS_IMAGE:Uno} != "no" + +.if !defined(EMBEDFS_FORMAT.${MACHINE_ARCH}) +EMBEDFS_FORMAT.${MACHINE_ARCH}!= awk -F'"' '/OUTPUT_FORMAT/ {print $$2}' ${LDSCRIPT} +.if empty(EMBEDFS_FORMAT.${MACHINE_ARCH}) +.undef EMBEDFS_FORMAT.${MACHINE_ARCH} +.endif +.endif + +.if !defined(EMBEDFS_ARCH.${MACHINE_ARCH}) +EMBEDFS_ARCH.${MACHINE_ARCH}!= sed -n '/OUTPUT_ARCH/s/.*(\(.*\)).*/\1/p' ${LDSCRIPT} +.if empty(EMBEDFS_ARCH.${MACHINE_ARCH}) +.undef EMBEDFS_ARCH.${MACHINE_ARCH} +.endif +.endif + +EMBEDFS_FORMAT.arm?= elf32-littlearm +EMBEDFS_FORMAT.armv6?= elf32-littlearm +EMBEDFS_FORMAT.mips?= elf32-tradbigmips +EMBEDFS_FORMAT.mipsel?=
svn commit: r286725 - in head/sys/arm: arm include
Author: marcel Date: Thu Aug 13 14:50:11 2015 New Revision: 286725 URL: https://svnweb.freebsd.org/changeset/base/286725 Log: The Broadcom BCM56060 chip has a Cortex-A9R4 core. Submitted by: Steve Kiernan Reviewed by: imp@ Differential Revision:https://reviews.freebsd.org/D3357 Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/arm/identcpu.c head/sys/arm/include/armreg.h Modified: head/sys/arm/arm/cpufunc.c == --- head/sys/arm/arm/cpufunc.c Thu Aug 13 14:43:25 2015(r286724) +++ head/sys/arm/arm/cpufunc.c Thu Aug 13 14:50:11 2015(r286725) @@ -904,6 +904,7 @@ set_cpufuncs() cputype == CPU_ID_CORTEXA9R1 || cputype == CPU_ID_CORTEXA9R2 || cputype == CPU_ID_CORTEXA9R3 || + cputype == CPU_ID_CORTEXA9R4 || cputype == CPU_ID_CORTEXA12R0 || cputype == CPU_ID_CORTEXA15R0 || cputype == CPU_ID_CORTEXA15R1 || Modified: head/sys/arm/arm/identcpu.c == --- head/sys/arm/arm/identcpu.c Thu Aug 13 14:43:25 2015(r286724) +++ head/sys/arm/arm/identcpu.c Thu Aug 13 14:50:11 2015(r286725) @@ -185,6 +185,8 @@ const struct cpuidtab cpuids[] = { generic_steppings }, { CPU_ID_CORTEXA9R3,CPU_CLASS_CORTEXA, "Cortex A9-r3", generic_steppings }, + { CPU_ID_CORTEXA9R4,CPU_CLASS_CORTEXA, "Cortex A9-r4", + generic_steppings }, { CPU_ID_CORTEXA12R0, CPU_CLASS_CORTEXA, "Cortex A12-r0", generic_steppings }, { CPU_ID_CORTEXA15R0, CPU_CLASS_CORTEXA, "Cortex A15-r0", Modified: head/sys/arm/include/armreg.h == --- head/sys/arm/include/armreg.h Thu Aug 13 14:43:25 2015 (r286724) +++ head/sys/arm/include/armreg.h Thu Aug 13 14:50:11 2015 (r286725) @@ -133,6 +133,7 @@ #define CPU_ID_CORTEXA9R1 0x411fc090 #define CPU_ID_CORTEXA9R2 0x412fc090 #define CPU_ID_CORTEXA9R3 0x413fc090 +#define CPU_ID_CORTEXA9R4 0x414fc090 #define CPU_ID_CORTEXA12R0 0x410fc0d0 #define CPU_ID_CORTEXA15R0 0x410fc0f0 #define CPU_ID_CORTEXA15R1 0x411fc0f0 ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286726 - head/sys/arm/arm
Author: marcel Date: Thu Aug 13 14:53:29 2015 New Revision: 286726 URL: https://svnweb.freebsd.org/changeset/base/286726 Log: Instead of having separate do_sync functions for ARM_ARCH 6 vs. ARM_ARCH >= 7, use the dmb() macro defined in machine/atomic.h Submitted by: Steve Kiernan Reviewed by: imp@ Differential Revision:https://reviews.freebsd.org/D3355 Modified: head/sys/arm/arm/stdatomic.c Modified: head/sys/arm/arm/stdatomic.c == --- head/sys/arm/arm/stdatomic.cThu Aug 13 14:50:11 2015 (r286725) +++ head/sys/arm/arm/stdatomic.cThu Aug 13 14:53:29 2015 (r286726) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -67,19 +68,12 @@ do_sync(void) __asm volatile ("" : : : "memory"); } -#elif __ARM_ARCH >= 7 -static inline void -do_sync(void) -{ - - __asm volatile ("dmb" : : : "memory"); -} #elif __ARM_ARCH >= 6 static inline void do_sync(void) { - __asm volatile ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory"); + dmb(); } #endif ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286723 - head/sys/dev/vt/hw/vga
Author: marcel Date: Thu Aug 13 14:43:11 2015 New Revision: 286723 URL: https://svnweb.freebsd.org/changeset/base/286723 Log: Fix text mode operation. We first map 64KB at 0xA and then determine whether to work in text or graphics mode. When graphics mode, the mapping is precisely what we need and everything is fine. But text mode, has the frame buffer relocated to 0xB8000. We didn't map that much to safely add 0x18000 bytes to the base address. Now we first check whether to work in text or graphics mode and then map the frame buffer at the right address and with the right size (0xA+64KB for graphics, 0xB8000+32KB for text). PR: 202276 Tested by:ed@ Modified: head/sys/dev/vt/hw/vga/vt_vga.c head/sys/dev/vt/hw/vga/vt_vga_reg.h Modified: head/sys/dev/vt/hw/vga/vt_vga.c == --- head/sys/dev/vt/hw/vga/vt_vga.c Thu Aug 13 13:38:09 2015 (r286722) +++ head/sys/dev/vt/hw/vga/vt_vga.c Thu Aug 13 14:43:11 2015 (r286723) @@ -883,9 +883,9 @@ vga_bitblt_text_txtmode(struct vt_device /* Convert colors to VGA attributes. */ attr = bg << 4 | fg; - MEM_WRITE1(sc, 0x18000 + (row * 80 + col) * 2 + 0, + MEM_WRITE1(sc, (row * 80 + col) * 2 + 0, ch); - MEM_WRITE1(sc, 0x18000 + (row * 80 + col) * 2 + 1, + MEM_WRITE1(sc, (row * 80 + col) * 2 + 1, attr); } } @@ -1226,8 +1226,6 @@ vga_init(struct vt_device *vd) # error "Architecture not yet supported!" #endif - bus_space_map(sc->vga_fb_tag, VGA_MEM_BASE, VGA_MEM_SIZE, 0, - &sc->vga_fb_handle); bus_space_map(sc->vga_reg_tag, VGA_REG_BASE, VGA_REG_SIZE, 0, &sc->vga_reg_handle); @@ -1236,9 +1234,13 @@ vga_init(struct vt_device *vd) vd->vd_flags |= VDF_TEXTMODE; vd->vd_width = 80; vd->vd_height = 25; + bus_space_map(sc->vga_fb_tag, VGA_TXT_BASE, VGA_TXT_SIZE, 0, + &sc->vga_fb_handle); } else { vd->vd_width = VT_VGA_WIDTH; vd->vd_height = VT_VGA_HEIGHT; + bus_space_map(sc->vga_fb_tag, VGA_MEM_BASE, VGA_MEM_SIZE, 0, + &sc->vga_fb_handle); } if (vga_initialize(vd, textmode) != 0) return (CN_DEAD); Modified: head/sys/dev/vt/hw/vga/vt_vga_reg.h == --- head/sys/dev/vt/hw/vga/vt_vga_reg.h Thu Aug 13 13:38:09 2015 (r286722) +++ head/sys/dev/vt/hw/vga/vt_vga_reg.h Thu Aug 13 14:43:11 2015 (r286723) @@ -49,6 +49,8 @@ #defineVGA_MEM_BASE0xA #defineVGA_MEM_SIZE0x1 +#defineVGA_TXT_BASE0xB8000 +#defineVGA_TXT_SIZE0x08000 #defineVGA_REG_BASE0x3c0 #defineVGA_REG_SIZE0x10+0x0c ___ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
Re: svn commit: r286667 - in head/sys: amd64/amd64 conf dev/vt/hw/efifb dev/vt/hw/vga i386/i386 x86/include x86/x86
> On Aug 12, 2015, at 1:17 PM, Ed Schouten wrote: > > 2015-08-12 22:02 GMT+02:00 Marcel Moolenaar : >> Maybe upgrading to 4.3.30 resolves the issue? > > I just upgraded to 4.3.30 and 5.0.0. Both fail the same way. I've just > attached a screenshot. Will open a bug. Thanks! -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r286667 - in head/sys: amd64/amd64 conf dev/vt/hw/efifb dev/vt/hw/vga i386/i386 x86/include x86/x86
> On Aug 12, 2015, at 10:37 AM, Ed Schouten wrote: > > Hi Marcel, > > 2015-08-12 17:26 GMT+02:00 Marcel Moolenaar : >> Better support memory mapped console devices, such as VGA and EFI >> frame buffers and memory mapped UARTs. > > This change causes my FreeBSD instance in Virtualbox 4.3.28 (OS X) to > crash. As soon as the kernel initializes the graphics on startup > (read: before printing any messages), I see random garbage appear on > screen, followed by a popup dialog from Virtualbox that a fatal > machine exception has occurred. No problems are seen with VB 5.0 on Mac OS X and having BIOS (don’t know if VB even supports UEFI) and with FreeBSD/amd64. Maybe upgrading to 4.3.30 resolves the issue? -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
Re: svn commit: r286667 - in head/sys: amd64/amd64 conf dev/vt/hw/efifb dev/vt/hw/vga i386/i386 x86/include x86/x86
[CC ed] > On Aug 12, 2015, at 10:37 AM, Ed Schouten wrote: > > Hi Marcel, > > 2015-08-12 17:26 GMT+02:00 Marcel Moolenaar : >> Better support memory mapped console devices, such as VGA and EFI >> frame buffers and memory mapped UARTs. > > This change causes my FreeBSD instance in Virtualbox 4.3.28 (OS X) to > crash. As soon as the kernel initializes the graphics on startup > (read: before printing any messages), I see random garbage appear on > screen, followed by a popup dialog from Virtualbox that a fatal > machine exception has occurred. Would you mind creating a PR so that we can track the various console issues pre and post this change. Details as to how to reproduce would be much appreciated! Thanks, -- Marcel Moolenaar mar...@xcllnt.net signature.asc Description: Message signed with OpenPGP using GPGMail
svn commit: r286668 - head/sys/dev/uart
Author: marcel Date: Wed Aug 12 15:48:14 2015 New Revision: 286668 URL: https://svnweb.freebsd.org/changeset/base/286668 Log: Add support for the Broadcom TruManage integrated serial port. PR: 191266 Modified: head/sys/dev/uart/uart_bus_pci.c Modified: head/sys/dev/uart/uart_bus_pci.c == --- head/sys/dev/uart/uart_bus_pci.cWed Aug 12 15:26:32 2015 (r286667) +++ head/sys/dev/uart/uart_bus_pci.cWed Aug 12 15:48:14 2015 (r286668) @@ -115,6 +115,8 @@ static const struct pci_id pci_ns8250_id 0x10, 16384000 }, { 0x1415, 0xc120, 0x, 0, "Oxford Semiconductor OXPCIe952 PCIe 16950 UART", 0x10 }, +{ 0x14e4, 0x160a, 0x, 0, "Broadcom TruManage UART", 0x10, + 128 * DEFAULT_RCLK, 2}, { 0x14e4, 0x4344, 0x, 0, "Sony Ericsson GC89 PC Card", 0x10}, { 0x151f, 0x, 0x, 0, "TOPIC Semiconductor TP560 56k modem", 0x10 }, { 0x1fd4, 0x1999, 0x1fd4, 0x0001, "Sunix SER5 Serial Port", 0x10, ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286667 - in head/sys: amd64/amd64 conf dev/vt/hw/efifb dev/vt/hw/vga i386/i386 x86/include x86/x86
PPING_COUNT; i++) { + ppim = pmap_preinit_mapping + i; + if (ppim->va == va && ppim->sz == size) { + if (pmap_initialized) + return; + ppim->pa = 0; + ppim->va = 0; + ppim->sz = 0; + ppim->mode = 0; + if (va + size == virtual_avail) + virtual_avail = va; + return; + } + } + if (pmap_initialized) + kva_free(va, size); } /* Modified: head/sys/x86/include/bus.h == --- head/sys/x86/include/bus.h Wed Aug 12 14:17:41 2015(r28) +++ head/sys/x86/include/bus.h Wed Aug 12 15:26:32 2015(r286667) @@ -130,32 +130,15 @@ * Map a region of device bus space into CPU virtual address space. */ -static __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int flags, - bus_space_handle_t *bshp); - -static __inline int -bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr, - bus_size_t size __unused, int flags __unused, - bus_space_handle_t *bshp) -{ - - *bshp = addr; - return (0); -} +int bus_space_map(bus_space_tag_t tag, bus_addr_t addr, bus_size_t size, +int flags, bus_space_handle_t *bshp); /* * Unmap a region of device bus space. */ -static __inline void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - -static __inline void -bus_space_unmap(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused, - bus_size_t size __unused) -{ -} +void bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t bsh, +bus_size_t size); /* * Get a new handle for a subregion of an already-mapped area of bus space. Added: head/sys/x86/x86/bus_machdep.c == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/x86/x86/bus_machdep.c Wed Aug 12 15:26:32 2015 (r286667) @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 2015 Marcel Moolenaar + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +/* + * Implementation of bus_space_map(), which effectively is a thin + * wrapper around pmap_mapdev() for memory mapped I/O space. It's + * implemented here and not in to avoid pollution. + */ +int +bus_space_map(bus_space_tag_t tag, bus_addr_t addr, bus_size_t size, +int flags __unused, bus_space_handle_t *bshp) +{ + + *bshp = (tag == X86_BUS_SPACE_MEM) + ? (uintptr_t)pmap_mapdev(addr, size) + : addr; + return (0); +} + +void +bus_space_unmap(bus_space_tag_t tag, bus_space_handle_t bsh, bus_size_t size) +{ + + if (tag == X86_BUS_SPACE_MEM) + pmap_unmapdev(bsh, size); +} ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286653 - head/sys/dev/uart
Author: marcel Date: Wed Aug 12 04:03:04 2015 New Revision: 286653 URL: https://svnweb.freebsd.org/changeset/base/286653 Log: Use bus_alloc_resource_any(), rather than bus_alloc_resource() with start 0 and end ~0. This avoids confusion WRT to what the value of length can or should be. Modified: head/sys/dev/uart/uart_core.c Modified: head/sys/dev/uart/uart_core.c == --- head/sys/dev/uart/uart_core.c Wed Aug 12 03:03:51 2015 (r286652) +++ head/sys/dev/uart/uart_core.c Wed Aug 12 04:03:04 2015 (r286653) @@ -474,14 +474,13 @@ uart_bus_probe(device_t dev, int regshft */ sc->sc_rrid = rid; sc->sc_rtype = SYS_RES_IOPORT; - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, - 0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype, &sc->sc_rrid, + RF_ACTIVE); if (sc->sc_rres == NULL) { sc->sc_rrid = rid; sc->sc_rtype = SYS_RES_MEMORY; - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, - &sc->sc_rrid, 0, ~0, uart_getrange(sc->sc_class), - RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype, + &sc->sc_rrid, RF_ACTIVE); if (sc->sc_rres == NULL) return (ENXIO); } @@ -556,8 +555,8 @@ uart_bus_attach(device_t dev) * Re-allocate. We expect that the softc contains the information * collected by uart_bus_probe() intact. */ - sc->sc_rres = bus_alloc_resource(dev, sc->sc_rtype, &sc->sc_rrid, - 0, ~0, uart_getrange(sc->sc_class), RF_ACTIVE); + sc->sc_rres = bus_alloc_resource_any(dev, sc->sc_rtype, &sc->sc_rrid, + RF_ACTIVE); if (sc->sc_rres == NULL) { mtx_destroy(&sc->sc_hwmtx_s); return (ENXIO); ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286439 - head/share/man/man4
Author: marcel Date: Sat Aug 8 04:59:27 2015 New Revision: 286439 URL: https://svnweb.freebsd.org/changeset/base/286439 Log: Document the application interface. Modified: head/share/man/man4/proto.4 Modified: head/share/man/man4/proto.4 == --- head/share/man/man4/proto.4 Sat Aug 8 01:45:53 2015(r286438) +++ head/share/man/man4/proto.4 Sat Aug 8 04:59:27 2015(r286439) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 19, 2015 +.Dd August 7, 2015 .Dt PROTO 4 .Os .\" @@ -74,7 +74,285 @@ logic in user space. Especially hardware diagnostics requires a somewhat user-friendly interface and adequate reporting. Neither is done easily as kernel code. -.\" +.Ss I/O port resources +Device special files created for I/O port resources allow +.Xr lseek 2 , +.Xr read 2 , +.Xr write 2 +and +.Xr ioctl 2 +operations to be performed on them. +The +.Xr read 2 +and +.Xr write 2 +system calls are used to perform input and output (resp.) on the port. +The amount of data that can be read or written at any single time is either +1, 2 or 4 bytes. +While the +.Nm +driver does not prevent reading or writing 8 bytes at a time for some +architectures, it should not be assumed that such actually produces +correct results. +The +.Xr lseek 2 +system call is used to select the port number, relative to the I/O port +region being represented by the device special file. +If, for example, the device special file corresponds to an I/O port region +from 0x3f8 to 0x3ff inclusive, then an offset of 4 given to lseek with a +whence value of SEEK_SET will target port 0x3fc on the next read or write +operation. +The +.Xr ioctl 2 +system call can be used for the +.Dv PROTO_IOC_REGION +request. +This ioctl request returns the extend of the resource covered by this +device special file. The extend is returned in the following structure: +.Bd -literal +struct proto_ioc_region { +unsigned long address; +unsigned long size; +}; +.Ed +.Ss Memory mapped I/O resources +The device special files created for memory mapped I/O resources behave +in the same way as those created for I/O port resources. +Additionally, device special files for memory mapped I/O resources allow +the memory to be mapped into the process' address space using +.Xr mmap 2 . +Reads and writes to the memory address returned by +.Xr mmap 2 +go directly to the hardware. +As such the use of +.Xr read 2 +and +.Xr write 2 +can be avoided, reducing the access overhead significantly. +Alignment and access width constraints put forth by the underlying device +apply. +Also, make sure the compiler does not optimize memory accesses away or has +them coalesced into bigger accesses. +.Ss DMA pseudo resource +A device special file named +.Pa busdma +is created for the purpose of doing DMA. +It only supports +.Xr ioctl 2 +and only for the +.Dv PROTO_IOC_BUSDMA +request. +This device special file does not support +.Xr read 2 +nor +.Xr write 2 . +The +.Dv PROTO_IOC_BUSDMA +request has an argument that is both in and out and is defined as +follows: +.Bd -literal +struct proto_ioc_busdma { +unsigned intrequest; +unsigned long key; +union { +struct { +unsigned long align; +unsigned long bndry; +unsigned long maxaddr; +unsigned long maxsz; +unsigned long maxsegsz; +unsigned intnsegs; +unsigned intdatarate; +unsigned intflags; +} tag; +struct { +unsigned long tag; +unsigned intflags; +unsigned long virt_addr; +unsigned long virt_size; +unsigned intphys_nsegs; +unsigned long phys_addr; +unsigned long bus_addr; +unsigned intbus_nsegs; +} md; +struct { +unsigned intop; +unsigned long base; +unsigned long size; +} sync; +} u; +unsigned long result; +}; +.Ed +The +.Va request +field is used to specify which DMA operation is to be performed. +The +.Va key +field is used to specify which object the operation applies to. +An object is either a tag or a memory descriptor (md). +The following DMA operations are defined: +.Bl -tag -width +.It PROTO_IOC_BUSDMA_TAG_CREATE +Create a root tag. +The +.Va result +field is set on output with the key of the DMA tag. +The tag is created with the constraints given by the +.Va tag +sub-structure. These constraints correspond roughly to those that can be +given to the +.Xr bus_dma_tag_create 9 +function. +.It PROT
svn commit: r286419 - head/usr.bin/mkimg
Author: marcel Date: Fri Aug 7 18:40:44 2015 New Revision: 286419 URL: https://svnweb.freebsd.org/changeset/base/286419 Log: Fix typo introduced in previous commit. Pointed out by: Nikolai Lifanov Modified: head/usr.bin/mkimg/mkimg.1 Modified: head/usr.bin/mkimg/mkimg.1 == --- head/usr.bin/mkimg/mkimg.1 Fri Aug 7 18:30:11 2015(r286418) +++ head/usr.bin/mkimg/mkimg.1 Fri Aug 7 18:40:44 2015(r286419) @@ -184,7 +184,7 @@ on the command line. To write version 2 QCOW, specify .Fl f Ar qcow2 on the command line. -The preferred file extension is ".qcow" iand ".qcow2" for QCOW and QCOW2 +The preferred file extension is ".qcow" and ".qcow2" for QCOW and QCOW2 (resp.), but ".qcow" is sometimes used for version 2 files as well. .Ss RAW file format This file format is a sector by sector representation of an actual disk. ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"
svn commit: r286417 - head/usr.bin/mkimg
Author: marcel Date: Fri Aug 7 17:22:37 2015 New Revision: 286417 URL: https://svnweb.freebsd.org/changeset/base/286417 Log: o Fix a typo. o Describe the file formats mkimg can create. Modified: head/usr.bin/mkimg/mkimg.1 Modified: head/usr.bin/mkimg/mkimg.1 == --- head/usr.bin/mkimg/mkimg.1 Fri Aug 7 16:23:16 2015(r286416) +++ head/usr.bin/mkimg/mkimg.1 Fri Aug 7 17:22:37 2015(r286417) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 22, 2015 +.Dd August 7, 2015 .Dt MKIMG 1 .Os .Sh NAME @@ -141,7 +141,7 @@ utility will create images that are iden .Pp A set of long options exist to query about the .Nm -utilty itself. +utility itself. Options in this set should be given by themselves because the .Nm utility exits immediately after providing the requested information. @@ -165,6 +165,85 @@ run the .Nm utility without any arguments. This will print a usage message with all the necessary details. +.Sh DISK FORMATS +The +.Nm +utility supports a number of output file formats. +A short description of these is given below. +.Ss QCOW and QCOW2 +QCOW stands for "QEMU Copy On Write". +It's a sparse file format akin to VHD and VMDK and QCOW represents the +first version. +QCOW2 represents version 2 of the file format. +Version 2 is not backward compatible with version 1 and adds support for +snapshots among other things. +The QCOW file formats are natively supported by QEMU and Xen. +To write QCOW, specify +.Fl f Ar qcow +on the command line. +To write version 2 QCOW, specify +.Fl f Ar qcow2 +on the command line. +The preferred file extension is ".qcow" iand ".qcow2" for QCOW and QCOW2 +(resp.), but ".qcow" is sometimes used for version 2 files as well. +.Ss RAW file format +This file format is a sector by sector representation of an actual disk. +There is no extra information that describes or relates to the format +itself. The size of the file is the size of the (virtual) disk. +This file format is suitable for being copyied onto a disk with utilities +like +.Nm dd . +To write a raw disk file, either omit the +.Fl f +option, or specify +.Fl f Ar raw +on the command line. +The preferred file extension is one of ".img" or ".raw", but there's no +real convention for it. +.Ss Dynamic VHD and Fixed VHD +Microsoft's "Virtual Hard Disk" file formats. +The dynamic format is a sparse format akin to QCOW and VMDK. +The fixed format is effectively a raw format with a footer appended to the +file and as such it's often indistinguishable from the raw format. +The fixed file format has been added to support Microsoft's Azure platform +and due to inconsistencies in interpretation of the footer is not compatible +with utilities like +.Nm qemu +when it is specifically instructed to interpreted the file as a VHD file. +By default +.Nm qemu +will treat the file as a raw disk file, which mostly works fine. +To have +.Nm +create a dynamic VHD file, specify +.Fl f Ar vhd +on the command line. +To create a fixed VHD file for use by Azure, specify +.Fl f Ar vhdf +on the command line. +The preferred file extension is ".vhd". +.Ss VMDK +VMware's "Virtual Machine Disk" file format. +It's a sparse file format akin to QCOW and VHD and supported by many +virtualization solutions. +To create a VMDK file, specify +.Fl f Ar vmdk +on the command line. +The preferred file extension is ".vmdk". +.Pp +Not all virtualization solutions support all file formats, but often those +virtualization environments have utilities to convert from one format to +another. +Note however that conversion may require that the virtual disk size is +changed to match the constraints of the output format and this may invalidate +the contents of the disk image. +For example, the GUID Partition Table (GPT) scheme has a header in the last +sector on the disk. +When changing the disk size, the GPT must be changed so that the last header +is moved accordingly. +This is typically not part of the conversion process. +If possible, use an output format specifically for the environment in which +the file is intended to be used. .Sh ENVIRONMENT .Bl -tag -width "TMPDIR" -compact .It Ev TMPDIR @@ -235,6 +314,7 @@ utility supports assigning labels to the In the following example the file system partition is labeled as 'backup': .Dl % mkimg -s gpt -p freebsd-ufs/backup:=file-system.ufs -o gpt.img .Sh SEE ALSO +.Xr dd 1 , .Xr gpart 8 , .Xr makefs 8 , .Xr mdconfig 8 , ___ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"